
Clerk Auth
This covers the essential Clerk patterns you need for Next.js App Router projects: setting up ClerkProvider, protecting routes with middleware, and accessing auth state in server components. The middleware guidance is solid, emphasizing a single root file and createRouteMatcher for route groups. There's a sharp edges table that lists eight issues from critical to medium severity, though the actual problems aren't described in what I'm seeing. If you're adding Clerk to a Next.js 14 or 15 app, this gives you the core implementation patterns for sign in, sign up, route protection, and user session handling without hunting through docs.
- skills.sh installs
- 220
- GitHub stars
- 33.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add davila7/claude-code-templates --skill clerk-auth --agent claude-codeInstalls into .claude/skills of the current project.
Files
Clerk Authentication
Patterns
Next.js App Router Setup
Complete Clerk setup for Next.js 14/15 App Router.
Includes ClerkProvider, environment variables, and basic sign-in/sign-up components.
Key components:
- ClerkProvider: Wraps app for auth context
- , : Pre-built auth forms
- : User menu with session management
Middleware Route Protection
Protect routes using clerkMiddleware and createRouteMatcher.
Best practices:
- Single middleware.ts file at project root
- Use createRouteMatcher for route groups
- auth.protect() for explicit protection
- Centralize all auth logic in middleware
Server Component Authentication
Access auth state in Server Components using auth() and currentUser().
Key functions:
- auth(): Returns userId, sessionId, orgId, claims
- currentUser(): Returns full User object
- Both require clerkMiddleware to be configured
⚠️ Sharp Edges
Sponsors
Details
- Repository
- github.com/davila7/claude-code-templates
- Categories
- Backend & APIs, Security
- First seen
- Jun 3, 2026
More from davila7/claude-code-templates
All 618- Cellxgene Census219
- Kaizen219
- Lamindb219
- Nosql Expert219
- Opentargets Database219
- Pyopenms219
- Capa Officer218
- Deeptools218
- Ena Database218
- Naming Analyzer218
- Popup Cro218
- Cosmic Database217
- Histolab217
- Neuropixels Analysis217
- Pydeseq2217
- Benchling Integration216
- Hypogenic216
- Notion Template Business216
- Pennylane215
- Zinc Database215
- Cirq214
- Esm214
- Geniml214
- Matchms214