clerk-auth
What it does
This skill gives your AI agent patterns for adding Clerk sign-in to an app. It is for developers who want login, sign-up and route protection with Clerk.
When to use it
- ✓When you want to add sign-in or sign-up to a Next.js app with Clerk.
- ✓When you need to protect certain pages so only signed-in users can open them.
- ✓When you want to get the current user in a server component.
Skill link
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/clerk-auth/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Add Clerk sign-in to my Next.js app and protect the dashboard pages.”
5 new skills a week. 1 minute to read.
How it works
The agent sets up Clerk's provider, middleware and ready-made sign-in components. It then uses helper functions to read the signed-in user on the server and block protected routes.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
- <SignIn />, <SignUp />: Pre-built auth forms
- <UserButton />: 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
| Issue | Severity | Solution |
|---|---|---|
| Issue | critical | See docs |
| Issue | high | See docs |
| Issue | high | See docs |
| Issue | high | See docs |
| Issue | medium | See docs |
| Issue | medium | See docs |
| Issue | medium | See docs |
| Issue | medium | See docs |
FAQ
Which Next.js versions are covered?
The skill covers Next.js 14 and 15 with the App Router.
What ready-made components are there?
It includes SignIn, SignUp and UserButton components.
Does it cover webhooks?
Yes, the skill covers webhooks and user sync as well as organizations.
Details
Original description by the author
Expert patterns for Clerk auth implementation, middleware, organizations, webhooks, and user sync Use when: adding authentication, clerk auth, user authentication, sign in, sign up.
Popularity
- GitHub stars
- 33k
- Ranking position
- #8737
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
owasp-security
33kTeaches your agent OWASP security guidance for web apps, APIs, mobile, containers and AI agents, so it can spot common weaknesses and suggest fixes.
agent-management
33kLets your agent create, list, hibernate, wake, rename and delete AI agents using the AI Maestro command line, managing each agent's lifecycle.
agent-messaging
33kLets your agent send, receive and reply to signed messages between AI agents, using the Agent Messaging Protocol, mostly on your own machine.
docs-search
33kLets your agent search auto-generated code documentation for function signatures, class definitions and comments, so it checks the real API before changing code.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.