clerk-auth — Claude Code skill: what it does, how to install
Provides patterns to set up Clerk authentication, configure route protection middleware, and handle server components in Next.js App Router.
npx claude-code-templates@latest --skill development/clerk-authWhat clerk-auth does
This skill guides Claude Code through integrating Clerk into Next.js 14 and 15 applications using the App Router. It defines setups for ClerkProvider, environment variables, and pre-built UI components such as <SignIn />, <SignUp />, and <UserButton />.
Route protection relies entirely on a single middleware.ts placed at the project root. The patterns apply clerkMiddleware alongside createRouteMatcher to handle protected page groups explicitly through auth.protect().
Server-side helpers like auth() and currentUser() fail if clerkMiddleware is missing. The skill enforces configuring this middleware first before fetching userId, claims, or user profile records inside Server Components.
What it helps with
- integrate Clerk authentication into Next.js 14 or 15 App Router
- restrict private routes using
clerkMiddlewareandcreateRouteMatcher - read user identity and session data in Server Components
- insert pre-built sign-in, sign-up, and user profile buttons
Example prompts for the agent
- Set up Clerk authentication for our Next.js App Router app
- Configure
middleware.tsto protect dashboard routes withcreateRouteMatcher - Fetch the current user ID in a Server Component using
auth()
How to install clerk-auth
1claude-code-templates
npx claude-code-templates@latest --skill development/clerk-auth2Skills CLI (Vercel)
npx skills add davila7/claude-code-templates --skill clerk-auth -a claude-code3Manually: put the files in place
~/.claude/skills/clerk-auth/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/clerk-auth/
Manually: put the files in place
.agents/skills/clerk-auth/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/clerk-auth/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install davila7/claude-code-templates clerk-auth2Manually: put the files in place
.github/skills/clerk-auth/SKILL.mdPlatform CLI
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/development/clerk-authManually: put the files in place
.devin/skills/clerk-auth/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about clerk-auth
How do I install clerk-auth in Claude Code?
Run npx claude-code-templates@latest --skill development/clerk-auth in your terminal.
What does clerk-auth do?
It provides implementation guidelines for Clerk auth, covering root provider wrapping, middleware rules, and server component data access.
What framework versions does this setup target?
The patterns focus on Next.js 14 and 15 projects that use the App Router architecture.