What problem does it solve?
This Skill fixes authentication and authorization mistakes in Clerk-powered apps that cause broken access control, runtime hook errors, or unsafe webhook-driven user state changes.
Core Features & Use Cases
- Route protection in Next.js middleware: Uses clerkMiddleware() with clear public route matchers so protected routes are enforced consistently before any page code runs.
- Correct server vs client user access patterns: Uses auth() and currentUser() in Server Components/API routes, and useUser()/useAuth()/useClerk() only for UI display in Client Components.
- Secure webhook-to-database sync for user lifecycle events: Verifies Svix signatures before updating your database, syncing user.created/updated/deleted events into a clerkId-backed users table for reliable identity mapping.
- Organization-based multi-tenancy: Ensures every database query is scoped by orgId from auth(), preventing cross-tenant data leaks when users switch organizations.
Quick Start
Configure Clerk middleware and the webhook handler, then ask your coding agent to implement the full Clerk auth + org-scoped database flow for your app with the required files and rules.