Index of every page on this site: llms.txt
All skills
clerk avatar

/clerk-orgs

@95f241a official
by clerkclerk/skills95 stars
6
Run it yourself

Clerk Organizations for B2B and multi-tenant apps - org switching, roles and permissions, verified domains, and enterprise SSO. Use for team workspaces, RBAC, org-scoped routing, member management. Also load this when a project treats teams, workspaces, tenants, or companies as its customers - shared accounts, inviting teammates, per-seat pricing, per-company data isolation - even when the words "organization" or "B2B" are never used.

Use this Skill: https://skilld.dev/gh/clerk/skills/clerk-orgs

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referenceserrors.md

≈431 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Organization error signatures

Diagnose organization failures

Most "org-related" failures are configuration, not code. Do not edit components before checking these:

Error / symptom Root cause Fix
orgId / orgSlug is undefined for a signed-in user Organizations not enabled for this instance, OR user has no active org (personal account) Enable in Dashboard → Organizations; check Membership mode; surface <OrganizationSwitcher />
has({ permission: ... }) always false An invented slug (org:manage_members), or a System Permission (org:sys_*), which has() can't check Check the role (has({ role: 'org:admin' })) or a custom Permission created in the Dashboard (see roles-permissions.md)
has({ role }) returns false but user looks like an admin Session token stale after role change Re-sign-in, or refresh the session: await clerk.session?.reload()
has({ permission }) false even with the role assigned Feature not attached to active Plan (Billing gates permissions) Dashboard → Billing → Plans → attach Feature
<OrganizationSwitcher /> doesn't show "Personal Account" Membership required mode is on (the default since Aug 22, 2025) Dashboard → Organizations settings → Membership optional
TaskChooseOrganization throws "cannot render when a user doesn't have current session tasks" Rendered outside a choose-organization task context Wrap in a choose-organization session-task route only; don't render unconditionally
enterpriseAccounts[0].provider is undefined Accessing provider at the wrong nesting level Use user.enterpriseAccounts[0].enterpriseConnection?.provider

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts8d5 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    This skill is a comprehensive guide for implementing and managing Clerk Organizations in B2B and multi-tenant applications. It uses official Clerk CLI tools, SDKs, and APIs for organizational management, role-based access control, and enterprise SSO. The skill includes strong security recommendations, such as validating organization slugs in routes and binding organization IDs at the database layer to prevent unauthorized cross-organization access. No security issues were detected.

  • Socket8d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

  • Runlayer8mo

    2 files scanned · No issues

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 95f241a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week
What it can do
Network
metadata
{
  "author": "clerk",
  "version": "3.1.2"
}
All 1 allowed tools
WebFetch
Other metadata
compatibility
Requires NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY. Organizations must be enabled in Clerk Dashboard → Organizations. Membership mode (required vs optional) must match the B2B vs B2C + B2B coexistence story of your app.
  • Next.js
  • clerk
  • b2b
  • saas
  • organizations
  • rbac
  • multi-tenant
  • sso
  • authentication

README badge

README badge for clerk/skills/clerk-orgs

Manages multi-tenant B2B SaaS with Clerk Organizations — handles org creation, member invitations, role-based access control, verified domains, and enterprise SSO. Requires Organizations enabled in Clerk Dashboard and targets Next.js, React, and other Clerk SDK frameworks for team workspaces and org-scoped routing.

Generated from the current SKILL.md.

Does this work with frameworks other than Next.js?
Yes. The skill covers @clerk/nextjs by default, but the same feature-level APIs (has(), orgId, <OrganizationSwitcher />, <Show>) work across @clerk/react, @clerk/astro, @clerk/vue, @clerk/expo, @clerk/react-router, and @clerk/tanstack-react-start. Framework-specific patterns like middleware live in the nextjs-patterns reference.
What's the difference between Membership required and Membership optional?
Membership required (default) disables personal accounts and routes signed-in users through a choose-organization task, suitable for B2B-only apps. Membership optional keeps personal accounts available alongside org memberships, needed for B2C + B2B coexistence or apps with personal subscriptions.
How do I check if a user has a specific permission?
Use the has() function with a permission slug: has({ permission: 'org:sys_memberships:manage' }). System permissions prefix with org:sys_; custom permissions use org:<resource>:<action>. The full catalog is in references/roles-permissions.md.
Can I manage organizations and invitations programmatically?
Yes. The skill includes Backend API commands (clerk api) for org CRUD, membership management, and invitations. You can also use clerkClient().organizations.* in code. Billing/seat limits are handled by the clerk-billing skill.

Generated from the current SKILL.md. These answers refresh after source changes.