What problem does it solve?
This Skill prevents common authentication and authorization mistakes in Next.js applications using Clerk, including client-side auth flashes, unprotected routes and Server Actions, incorrect API status codes, and user data leaks caused by improperly scoped caching.
Core Features & Use Cases
- Server and Client Auth Patterns: Choose correctly between server-side auth, client hooks, conditional rendering, and hybrid components.
- Route and Mutation Protection: Configure Clerk middleware, protect API routes and Server Actions, and enforce organization roles and permissions.
- Caching and Token Security: Build user- and organization-scoped caches, revalidate authenticated data safely, and retrieve or manually verify Clerk JWTs.
- Use Case: Secure a Next.js dashboard by protecting its routes with Clerk middleware, enforcing permissions on mutations, and preventing cached data from being shared across users.
Quick Start
Use the clerk-nextjs-patterns skill to secure my Next.js dashboard, API routes, Server Actions, middleware, and authenticated caching with Clerk.