clerk
Skill15 starsChanged 45 days agoMITView on GitHub
Expert Clerk authentication assistance covering Next.js middleware, React user components, webhooks, and session tokens. Use when integrating Clerk auth, protecting routes, or handling user management.
- Reads credentials
11 other projects use a version of this.
Adopted by
Most recently taken up by
- nnawar706/fluentotheir own version, first seen Nov 8, 2026
- delorenj/skillstheir own version, first seen Nov 7, 2026
- clerk/skillstheir own version, first seen Oct 13, 2026
- adrianhajdin/ghost-aitheir own version, first seen Oct 9, 2026
- HamedMP/matrix-ostheir own version, first seen Oct 8, 2026
- Aymenjdily/biblion-testing-agentic-ai-skillstheir own version, first seen Sep 4, 2026
Used with
Projects with it also use clerk-nextjs-patterns, clerk-custom-ui and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
elpiartheraSkillclerk-nextjs-patterns
Advanced Next.js patterns - middleware, Server Actions, caching with Clerk.
Also in 7 projects that use this
elpiartheraSkillclerk-custom-ui
Customize Clerk component appearance - themes, layout, colors, fonts, CSS. Use for appearance styling, visual customization, branding.
Also in 8 projects that use this
adrianhajdinSkillclerk-backend-api
Clerk Backend REST API explorer and executor. Browse tags, inspect endpoint schemas, and execute authenticated requests. Use when listing users, managing organizations, or calling any Clerk API endpoint.
Also in 6 projects that use this
sanketbodkeSkillclerk-billing
Clerk Billing for subscription management - render Clerk's PricingTable
Also in 3 projects that use this
nnawar706Skillclerk-cli
Operate the Clerk CLI (`clerk` binary) for authentication, user/org/session management, deploy verification, instance config, env keys, and any Clerk Backend or Platform API call. Use when the user mentions Clerk management tasks, "list clerk users", "create a clerk user", "update organization", "pull clerk config", "clerk env pull", "clerk doctor", "clerk deploy", "clerk deploy status", "clerk api", or any ad-hoc Clerk API request. Prefer the CLI over raw HTTP: it handles auth, key resolution, app/instance targeting, and formatting automatically.
Also in 4 projects that use this
- +4 more from elpiarthera
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- adrianhajdin/ghost-ai★ 332same name
- clerk/skills★ 93same name
- HamedMP/matrix-os★ 86same name
- delorenj/skills★ 17same name
- wrsmith108/clerk-claude-skill★ 4same name
- Aymenjdily/biblion-testing-agentic-ai-skills★ 2same name
- crisak/ai-cv-generator★ 1same name
- elpiarthera/vantage-starter★ 0same name
- nnawar706/fluento★ 0same name
- sanketbodke/skew-ai★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 156
Verify Webhook Signatures with Svix: Always verify incoming Clerk user lifecycle webhooks using svix before updating local databases.
- Very specific: line 157
Use Server-Side auth() in App Router: Extract userId and orgId via auth() in Server Components to eliminate client-side waterfall fetches.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clerk
Clerk is a comprehensive user management and authentication service built specifically for the modern web (React, Next.js, Remix). It focuses on providing "Drop-in" UI components (<SignIn />, <UserProfile />) rather than just APIs.
When to Use
- Modern React & Next.js Authentication: Adding drop-in, beautifully designed authentication components to modern frontend stacks.
- B2B SaaS Multi-Tenancy & Organizations: Managing team invites, role assignments, seat limits, and organization switching.
- Passwordless & Passkey Auth: Enabling WebAuthn passkeys, biometric logins, and magic links out of the box.
- Edge-Ready Middleware Verification: Validating JWT session tokens at the network edge (Cloudflare Workers, Next.js Middleware).
Quick Start
// middleware.ts
import { authMiddleware } from "@clerk/nextjs";
export default authMiddleware({});
// layout.tsx
import { ClerkProvider } from '@clerk/nextjs'
export default function RootLayout({ children }) {
return (
<ClerkProvider>
<html><body>{children}</body></html>
</ClerkProvider>
)
}
// page.tsx (Protected)
import { UserButton, currentUser } from "@clerk/nextjs";
export default async function Page() {
const user = await currentUser();
if (!user) return <div>Not signed in</div>;
return <header>Welcome {user.firstName} <UserButton /></header>;
}Core Concepts
Drop-in Component Architecture (<SignIn />, <UserButton />)
Provides prebuilt, accessible, themed UI components that handle complete auth lifecycles:
// app/layout.tsx
import {
ClerkProvider,
SignInButton,
SignedIn,
SignedOut,
UserButton,
} from "@clerk/nextjs";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<ClerkProvider>
<html lang="en">
<body>
<header className="flex justify-between p-4 border-b">
<h1>Enterprise SaaS</h1>
<SignedOut>
<SignInButton mode="modal" />
</SignedOut>
<SignedIn>
<UserButton afterSignOutUrl="/" />
</SignedIn>
</header>
{children}
</body>
</html>
</ClerkProvider>
);
}Edge Middleware Session Protection
Protects routes and extracts authenticated user claims at the edge before rendering:
// middleware.ts
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
const isProtectedRoute = createRouteMatcher([
"/dashboard(.*)",
"/api/protected(.*)",
]);
export default clerkMiddleware((auth, req) => {
if (isProtectedRoute(req)) {
auth().protect();
}
});
export const config = {
matcher: ["/((?!.*\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};Multi-Tenant Organizations & Role Checks
Manages multi-organization contexts with granular RBAC permissions:
import { auth } from "@clerk/nextjs/server";
export async function POST() {
const { orgId, orgRole } = auth();
if (!orgId) throw new Error("Unauthorized: Select an organization");
if (orgRole !== "org:admin")
throw new Error("Forbidden: Admin privileges required");
// Execute admin organization mutations
}Common Patterns
Next.js App Router Route Protection with Clerk Middleware
Problem: Public API endpoints inadvertently exposed without explicit session verification.
Solution:
Enforce route matcher guards in Next.js middleware.ts:
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
const isProtectedRoute = createRouteMatcher([
"/dashboard(.*)",
"/api/protected(.*)",
]);
export default clerkMiddleware(async (auth, req) => {
if (isProtectedRoute(req)) await auth.protect();
});
export const config = {
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};Best Practices
Do:
- Verify Webhook Signatures with Svix: Always verify incoming Clerk user lifecycle webhooks using
svixbefore updating local databases. - Use Server-Side
auth()in App Router: ExtractuserIdandorgIdviaauth()in Server Components to eliminate client-side waterfall fetches. - Theme Components with Tailored CSS: Match application design systems using Clerk's
appearanceprop and Tailwind utility variables. - Enable Passkeys by Default: Encourage users to register biometric passkeys to eliminate credential phishing risks.
Don't:
- Expose
CLERK_SECRET_KEYin frontend code: Keep secret keys strictly in server environment variables. - Store database IDs in client state: Treat Clerk's JWT session claims as the single source of truth for the active request.
- Bypass route protection: Always enforce server-side protection in route handlers and middleware; do not rely on UI hiding alone.
Troubleshooting
| Error | Cause | Solution |
401 Unauthorized | Middleware not configured. | Ensure middleware.ts matches all routes (/((?!...))). |
Hydration Error | HTML mismatch. | Wrap app in <ClerkProvider>. |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

