Skip to content
Back to skills

Clerk Knowledge Patch

ASecurity

Clerk

  • 25 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added May 27, 2026
developmentjavascriptpythonrustgojavareactvuenextjsexpressapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill clerk-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clerk Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clerk Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-clerk-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-clerk-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clerk-knowledge-patch
description: Clerk
version: "1.0.0"
license: MIT
metadata:
  author: Nevaberry
---



# Clerk knowledge patch

Load this skill when implementing or migrating Clerk authentication, session
handling, organizations, billing, UI customization, or backend SDK integrations.
Use the quick reference below for migration decisions and load the topic file
for complete API details, conditions, and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Architecture and deployment](references/architecture-and-deployment.md) | Keys, instances, cookies, routing, framework setup, workspace administration |
| [Authentication and sessions](references/authentication-and-sessions.md) | Sign-in methods, OAuth applications, restrictions, session tasks, JWT claims |
| [Billing](references/billing.md) | Plans, entitlements, prices, discounts, trials, checkout, billing resources |
| [Components](references/components.md) | Auth controls, redirects, profiles, organization lists, framework components |
| [Core 3 migration](references/core-3-migration.md) | Custom-flow hooks, completion, MFA, passkeys, Expo native UI and build compatibility |
| [Customization](references/customization.md) | Themes, CSS, localization, delivery templates, menus, Clerk Elements |
| [Frontend resources](references/frontend-resources.md) | Legacy flows, callbacks, user mutations, sessions, reverification, API keys |
| [Go Backend SDK](references/go-backend-sdk.md) | Go setup, JWT verification, sessions, users, organizations, machines, billing |
| [Integrations and webhooks](references/integrations-and-webhooks.md) | Framework middleware, webhooks, MCP, proxies, satellites, Chrome extensions |
| [JavaScript Backend SDK](references/javascript-backend-sdk.md) | Request auth, token types, middleware, user imports, metadata, JWT templates |
| [Organizations and enterprise](references/organizations-and-enterprise.md) | Tenancy, roles, permissions, invitations, verified domains, SSO, directory sync |
| [Python Backend SDK](references/python-backend-sdk.md) | Runtime, request auth, API migrations, users, directories, billing, instance controls, logs |

## Breaking changes and deprecations

### Custom-flow resources and legacy UI

Core 3 `useSignIn()` and `useSignUp()` expose `SignInFuture` and `SignUpFuture`.
Include the attempt object in React dependency arrays because its identity can
change. Call `finalize()` when the attempt status is `complete`.
With legacy `SignIn` and `SignUp`, activate a completed attempt with
`await clerk.setActive({ session: attempt.createdSessionId })`.
The `@clerk/elements` beta supports Next.js App Router with Clerk Core 2.

### Backend request authentication

JavaScript `authenticateRequest()` exposes `isAuthenticated` and deprecates
`isSignedIn`; its state provides `status`, `reason`, `headers`, and `toAuth()`.
`clerkClient.sessions.verifySession(sessionId, token)` is deprecated: use
`authenticateRequest()` or verify the session JWT directly.
In Python, check `state.is_signed_in` before using `state.payload`.

### Python request, response, and error contracts

- Check `clerk.miscellaneous.get_public_interstitial()` calls against the
  Python SDK 5.1.0 signature before upgrading.
- Check arguments to `clerk.users.update()` and `clerk.organizations.update()`
  against the breaking 6.0.0 request definitions. Use
  `clerk.organizations.replace_metadata()` to replace organization metadata.
- For 7.0.0, check handled exception types and HTTP statuses, email verification
  models, user response models, and billing credit adjustment responses.
- For 7.2.0, check `clerk.users.list()` arguments, results, and errors; it changes
  request and error contracts and makes a breaking response change.
- Starting with Clerk Python SDK 7.1.0, omit `specter_enabled` from
  `clerk.instance_settings.update_instance_protect()` requests.
- In 7.1.0, `clerk.users.list_trusted_devices()` and `revoke_trusted_device()` are
  deprecated. Use `list_biometric_credentials()` and `revoke_biometric_credential()`
  to list and revoke enrolled biometric credentials.

The Python reference identifies the affected methods and fields, including
billing model changes, API key creation responses, and endpoint-specific errors.

### Go upgrades and enterprise endpoints

Use Go 1.24 or newer with Go SDK v2.5.1. Go SDK v2.7.0 deprecates metadata fields
accepted by user and organization update methods.
Migrate SAML integrations from `/v1/saml_connections` to
`/v1/enterprise_connections`, which manages both SAML and OIDC.
Python's corresponding `clerk.saml_connections` methods are deprecated starting
in 5.0.4; use `clerk.enterprise_connections` for list, create, get, update, and delete.

### UI props, themes, and extension clients

Move `afterSignOutUrl` and `afterMultiSessionSingleSignOutUrl` from `<UserButton />`
to `<ClerkProvider />`; keep `afterSwitchSessionUrl` on `<UserButton />`.
Starting in `@clerk/react` 6.1.3 and `@clerk/vue` 2.0.7, pass `redirectUrl` and
`sessionId` directly to `<SignOutButton />`; `signOutOptions` emits a deprecation warning.
Install `@clerk/ui`, import themes from `@clerk/ui/themes`, and use `appearance.theme`.
Replace the deprecated `@clerk/chrome-extension/background` import with
`@clerk/chrome-extension/client` and pass `background: true` for service workers.

| Previous appearance variable | Replacement |
| --- | --- |
| `colorText` | `colorForeground` |
| `colorTextOnPrimaryBackground` | `colorPrimaryForeground` |
| `colorTextSecondary` | `colorMutedForeground` |
| `colorInputText` | `colorInputForeground` |
| `colorInputBackground` | `colorInput` |
| `spacingUnit` | `spacing` |

## Authentication and session quick reference

### Core 3 password, OTP, and passkeys

Use `signIn.password({ emailAddress, password })` or
`signUp.password({ emailAddress, password })` for password flows.
Sign-in OTP uses `signIn.emailCode` or `signIn.phoneCode` with `sendCode()` and
`verifyCode({ code })`. Sign-up starts with `signUp.create({ emailAddress })` or
`signUp.create({ phoneNumber })` and uses its `verifications` methods.
Finalize once the attempt is complete.
For `needs_second_factor`, use `signIn.mfa` phone-code, TOTP, or backup-code methods.
For `needs_client_trust` with an `email_code` in `supportedSecondFactors`, use
`signIn.mfa.sendEmailCode()` and `verifyEmailCode({ code })`.
Use `signIn.passkey({ flow: 'discoverable' })` for Core 3 passkey sign-in;
enroll from an authenticated session with `user.createPasskey()`.

### Combined sign-in and sign-up

Strict enumeration protection requires an in-app `<SignIn />`, **Open** access
mode, and either **Password** disabled or **OTP** preferred. Enable it under
**Protect → Rules**. Custom flows opt in with `signUpIfMissing`.
After successful identifier proof, handle `sign_up_if_missing_transfer` in
`error.errors` with `signUp.create({ transfer: true })`; collect missing requirements
with `signUp.update()`. This option requires public sign-ups and a strategy with
a separate verification step.

### Pending sessions and navigation

Pending sessions are signed out by default. Route `sessionStatus === 'pending'`
to a task page, or use `await auth({ treatPendingAsSignedOut: false })` in a Next.js
task handler that needs the pending user's ID. Map task keys in `taskUrls` or use
`<RedirectToTasks />`; the tasks include organization selection, password reset,
and MFA setup.
In `setActive()` navigation, pass destinations through `decorateUrl()`: use
full-page navigation for an absolute refresh URL and client routing for a relative path.

### Reverification

The public-beta `reverification` check works with server `Auth.has()` and client
`session.checkAuthorization()`. `strict_mfa` requires both factors within 10 minutes;
`strict`, `moderate`, and `lax` check the second factor within 10 minutes, one hour,
and one day. Requests for `second_factor` or `multi_factor` fall back to `first_factor`
when the user lacks a second factor.
Wrap calls with `useReverification(actionOrFetcher)` and fetch the token inside the wrapped fetcher
so retries receive the refreshed token. Handle cancellation with
`isReverificationCancelledError()`. Use the same preset in the server freshness
check and its response: `reverificationError('strict')` for a Next.js Server Action
or `reverificationErrorResponse('strict')` for a Route Handler with the strict preset.

### Machine tokens and revocation

Discriminate backend `Auth` by `tokenType`: `session_token` is a user session;
`api_key`, `oauth_token`, and `m2m_token` use the machine-auth shape and `scopes`.
Next.js `auth.protect({ token: 'api_key' })` requires an API key; arrays or `'any'`
accept multiple types. Missing or invalid auth on non-document requests returns
404 for session-token protection and 401 for machine-token protection.
`clerkClient.m2m.createToken()` defaults to an opaque token with no expiry.
Use `tokenFormat: 'jwt'` for local verification and `secondsUntilExpiration` for
a bounded lifetime. JWT M2M tokens remain valid until expiry; opaque tokens support
immediate revocation. Creation and Backend API verification use a machine secret.

## Organizations, data, and billing quick reference

### Tenant context and permissions

Store the Organization ID on tenant-owned records and scope queries to the active
Organization. Each tab has its own active organization. For organization-scoped
background fetches, call `getToken()` in the requesting tab and send
`Authorization: Bearer <token>`.
If URL-driven organization activation fails, the previous organization stays active:
compare the route slug with `orgSlug` from `await auth()` before serving tenant data.
Session claims carry custom permissions only. With billing enabled, an organization
permission check also requires the corresponding feature in the active organization's plan.

### Metadata and session claims

Frontend `user.update({ unsafeMetadata })` replaces the object; preserve existing
keys when updating it. `user.reload()` refetches the user and forces token refresh.
Backend JavaScript `users.updateUser()` replaces supplied public or private metadata;
`users.updateUserMetadata()` merges nested objects, and `null` deletes a key at any depth.
Keep custom session claims below about 1.2 KB to leave room in the 4 KB session cookie.
JWT template automatic claims are reserved; customize the session token to include
`sid`, `v`, `pla`, or `fea`.

### Billing checkout and entitlements

Use `has({ plan: 'gold' })`, `has({ feature: 'widgets' })`, or `<Show>` for authorization.
Billing hooks and checkout controls use experimental entry points.
For custom checkout, start from `needs_initialization`, check the returned error,
confirm the payment method, and finalize before navigating to refresh session state
and server-component authorization. `for="organization"` on checkout and subscription
drawer buttons requires an active organization; both otherwise default to personal accounts.
Free trial eligibility requires a first trial and no prior paid subscription.
Customers without a payment method at trial end must add one and subscribe manually.

## Integration and verification quick reference

Keep webhook POST routes public to session middleware and verify signatures with
`verifyWebhook()`. In Express, register the route before JSON parsing and use
`express.raw()` to preserve the signed body. Configure the signing secret per instance.

For Go SDK v2.11.0 JWT verification, default JWKS lookup supports RS256 and ES256 without
configuration changes. A pinned key verifies tokens signed with its own algorithm.
When caching keys for `jwt.Verify`, cache by instance and `kid` and refetch for an
uncached `kid`. A custom `Backend` must implement `clerk.CacheScoper` to use the
HTTP middleware cache. Reverification fails closed on missing `fva` from v2.8.0.

Python remote key mode (`secret_key`) evicts a cached key after signature failure,
refetches JWKS, and retries decoding once. With `jwt_key`, signature failures return
immediately, so update pinned keys when signing keys rotate.
Set `honor_lockout` to `True` in supported verification and sign-in-token requests from
7.1.1 to respect lockouts; the Python reference gives the exact methods and error statuses.

Files in this skill

  • SKILL.md9.8 KB
  • references/authentication-flows.md8 KB
  • references/billing.md6.8 KB
  • references/clerk-elements.md5.1 KB
  • references/components.md6.1 KB
  • references/go-sdk.md4.8 KB
  • references/integrations-utilities.md9.7 KB
  • references/middleware-backend.md5.2 KB
  • references/organizations.md2.3 KB
  • references/python-sdk.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.