Clerk Authentication
Expert patterns for Clerk auth implementation, middleware, organizations, webhooks, and user sync
When to Use
- User mentions or implies: adding authentication
- User mentions or implies: clerk auth
- User mentions or implies: user authentication
- User mentions or implies: sign in
- User mentions or implies: sign up
- User mentions or implies: user management
- User mentions or implies: multi-tenancy
- User mentions or implies: organizations
- User mentions or implies: sso
- User mentions or implies: single sign-on
Core Workflow
- Confirm the request matches this skill's trigger, scope, and risk profile.
- Use the topic map to identify the relevant pattern, checklist, or example before writing detailed guidance or code.
- Load
references/full-guidance.md when implementation details, examples, anti-patterns, validation checks, or edge cases are needed.
- Apply only the relevant guidance instead of loading or repeating the entire reference by default.
- Verify the result against any validation checks, limitations, security notes, or platform constraints in the reference.
Topic Map
- Patterns
- Next.js App Router Setup
- Code_example
- Anti_patterns
- References
- Middleware Route Protection
- Server Component Authentication
- Client Component Hooks
- Organizations and Multi-Tenancy
- Webhook User Sync
- API Route Protection
- Sharp Edges
- CVE-2025-29927 Middleware Bypass Vulnerability
- Multiple Middleware Files Cause Conflicts
- 4KB Session Token Cookie Limit
- auth() Requires clerkMiddleware Configuration
- Webhook Race Conditions
- auth() is Async in App Router
Reference Map
references/full-guidance.md preserves the complete original guidance, including examples and detailed edge cases.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Progressive Loading
Keep this SKILL.md as the compact routing and workflow entrypoint. Load the reference file only when the user task requires the deeper implementation material.
1---2name: clerk-auth3description: Expert patterns for Clerk auth implementation, middleware,4license: MIT5---67# Clerk Authentication89Expert patterns for Clerk auth implementation, middleware, organizations, webhooks, and user sync1011## When to Use12- User mentions or implies: adding authentication13- User mentions or implies: clerk auth14- User mentions or implies: user authentication15- User mentions or implies: sign in16- User mentions or implies: sign up17- User mentions or implies: user management18- User mentions or implies: multi-tenancy19- User mentions or implies: organizations20- User mentions or implies: sso21- User mentions or implies: single sign-on2223## Core Workflow241. Confirm the request matches this skill's trigger, scope, and risk profile.252. Use the topic map to identify the relevant pattern, checklist, or example before writing detailed guidance or code.263. Load `references/full-guidance.md` when implementation details, examples, anti-patterns, validation checks, or edge cases are needed.274. Apply only the relevant guidance instead of loading or repeating the entire reference by default.285. Verify the result against any validation checks, limitations, security notes, or platform constraints in the reference.2930## Topic Map31- Patterns32- Next.js App Router Setup33- Code_example34- Anti_patterns35- References36- Middleware Route Protection37- Server Component Authentication38- Client Component Hooks39- Organizations and Multi-Tenancy40- Webhook User Sync41- API Route Protection42- Sharp Edges43- CVE-2025-29927 Middleware Bypass Vulnerability44- Multiple Middleware Files Cause Conflicts45- 4KB Session Token Cookie Limit46- auth() Requires clerkMiddleware Configuration47- Webhook Race Conditions48- auth() is Async in App Router4950## Reference Map51- `references/full-guidance.md` preserves the complete original guidance, including examples and detailed edge cases.5253## Limitations54- Use this skill only when the task clearly matches the scope described above.55- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.56- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.5758## Progressive Loading59Keep this `SKILL.md` as the compact routing and workflow entrypoint. Load the reference file only when the user task requires the deeper implementation material.