Skip to main content
skill

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.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --skill development/clerk-auth
Open on GitHub

What 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 clerkMiddleware and createRouteMatcher
  • 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.ts to protect dashboard routes with createRouteMatcher
  • 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-auth

2Skills CLI (Vercel)

npx skills add davila7/claude-code-templates --skill clerk-auth -a claude-code

3Manually: put the files in place

~/.claude/skills/clerk-auth/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/clerk-auth/

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.

Similar skills

All skills for Security →

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor