clerk-production

Configure Clerk authentication with organizations, roles, and billing for production Next.js applications.

579|76|Updated Oct 29, 2026
Ready to run
npx skills add https://github.com/phuryn/product-engineering --skill clerk-production-phuryn
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: clerk-production
Source: https://github.com/phuryn/product-engineering/tree/main/app-stack/skills/clerk-production
Command: npx skills add https://github.com/phuryn/product-engineering --skill clerk-production-phuryn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Clerk's API documentation covers how to call its endpoints, but doesn't decide where sessions are verified, what workspaces are, or how billing integrates with authorization. This Skill provides those architectural decisions upfront, preventing silent failures and contradictions between Clerk's defaults and production requirements. ## Core Features & Use Cases - Session Verification Pattern: Establish a single seam where every server path verifies the caller, never decoding or trusting tokens client-side. - Organizations and Roles: Configure the organization shape (every workspace is an org) or individual shape, set role permissions, and prevent features from silently gating permissions. - Billing Integration: Define plans and features in a file, apply them through Clerk's CLI, and gate features independently from roles so a lapsed subscription doesn't break authorization. - Use Case: You're shipping a SaaS product with team workspaces and paid tiers. This Skill walks you through deciding whether each workspace is an organization, how to structure roles, where to verify sessions, and how to prevent a billing bug from silently downgrading paying customers to the free tier. ## Quick Start Read the organizations, roles, and billing sections to decide your workspace model before the first migration, then apply every setup step on development first.

Frequently Asked Questions about clerk-production

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

FAQPage Schema
How do I verify Clerk sessions without decoding tokens in the browser?▼

Create a single session seam on the server that calls `auth()` and `currentUser()` through `@clerk/nextjs/server`. Every protected page and Server Action checks for itself through this seam, never trusting claims from cookies or JWTs in the browser.

What is the difference between the organization and individual workspace models?▼

In the organization shape, every workspace is a Clerk organization with roles and team members; *Membership required* gates the workspace. In the individual shape, organizations stay off and one user owns one workspace. Choose before the first migration and billing setup.

Why shouldn't I attach Clerk features to permissions?▼

When billing is enabled, Clerk gates permissions by feature, so a lapsed subscription silently removes a capability mid-session. Instead, use roles to decide who may act and features to decide capacity limits; keep them separate in code and at Clerk's dashboard.

How do I prevent a production Clerk instance from refusing sign-in?▼

Production keys work only on domains the instance is configured for. Ensure the instance's domain list includes your deploy host, DNS records for clerk, accounts, and clkmail resolve, and social OAuth clients are created in your own provider project, not Clerk's shared ones.

What happens if Test mode is off when I try to run authenticated tests?▼

Clerk tries to mail a real verification code instead of accepting `TEST_VERIFICATION_CODE`. Every sign-in stalls at the verification screen with no hint that a dashboard toggle is the cause. Turn Test mode on before running the authenticated suite.

Can I store Clerk user names and emails in my database?▼

No. Store only Clerk IDs; read names and emails from Clerk at render time. Only the workspaces table holds the org or user ID, and one member table beside it holds the user ID where the product records authorship.