Clerk Authentication
Guidance for Clerk authentication in Next.js covering middleware, hooks, server actions, and route protection.
- CCM score
- 52 of 100
- skills.sh installs
- 729
- GitHub stars
- 321
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers provider setup, middleware route matching, server and client auth hooks, and API route protection
- Includes environment variable setup,
clerkMiddlewarewithcreateRouteMatcher, and role checks viasessionClaimsmetadata - Enforces per-action authorization in server actions and route handlers, not only in middleware
- Designed for Next.js App Router applications that need defense-in-depth around protected data and organization roles
Install
$ npx -y skills add mindrally/skills --skill clerk-authentication -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Clerk Authentication
You are an expert in Clerk authentication implementation for Next.js applications. Follow these guidelines when integrating Clerk.
Core Principles
- Implement defense-in-depth with multiple authentication layers
- Verify authentication at every data access point, not just middleware
- Protect server actions individually
- Use Clerk's built-in security features (HttpOnly cookies, CSRF protection)
Installation and Setup
npm install @clerk/nextjs
Environment Variables
# Required
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...
# Optional: Custom URLs
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard
Provider Setup
App Router (app/layout.tsx)
import { ClerkProvider } from '@clerk/nextjs';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<ClerkProvider>
<html lang="en">
<body>{children}</body>
</html>
</ClerkProvider>
);
}
With Custom Appearance
Details
- Repository
- github.com/mindrally/skills
- Categories
- Backend & APIs, Frontend & UI Code
- First seen
- Jun 3, 2026
Questions
What does the clerk-authentication skill do?
The clerk-authentication skill gives Claude guidelines for adding Clerk authentication to Next.js applications, covering middleware, hooks, and security practices. It tells the agent to verify authentication at every data access point and to protect server actions individually.
How do I install the clerk-authentication skill?
Run npx -y skills add mindrally/skills --skill clerk-authentication -y in your project to install clerk-authentication. After that, the agent can follow clerk-authentication's guidance when wiring Clerk into a Next.js app.
What does clerk-authentication need before I use it?
clerk-authentication expects a Next.js project with the @clerk/nextjs package installed. It also needs the Clerk publishable key and secret key set as environment variables, as its setup section describes.
Where does clerk-authentication stand in the Backend & APIs category?
clerk-authentication is listed in the Backend & APIs category on Claude Marketplaces, next to entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. Its focus on Clerk sign-in and route protection in Next.js sets it apart from those skills.
More from mindrally/skills
All 240- Nx727
- Swiftui Development724
- Apollo Graphql723
- Azure723
- Monorepo Tamagui723
- Turbopack Bundler723
- React Native Cursor Rules719
- Netlify Development711
- Turborepo709
- Graphql Development708
- Viewcomfy Api Rules707
- Salesforce Development705
- React Native R3f704
- Serverless704
- Rollup Bundler701
- Graalvm700
- Convex698
- Lerna697
- Onchainkit687
- Robocorp Cursor Rules682
- Parcel Bundler679
- Fastapi Python14.2K
- Nextjs React Typescript5.4K
- Web Scraping4.5K
Similar to Clerk Authentication
More Backend & APIsclerk-nextjs-patternsclerk/skills57.4K installsAdvanced Next.js patterns for Clerk auth covering middleware, Server Actions, and user-scoped caching.
nextauth-authenticationmindrally/skills1.2K installsSetup guide for NextAuth.js v5 in Next.js covering providers, JWT and database sessions, and route protection.
clerk-authdavila7/claude-code-templates220 installsClerk authentication patterns for Next.js App Router, middleware route protection, and server-side user access.
auth-patternsdavepoon/buildwithclaude184 installsReference guide for authentication in Next.js covering NextAuth.js (Auth.js) setup, middleware-based route protection, and session handling.
nextjs-authenticationgiuseppe-trisciuoglio/developer-kit4.1K installsComplete Auth.js 5 setup for Next.js App Router, covering OAuth, route protection, and role-based access.