clerk-orgs

Installation
Summary

Multi-tenant B2B SaaS with organization switching, role-based access control, and enterprise SSO.

  • Supports dynamic org-based routing via URL slugs, role-based access checks (org:admin, org:member), and custom role creation through the dashboard
  • Includes OrganizationSwitcher component for user-facing org selection and <Show> conditional rendering for role-gated UI
  • Provides server-side organization context via auth() helper with membership verification and permission checks
  • Enables Enterprise SSO (SAML/OIDC) for organization-wide authentication and verified domain support
  • Requires Organizations enabled in Clerk Dashboard before use; Core 2 SDK has different APIs for session tasks and billing checks
SKILL.md

Organizations (B2B SaaS)

STOP — prerequisite. Organizations must be enabled before any org-related API, hook, or component works. Two paths: (1) Dashboard → Organizations settings, or (2) clerk enable orgs (see "Agent-first: Programmatic org management" below). Pick the Membership mode deliberately: Membership required (default since 2025-08-22) routes signed-in users through the choose-organization task and disables personal accounts, while Membership optional keeps personal accounts available for B2C + B2B coexistence. Pick optional if you need personal subscriptions alongside org subscriptions.

Version: This skill targets current SDKs (@clerk/nextjs v7+, @clerk/react v6+ — Core 3). Core 2 differences are noted inline with > **Core 2 ONLY (skip if current SDK):** callouts — see clerk skill for the full version table.

Quick Start

  1. Enable Organizations — via Dashboard → Organizations settings or clerk enable orgs (see Agent-first section). Pick Membership required (B2B-only) or Membership optional (B2C + B2B).
  2. Create an org — via <OrganizationSwitcher />, <CreateOrganization />, or programmatically with clerkClient().organizations.createOrganization().
  3. Protect routes — read orgId / orgSlug from auth() and gate with has({ role }) or has({ permission }).
  4. Manage members — send invitations via Backend API or the built-in <OrganizationProfile /> tab.
  5. Cap membership — set maxAllowedMemberships at org creation or pick a seat-limited Billing Plan (see clerk-billing skill).

What Do You Need?

Task Reference
System permissions catalog, custom roles, role sets references/roles-permissions.md
Related skills
Installs
5.3K
Repository
clerk/skills
GitHub Stars
40
First Seen
Jan 30, 2026