clerk-auth
Skill0 starsChanged 26 days agoMITView on GitHub
Adds Clerk authentication to a web app via the Clerk CLI, composing with Clerk's official AI stack (skills repo, CLI agent mode, MCP server). Windows-capable wrapper carrying local conventions: app-ID resolution via ~/.agents/env/clerk.env, split credential storage (pk_ frontend, sk_ secrets), Windows CLI + PowerShell workarounds, Next.js matcher check, split-stack field notes (Vite SPA + Python/other backend), CLI gatekeeping. Use when the user asks to add Clerk auth, sign-in/sign-up, or user management, says "add Clerk to my app", or hits Clerk CLI install/login issues on Windows.
- Pipes a download into a shell
- Reads credentials
- Installs packages
4 other projects use a version of this.
Adopted by
Most recently taken up by
- davidanthonyn/claude-skillstheir own version, first seen Oct 20, 2026
- xfstudio/skillstheir own version, first seen Oct 13, 2026
- MaheshAwasare/claude-skills-protheir own version, first seen May 4, 2026
- ai4brands-design/claude-skillstheir own version, first seen Mar 22, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- xfstudio/skills★ 9same name
- ai4brands-design/claude-skills★ 2same name
- MaheshAwasare/claude-skills-pro★ 1same name
- davidanthonyn/claude-skills★ 0same name
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 repository15 other files it gives its agents.
- ai-native-mihomoSkill
- ai-native-proof-ledgerSkill
- cloudflare-cost-guardSkill
- design-md-visual-systemSkill
- doubao-ttsSkill
- fleet-orchSkill
- geo-job-huntSkill
- github-telegram-feedback-pipelineSkill
- interactive-projects-streamSkill
- landing-page-replication-v5Skill
- seo-masterSkill
- talkcutSkill
- typesafe-aiSkill
- video-script-conversionSkill
- webgl-threejs-background-animationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 2 are distinctive, and 11 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Before running any commands, present the user with this checklist:
- Very specific: line 85
Use CLERK_PLATFORM_API_KEY for headless automation, or hand the login step back to the user and wait.
- Very specific: line 93
ask the user to pick. Full resolution order and persistence rules: references/local-conventions.md.
- Very specific: line 105
Empty directory: ask which framework and package manager the user wants.
- Very specific: line 122
After clerk init, if the project uses Next.js, check proxy.ts (or middleware.ts on Next.js 15 and earlier).
- Very specific: line 131
Add '/__clerk/:path*' if it is missing.
- Very specific: line 135
If clerk init reports the framework as unsupported, undetectable, or only partially supported, follow the official quickstart (it fully …
- Distinctive: line 148
Make sure the app has clear sign-in, sign-up, and signed-in user controls so the user can create and recognize their first account.
- Very specific: line 171
After clerk init completes, run clerk doctor.
- Very specific: line 178
If components.json exists in the project root and Clerk components are used: npm install @clerk/ui, apply the theme in your provider …
- Very specific: line 188
Use @clerk/nextjs in Next.js.
- Very specific: line 193
Do not trawl env/secrets files hunting for Clerk values on your own initiative.
- Very specific: line 199
Run the app and have the user create their first account through the UI.
“Common” is measured: kept by at least 6 in 10 of the 3 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
Add Clerk Authentication
Set up Clerk authentication with the Clerk CLI. Interactive by default: present the checklist, pause while the user completes the browser-side login flow, and continue from CLI output. Before driving the CLI from a script or sandbox, read references/agent-mode.md.
Reference files — load on demand when their trigger hits, not upfront:
windows-cli.md (Windows install/npm failure, PowerShell quoting) ·
agent-mode.md (headless/scripted CLI) · local-conventions.md (app-ID and
key resolution/persistence) · split-stack.md (Vite SPA + non-Node
backend) · operations.md (sign-up gatekeeping, invitations, org trap).
Ecosystem: compose, don't duplicate
Clerk ships a first-class AI-native stack (skills, CLI agent mode, MCP server, prompts). This pack is a Windows-capable, convention-carrying wrapper over that stack — not a replacement.
- Framework setup depth, framework patterns, orgs, billing, webhooks,
testing, mobile -> official skills:
npx skills add clerk/skills(https://github.com/clerk/skills);clerk initalso offers to install them - Up-to-date SDK snippets inside AI clients ->
clerk mcp install(alsoclerk mcp list,clerk mcp uninstall) - Non-interactive CLI automation -> references/agent-mode.md; official reference: https://github.com/clerk/skills/blob/main/skills/core/clerk-cli/references/agent-mode.md
- Cross-project app-ID resolution, credential storage, Windows CLI reality, non-Next.js key routing -> this pack
Ecosystem overview: https://clerk.com/docs/guides/ai/overview
Preliminary setup checklist
Before running any commands, present the user with this checklist:
Here's what I'll do to get you set up with Clerk.
1. Install or update the Clerk CLI
2. Set up Clerk in this project, or scaffold a new app if it's empty
3. Verify the Next.js proxy matcher when applicable
4. Start your app with Clerk installed.
Shall I proceed?Step 1: Install or update the Clerk CLI
Probe first: command -v clerk && clerk --version.
- Already installed -> update with
clerk update --yes. - Missing -> try the standard install:
npm install -g clerk(equivalents: pnpm / yarn / bun /brew install clerk/stable/clerk, orcurl -fsSL https://clerk.com/install | bash). Without installing:npx clerk@latest <command>/bunx clerk. - On Windows, if the install or
npx clerkfails with "Unsupported or missing platform: win32-x64" or an npm 404 for a platform package, read references/windows-cli.md before pinning anything — it carries the verified workarounds and a recheck procedure.
Step 2: Sign in to Clerk
Immediately after installing or updating the CLI, from the project root run
clerk auth login. This is the first command after install or update — do
not list apps, ask which Clerk app to use, or run clerk init before
authenticating. It opens a browser and binds a localhost callback; pause
while the user completes the flow, then continue from CLI output. If already
signed in, continue to initialization. Verify with clerk whoami.
Sandbox/headless: clerk auth login has no headless branch — it stalls.
Use CLERK_PLATFORM_API_KEY for headless automation, or hand the login step
back to the user and wait. Full agent-mode rules: references/agent-mode.md.
Step 3: Initialize Clerk
Resolve the app ID first — never invent one or reuse another project's.
Short version: check ~/.agents/env/clerk.env (project-name = app_id
lines), then a pasted personalized SKILL.md, then clerk apps list --json
- ask the user to pick. Full resolution order and persistence rules: references/local-conventions.md.
Inspect the current directory to determine whether this is an existing project or an empty directory.
Existing project: clerk init --app <app-id>. It detects the framework
and package manager, installs the correct SDK, and applies framework-specific
setup (providers, middleware, auth routes, env config). Do not pass
--framework or --pm for existing projects unless the user explicitly
wants to override detection or the CLI asks for those values.
Empty directory: ask which framework and package manager the user wants;
no preference -> Next.js and npm. Scaffold explicitly:
clerk init --framework <framework> --pm <package-manager> --app <app-id>.
Non-interactive: clerk init -y skips confirmation prompts.
Package-manager signals on a non-empty directory: pnpm-lock.yaml -> pnpm;
yarn.lock -> yarn; bun.lock/bun.lockb -> bun; package-lock.json ->
npm; none detected -> npm.
Keyless bootstrap: an unauthenticated agent on keyless-capable
frameworks defaults to keyless — clerk init mints an unclaimed app with
temporary development keys; a later clerk auth login claims it
automatically. --keyless forces keyless over a stale link; --login
forces the authenticated flow.
Step 4: Verify the Next.js matcher
After clerk init, if the project uses Next.js, check proxy.ts (or
middleware.ts on Next.js 15 and earlier). config.matcher must include
Clerk's auto-proxy path once, after the API/TRPC matcher:
'/(api|trpc)(.*)',
'/__clerk/:path*',Add '/__clerk/:path*' if it is missing.
Step 5: Fall back to docs when init is incomplete
If clerk init reports the framework as unsupported, undetectable, or only
partially supported, follow the official quickstart (it fully scaffolds
Next.js App/Pages Router, React, React Router, Nuxt, TanStack Start, Astro,
Vue, JS/Vite; Expo, Express, Fastify get the SDK plus docs steps).
Quickstart URL pattern:
https://clerk.com/docs/<slug>/getting-started/quickstart with slug:
nextjs, react-router (Remix), astro, nuxt, tanstack-react-start,
react, vue, js-frontend (Vite/vanilla JS), expressjs, fastify,
expo (iOS/Android/Chrome Extension have their own doc sections).
Everything else: https://clerk.com/docs/llms.txt
Step 6: Ensure clear auth controls are visible
Make sure the app has clear sign-in, sign-up, and signed-in user controls so the user can create and recognize their first account. Integrate them into the existing layout; if clear auth controls already exist, reuse or adapt them instead of duplicating them.
For Next.js App Router, use Clerk components from @clerk/nextjs:
import { SignInButton, SignUpButton, Show, UserButton } from '@clerk/nextjs'
<Show when="signed-out"><SignInButton /><SignUpButton /></Show>
<Show when="signed-in"><UserButton /></Show>Other frameworks use the same component names from their own Clerk package
(@clerk/vue, @clerk/nuxt, ...). Vite SPA: React SDK wrapped in
ClerkProvider, publishable key from VITE_CLERK_PUBLISHABLE_KEY (public
by design); a separate backend receives only the sk_ key in its own env.
For the full SPA + non-Node backend wiring pattern, read
references/split-stack.md.
Step 7: Verify the setup
After clerk init completes, run clerk doctor. In agent mode,
doctor --fix is ignored — read each check's remedy field
(clerk doctor --json) and apply fixes yourself. Then start the app, confirm
the auth controls are visible, and test the sign-in and sign-up flow.
Step 8: If using shadcn/ui
If components.json exists in the project root and Clerk components are
used: npm install @clerk/ui, apply the theme in your provider
(import { shadcn } from '@clerk/ui/themes', then
<ClerkProvider appearance={{ theme: shadcn }}>, and add
@import '@clerk/ui/themes/shadcn.css'; to global CSS.
Safety rules
- Next.js 15+:
auth()is async. Alwaysawait auth(). ClerkProvidergoes inside<body>, not wrapping<html>.- Use
@clerk/nextjsin Next.js;@clerk/clerk-reactis for React SPAs. - Secret keys (
sk_) never enter client code, frontend env, or git. - Gate integrations on key presence so key absence = exact legacy behavior.
- Server-side
sk_calls hitapi.clerk.com, never the Frontend API host (details in references/split-stack.md — this cost us a real bug once). - Do not trawl env/secrets files hunting for Clerk values on your own initiative; read only files the user pointed you at, and ask for anything missing (references/local-conventions.md).
After setup
Run the app and have the user create their first account through the UI. If
sign-up needs restricting, invitations are wanted, or the dashboard enabled
orgs by accident, read references/operations.md. For deeper framework
patterns (orgs, billing, webhooks, testing, mobile), install the official
skills: npx skills add clerk/skills.
Docs: https://clerk.com/docs/cli https://clerk.com/docs/llms.txt Dashboard: https://dashboard.clerk.com/
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.

