prototype
MAmattpocock/skills337k近 7 天新增 4,217 个 star
Setting up or changing Clerk sign-in, organizations, roles or billing on Next.js, or sign-in that does nothing or lands wrong: Clerk in production.
This skill covers Clerk from the first setup on its development instance through production.
Decide the product's access model before following Clerk's API guidance. Clerk's own agent skills know the API. They cannot decide:
Those decisions are here.
Where Clerk's defaults or quickstarts contradict this skill, this skill wins. These mechanics use Next.js App Router, Next 16 (proxy.ts middleware), Clerk Core 3 (@clerk/nextjs v7), Supabase and Netlify. Apply saas-authorization for the access model, which carries to any identity provider.
Use the product's integration notes, permission module and member home. Integration notes hold dated provider configuration: instances, settings, slugs and read-backs. The permission module maps roles to permission strings. The member home is the sign-in destination, /dashboard unless the product names another.
clerk/skills:
clerk (a router);clerk-setup, clerk-nextjs-patterns, clerk-custom-ui, clerk-orgs, clerk-billing, clerk-webhooks, clerk-testing;clerk-backend-api (browse and call the Backend API);clerk-cli.npx skills add clerk/skills with the open skills CLI. Vendor them into the product's skills folder so they load whenever Clerk is touched, and prefer them over training-era memory of the API.skills-lock.json records each skill's source, its path and a content hash. npx skills update refreshes them on purpose.createRouteMatcher path lists;<SignedIn> and <SignedOut>, which Core 3 deleted;<ClerkProvider dynamic>;clerk.signIn() in the browser suite;SessionVerifier. Tests substitute a mock verifier when CLERK_SECRET_KEY is absent; keyless mode is for development only. → references/sessions-and-front-door.md § Sessionsworkspaces table holds a Clerk org or user id, and, where the product records authorship, one member table beside it holds the user id too (saas-authorization).createRouteMatcher, and proxy.ts only attaches the session. Every protected page and every action checks for itself; a check in a layout alone is not a check.<SignIn />, <SignUp />, <UserButton />. They are dressed through appearance, never rebuilt./.
signInFallbackRedirectUrl and signUpFallbackRedirectUrl name the member home, and afterSignOutUrl is /./sign-in with a redirect_url back to itself.<ClerkProvider> takes nonce, never dynamic: the root layout reads it from the request's content-security-policy header, the 'nonce-…' in script-src (references/sessions-and-front-door.md)./ and every public page never call auth(), the seam or <Show>, and a signed-in visitor is never redirected away. The header's one button is labelled from the __client_uat cookie. → references/sessions-and-front-door.md § The front door and the member homereferences/organizations-and-billing.md § Organizationshas() reads them; one plan module maps them to capacities. A caller with no session that the server handles (an API token, a job) reads the subscription for the plan id and takes that plan's slugs from the plan list, never from the subscription's embedded plan.features; an anonymous visitor's action uses the allowance stamped on its resource (saas-authorization). Checkout is <PricingTable for="organization">, and no price is typed into application code. → references/organizations-and-billing.md § Billingreferences/csp-and-variables.md § The CSP header.cl-<elementKey>), never by their text.references/gotchas.md, since these can fail silently or look like a different problem:
dev-browser-missing refusal;dynamic and the server redirect that ignores signInUrl;/;Apply every setup step on the development instance first.
references/organizations-and-billing.md § Webhooks and personal dataorg:moderator). A product whose second role is a plain member keeps org:member.org:admin) alone: Clerk gives it to whoever creates an organization, and an instance cannot be without it.+clerk_test address by hand, the fastest proof that Test mode is really on. → references/authenticated-mile.mdThe agent can make three setup changes through the Backend API. For steps 2–4, it can use development's secret key and get read-backs the dashboard does not give. Clerk's Backend API spec was read 2026-11-02 (spec of 2026-08-20):
PATCH /v1/instance/organization_settings with admin_delete_enabled: false, read back with GET on the same path;PATCH /v1/organization_roles/{id} with its new name and key (the key starts with org:, and a new key carries over to the organization settings where the role is the creator's or the default), read back with GET /v1/organization_roles;PATCH /v1/instance with test_mode: true. No GET returns it, so the +clerk_test user above is its proof.The rest stays the owner's, in the dashboard.
Configure billing only when the product bills, after organizations. Use Free and one paid plan for organizations, written in a billing file (its plans block included) and applied in two commands: npx clerk config patch --file <file> --dry-run, read what it would send, then the same without --dry-run. Manage billing goes to the admin role alone. → references/organizations-and-billing.md § Billing
Enable legal consent once the legal pages are live. Use Configure → Legal → Require express consent to legal documents, with their URLs. The sign-up form then carries the consent checkbox.
Configure OAuth application settings only for a member-authenticated MCP server. See § MCP OAuth.
Configure production's own instance at go-live. It gets:
--instance prod, the dry run read first, when the product bills;2026-10-24);→ references/csp-and-variables.md § The production instance; the release around it is release-gate.
Record dated read-backs for settings and screenshots only where unreadable. None lives in application code, and several silently change what that code may do. Put each in the integration notes:
GET /v1/instance/organization_settings with that instance's secret key: Membership required, automatic first organization, admin deletion off;GET /v1/instance/oauth_application_settings (§ MCP OAuth);GET https://<frontend API host>/v1/environment, which needs no key;npx clerk config pull --instance <dev|prod> prints an instance's configuration as JSON as well (Clerk CLI 4.0.0, read 2026-10-25). A screenshot records intended configuration, not the live value. Read the live value back before relying on it.
Open the OAuth procedure when configuring a member-authenticated MCP server. Read the procedure in references/mcp-oauth.md for scopes, PKCE, the exact audience, per-instance read-back and verifier behavior. Recheck live workspace access on every request.
Each rule's origin, the case that taught it, is in receipts.md beside this file; read it when a rule's edge is unclear.
A new user signs up on a phone against production and lands where they should, in the right organization and role. The served pages carry the production publishable key.
| File | Holds | Read when |
|---|---|---|
references/sessions-and-front-door.md | the session seam; ids only; the sign-in surface and redirects; the front door and the member home: the rule, its shape on this stack, what was rejected, the tests that pin it | adding sign-in; touching the root layout, a public page, the member home or a redirect |
references/organizations-and-billing.md | organizations and the choose-organization task; roles and Manage billing; the organization modal and custom pages; Clerk Billing: the billing file and the CLI, in code (callers with no session included) and in tests; pricing; webhooks, personal data and Clerk's own deletion paths | adding organizations, a role, a plan, a limit, pricing or a deletion webhook |
references/csp-and-variables.md | the nonce CSP and static headers; every Clerk variable and the env schema's Clerk checks; what to record; the production instance | adding a CSP or a third-party origin; adding or checking a Clerk key; going live |
references/authenticated-mile.md | Clerk's half of a real-session browser suite: Test mode, test accounts, the testing token, organizations in globalSetup, signing in through <SignIn />, the signed-out-action trap, locators | writing or debugging an authenticated end-to-end test |
references/mcp-oauth.md | issuer and client registration, scopes, audience, PKCE, per-instance read-back and verification | adding or changing member-authenticated MCP |
references/gotchas.md | every Clerk gotcha, each with its symptom and receipt | before touching Clerk; when sign-in or an authenticated action seems to do nothing |
MAmattpocock/skills337k近 7 天新增 4,217 个 star
AFaffaan-m/ECC315k近 7 天新增 3,503 个 star
FIfirecrawl/firecrawl215k近 7 天新增 4,815 个 star
ANanthropics/skills203k近 7 天新增 2,822 个 star
用 React、Tailwind 和 shadcn/ui 构建多组件页面。
ANanthropics/skills203k近 7 天新增 2,822 个 star