What problem does it solve? Securing a Next.js application with Clerk involves many distinct patterns—middleware configuration, server versus client auth APIs, Server Action protection, and user-scoped caching—and mixing them up causes bugs like undefined userIds, unprotected mutations, and cross-user cache leaks. ## Core Features & Use Cases - Server vs Client Auth Guidance: Correct usage of await auth() from @clerk/nextjs/server versus useAuth() hooks, including Core 2 compatibility notes. - Middleware Strategies: Public-first and protected-first route protection with createRouteMatcher, permission-gated routes, and token-based protection for machine APIs. - Server Actions, API Routes & Caching: Protect mutations, return correct 401/403 status codes, and scope unstable_cache keys by userId or orgId. - Use Case: You need to protect all routes under /dashboard so only signed-in users can access them, while keeping / and /sign-in public—this Skill provides the exact clerkMiddleware configuration with createRouteMatcher and auth.protect(). ## Quick Start Protect my Next.js dashboard routes with Clerk middleware so only authenticated users can access them.