clerk-orgs

Implement Clerk Organizations for multi-tenant B2B apps with roles, invitations, and enterprise SSO.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/Rajaryan1726/ai-code-review-system --skill clerk-orgs-rajaryan1726
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clerk-orgs
Source: https://github.com/Rajaryan1726/ai-code-review-system/tree/main/client/.agents/skills/clerk-orgs
Command: npx skills add https://github.com/Rajaryan1726/ai-code-review-system --skill clerk-orgs-rajaryan1726

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Adding multi-tenant team workspaces to a Clerk-authenticated app involves many failure-prone details: enabling Organizations with the right membership mode, enforcing role- and permission-based access with canonical permission slugs, scoping routes and database writes to the active org, and configuring enterprise SSO. This Skill provides the correct patterns, API calls, and error diagnostics so these features work the first time. ## Core Features & Use Cases - Org setup and switching: Enable Organizations via Dashboard or CLI, create orgs programmatically, and add <OrganizationSwitcher /> with the correct membership mode for B2B-only or B2C + B2B coexistence. - RBAC and route protection: Gate pages, middleware, and server actions with has({ role }) / has({ permission }) using the canonical org:sys_* System Permissions catalog, plus custom roles and permissions. - Member management: Send, list, and revoke invitations via the Backend API with required inviterUserId, or use the built-in <OrganizationProfile /> UI. - Enterprise SSO and verified domains: Configure per-org SAML/OIDC connections, JIT provisioning, and correct enterpriseConnection.provider field access. - Use Case: A SaaS team needs org-scoped dashboards where admins invite members and manage billing. The Skill supplies the slug-verification invariant, orgId-scoped server actions, and invitation code to implement it correctly. ## Quick Start Ask the AI to add Clerk Organizations with an org switcher and admin-only settings page to your Next.js app.

Frequently Asked Questions about clerk-orgs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add organization support to my Clerk Next.js app?▼

Enable Organizations in the Clerk Dashboard or with `clerk enable orgs`, then render `<OrganizationSwitcher />` and read `orgId` from `await auth()` to scope data. Choose Membership required for B2B-only apps or Membership optional for B2C and B2B coexistence.

How do I check org roles and permissions with Clerk?▼

Destructure `has` from `await auth()` and call `has({ role: 'org:admin' })` or `has({ permission: 'org:sys_memberships:manage' })`. Use only canonical System Permission slugs like `org:sys_*` or custom permissions you created; invented slugs always return false.

Why does OrganizationSwitcher not show the Personal Account option?▼

Membership required is the default mode since August 22, 2025, and it disables personal accounts. Switch to Membership optional in Dashboard → Organizations settings to restore personal accounts for B2C users.

Why does has({ permission }) return false even for org admins?▼

When Clerk Billing is enabled, permissions are gated at the Feature level. The Feature associated with that permission must be attached to the organization's active Plan in Dashboard → Billing → Plans, regardless of the user's role.

How do I configure enterprise SSO for a specific Clerk organization?▼

Add a SAML or OIDC connection in Dashboard → Enterprise Connections scoped to the org, supplying the IdP metadata. Users auto-join via JIT provisioning, and provider metadata is read from `user.enterpriseAccounts[i].enterpriseConnection?.provider`.

How do I send organization invitations with the Clerk Backend API?▼

Call `clerk.organizations.createOrganizationInvitation` with organizationId, inviterUserId, emailAddress, role, and redirectUrl after verifying the caller has `org:sys_memberships:manage`. The inviterUserId parameter is required for human-initiated invitations.