jeremylongshore/claude-code-plugins-plus-skills
clerk-pack
plugins/saas-packs/clerk-pack/skills/clerk-data-handling/SKILL.md
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/saas-packs/clerk-pack/skills/clerk-data-handling/SKILL.md -a claude-code --skill clerk-data-handlingInstallation paths:
.claude/skills/clerk-data-handling/# Clerk Data Handling
## Overview
Manage user data, implement privacy features, and ensure compliance with regulations.
## Prerequisites
- Clerk integration working
- Understanding of GDPR/CCPA requirements
- Database with user-related data
## Instructions
### Step 1: User Data Export
```typescript
// lib/data-export.ts
import { clerkClient } from '@clerk/nextjs/server'
import { db } from './db'
interface UserDataExport {
clerk: ClerkUserData
application: ApplicationUserData
exportedAt: string
}
interface ClerkUserData {
id: string
email: string | undefined
firstName: string | null
lastName: string | null
createdAt: Date
lastSignIn: Date | null
metadata: Record<string, any>
}
interface ApplicationUserData {
profile: any
orders: any[]
preferences: any
activityLog: any[]
}
export async function exportUserData(userId: string): Promise<UserDataExport> {
const client = await clerkClient()
// Get Clerk user data
const clerkUser = await client.users.getUser(userId)
// Get application data
const [profile, orders, preferences, activityLog] = await Promise.all([
db.userProfile.findUnique({ where: { clerkId: userId } }),
db.order.findMany({ where: { userId }, orderBy: { createdAt: 'desc' } }),
db.userPreference.findMany({ where: { userId } }),
db.activityLog.findMany({
where: { userId },
orderBy: { timestamp: 'desc' },
take: 1000
})
])
return {
clerk: {
id: clerkUser.id,
email: clerkUser.primaryEmailAddress?.emailAddress,
firstName: clerkUser.firstName,
lastName: clerkUser.lastName,
createdAt: new Date(clerkUser.createdAt),
lastSignIn: clerkUser.lastSignInAt ? new Date(clerkUser.lastSignInAt) : null,
metadata: {
public: clerkUser.publicMetadata,
// Note: privateMetadata should be handled carefully
}
},
application: {
profile: sanitizeForExport(profile),
orders: orders.map(sanitizeForExport),
pre