clerk-orgs

Implements Clerk Organizations for multi-tenant B2B SaaS with roles, invitations, and enterprise SSO.

Updated Jul 9, 2026
One-click install
npx skills add https://github.com/DimonikRV/ghost-pilot-project --skill clerk-orgs-dimonikrv
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clerk-orgs
Source: https://github.com/DimonikRV/ghost-pilot-project/tree/main/.agents/skills/clerk-orgs
Command: npx skills add https://github.com/DimonikRV/ghost-pilot-project --skill clerk-orgs-dimonikrv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @clerk/nextjs, and includes references (resource) components.

What problem does it solve? Building multi-tenant B2B SaaS requires organization switching, role-based access control, member invitations, and enterprise SSO — all of which are error-prone to wire up correctly with Clerk's Organizations APIs, permission slugs, and session tasks. ## Core Features & Use Cases - Org-aware routing and access control: Read orgId/orgSlug from auth(), enforce slug invariants on dynamic routes, and gate pages with has({ role }) or has({ permission }) using canonical System Permission slugs. - Member and invitation management: Send, list, and revoke invitations via the Backend API with required inviterUserId, or use built-in OrganizationProfile and OrganizationSwitcher components. - Enterprise SSO and verified domains: Configure per-org SAML/OIDC connections, JIT provisioning, and correct enterpriseConnection field access. - Use Case: Add an OrganizationSwitcher to a Next.js dashboard, scope all data queries by orgId from the session, and restrict an admin settings page to users with the org:admin role. ## Quick Start Ask the AI to add Clerk organization support to your Next.js app with an org switcher, org-scoped dashboard data, and admin-only settings pages.

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 switching to a Next.js app with Clerk?▼

Render the OrganizationSwitcher component from @clerk/nextjs and read orgId from auth() to scope dashboard data. Enable Organizations in the Clerk Dashboard first, and handle users with no active org by prompting selection or creation.

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_memberships:manage — invented slugs such as org:manage_members always return false.

Why does has({ permission }) return false even though the user has the role?▼

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, otherwise has() returns false regardless of role.

Why doesn't OrganizationSwitcher 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 if your app needs B2C and B2B coexistence.

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

Add a SAML or OIDC connection in Dashboard → Configure → 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, not directly on the account.

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 and must not be omitted.