Agent skill

Clerk Multi Env Setup

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Configure Clerk for multiple environments (dev, staging, production).

MITAuto-check: notesDevOps & Cloud

Install Clerk Multi Env Setup

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill clerk-multi-env-setup -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace clerk-multi-env-setup --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/clerk-multi-env-setup .claude/skills/clerk-multi-env-setup && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
clerk-multi-env-setup
GitHub stars
2.8k
Token cost
~1.7k tokens
SKILL.md length
211 words
Files
2 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Configure Clerk for multiple environments (dev, staging, production).

  • Works in 6 steps: Create Clerk Instances → Environment Configuration Files → Environment-Aware Configuration → …
  • Setting up environment-specific configurations
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 4 more sections
  • Calls vercel; needs NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_WEBHOOK_SECRET

What it does

Clerk Multi Env Setup is an agent skill from jeremylongshore/tons-of-skills-marketplace. Configure Clerk for multiple environments (dev, staging, production). Use when setting up environment-specific configurations, managing multiple Clerk instances, or implementing environment promotion. Trigger with phrases like "clerk environments", "clerk staging", "clerk dev prod", "clerk multi-environment".

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/implementation-guide.md`). Compatibility notes: Designed for Claude Code

It sits in DevOps & Cloud. It works with Vercel. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Setting up environment-specific configurations
  • Managing multiple Clerk instances
  • Implementing environment promotion
  • With phrases like clerk environments

Example prompts

  • “clerk environments”
  • “clerk staging”
  • “clerk dev prod”
  • “/clerk-multi-env-setup”

Requirements

  • A credential in NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
  • A credential in CLERK_SECRET_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(npm:*), Grep

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Create Clerk Instances
  2. Environment Configuration Files
  3. Environment-Aware Configuration
  4. Startup Validation
  5. Webhook Configuration Per Environment
  6. CI/CD Environment Promotion

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(npm:*)
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • vercel

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • clerk.com
    • vercel.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
    • CLERK_WEBHOOK_SECRET
    • CLERK_SECRET_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Clerk Multi Env Setup loads about 1.7k tokens when it runs, and up to ~3.1k if it reads all its reference files. Until then it costs about 83 tokens; SKILL.md has 211 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~83
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:51
    # .env.local (development - git-ignored)
  • NoteMentions a .env fileSKILL.md:56
    # .env.staging (staging)
  • NoteMentions a .env fileSKILL.md:61
    # .env.production (production)

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 211 words, ~1,719 tokens.

Download SKILL.mdSave it as .claude/skills/clerk-multi-env-setup/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
clerk-multi-env-setup
description
Configure Clerk for multiple environments (dev, staging, production). Use when setting up environment-specific configurations, managing multiple Clerk instances, or implementing environment promotion. Trigger with phrases like "clerk environments", "clerk staging", "clerk dev prod", "clerk multi-environment".
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
compatibility
Designed for Claude Code
version
1.15.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, clerk, clerk-multi

Clerk Multi-Environment Setup

Overview

Configure Clerk across development, staging, and production environments with separate instances, environment-aware configuration, and safe promotion workflows.

Prerequisites

  • Clerk account (one instance per environment recommended)
  • CI/CD pipeline (GitHub Actions, Vercel, etc.)
  • Environment variable management in place

Instructions

Step 1: Create Clerk Instances

Create separate Clerk instances in the Dashboard for each environment:

EnvironmentInstanceKey PrefixDomain
Developmentmy-app-devpk_test_ / sk_test_localhost:3000
Stagingmy-app-stagingpk_test_ / sk_test_staging.myapp.com
Productionmy-app-prodpk_live_ / sk_live_myapp.com
Step 2: Environment Configuration Files
bash
# .env.local (development - git-ignored)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_dev...
CLERK_SECRET_KEY=sk_test_dev...
CLERK_WEBHOOK_SECRET=whsec_dev...

# .env.staging (staging)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_staging...
CLERK_SECRET_KEY=sk_test_staging...
CLERK_WEBHOOK_SECRET=whsec_staging...

# .env.production (production)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_prod...
CLERK_SECRET_KEY=sk_live_prod...
CLERK_WEBHOOK_SECRET=whsec_prod...
Step 3: Environment-Aware Configuration
typescript
// lib/clerk-config.ts
type ClerkEnv = 'development' | 'staging' | 'production'

function getClerkEnv(): ClerkEnv {
  const key = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY || ''
  if (key.startsWith('pk_live_')) return 'production'
  if (process.env.VERCEL_ENV === 'preview') return 'staging'
  return 'development'
}

export const clerkConfig = {
  env: getClerkEnv(),
  get isDev() { return this.env === 'development' },
  get isProd() { return this.env === 'production' },

  signInUrl: '/sign-in',
  signUpUrl: '/sign-up',
  afterSignInUrl: '/dashboard',

  get allowedRedirectOrigins() {
    switch (this.env) {
      case 'production': return ['https://myapp.com']
      case 'staging': return ['https://staging.myapp.com']
      default: return ['http://localhost:3000']
    }
  },
}
Step 4: Startup Validation
typescript
// lib/validate-env.ts
export function validateClerkEnv() {
  const required = [
    'NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY',
    'CLERK_SECRET_KEY',
  ]

  const missing = required.filter((key) => !process.env[key])
  if (missing.length > 0) {
    throw new Error(`Missing Clerk env vars: ${missing.join(', ')}`)
  }

  const pk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY!
  const sk = process.env.CLERK_SECRET_KEY!

  // Prevent key mismatch (test keys with live keys)
  const pkIsLive = pk.startsWith('pk_live_')
  const skIsLive = sk.startsWith('sk_live_')
  if (pkIsLive !== skIsLive) {
    throw new Error('Clerk key mismatch: publishable and secret keys must be from same environment')
  }

  // Warn if using live keys in development
  if (pkIsLive && process.env.NODE_ENV === 'development') {
    console.warn('WARNING: Using production Clerk keys in development mode')
  }
}

Call at app startup:

typescript
// app/layout.tsx
import { validateClerkEnv } from '@/lib/validate-env'
validateClerkEnv()
Step 5: Webhook Configuration Per Environment
typescript
// app/api/webhooks/clerk/route.ts
import { headers } from 'next/headers'
import { Webhook } from 'svix'

export async function POST(req: Request) {
  // Each environment uses its own webhook secret
  const secret = process.env.CLERK_WEBHOOK_SECRET
  if (!secret) {
    console.error('CLERK_WEBHOOK_SECRET not configured for this environment')
    return new Response('Server error', { status: 500 })
  }

  // Verification logic (same across environments)
  const headerPayload = await headers()
  const wh = new Webhook(secret)
  const body = await req.text()

  try {
    const evt = wh.verify(body, {
      'svix-id': headerPayload.get('svix-id')!,
      'svix-timestamp': headerPayload.get('svix-timestamp')!,
      'svix-signature': headerPayload.get('svix-signature')!,
    })
    // Handle event...
    return new Response('OK', { status: 200 })
  } catch {
    return new Response('Invalid signature', { status: 400 })
  }
}
Step 6: CI/CD Environment Promotion
yaml
# .github/workflows/deploy.yml
name: Deploy
on:
  push:
    branches: [main, staging]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set environment
        run: |
          if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
            echo "DEPLOY_ENV=production" >> $GITHUB_ENV
          else
            echo "DEPLOY_ENV=staging" >> $GITHUB_ENV
          fi

      - name: Deploy to Vercel
        env:
          NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets[format('CLERK_PK_{0}', env.DEPLOY_ENV)] }}
          CLERK_SECRET_KEY: ${{ secrets[format('CLERK_SK_{0}', env.DEPLOY_ENV)] }}
        run: vercel deploy --prod

Output

  • Separate Clerk instances per environment (dev, staging, production)
  • Environment-aware configuration with key validation
  • Startup checks preventing key mismatches
  • Per-environment webhook secrets
  • CI/CD pipeline deploying correct keys per branch

Error Handling

ErrorCauseSolution
Key mismatch errorpk_test_ with sk_live_Ensure both keys from same Clerk instance
Webhook signature failsWrong secret for environmentVerify CLERK_WEBHOOK_SECRET matches instance
User not foundQuerying wrong environmentCheck you are hitting correct Clerk instance
OAuth redirect failsDomain not configuredAdd environment domain in Clerk Dashboard

Examples

Vercel Preview Environment Setup
bash
# Set env vars for Vercel preview deployments
vercel env add NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY preview
vercel env add CLERK_SECRET_KEY preview

Resources

Next Steps

Proceed to clerk-observability for monitoring and logging.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/.curated/clerk-multi-env-setup of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/implementation-guide.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Clerk Multi Env Setup next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Clerk Multi Env Setup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clerk Multi Env Setup this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.7kAutomated safety check: NotesMIT
Add Node SDKgotempsh/temps833—~2.2kAutomated safety check: PassApache-2.0
Access Protected Vercel Deploymentvercel/vercel-plugin301—~1.9kAutomated safety check: NotesCustom licence
Vercel Deploymentdavila7/claude-code-templates33k5 repos~534Automated safety check: PassMIT
Frontmcp Deploymentagentfront/frontmcp146—~9.2kAutomated safety check: NotesApache-2.0
Env Varsvercel/vercel-plugin301—~3kAutomated safety check: NotesCustom licence

Similar skills

  • Add Node SDK

    gotempsh/temps

    Integrate the Temps Node.js SDKs for server-side platform access, KV storage, and Blob storage.

    833 GitHub stars~2.2k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Official

    Access and test Vercel deployments protected by Vercel Authentication, SSO, or Deployment Protection.

    301 GitHub stars~1.9k tokensUpdated yesterday
    DevOps & CloudAuto-check: notes
  • Vercel Deployment

    davila7/claude-code-templates

    Expert knowledge for deploying to Vercel with Next.js Use when: vercel, deploy, deployment, hosting, production.

    33k GitHub starsUsed in 5 repos~534 tokens
    DevOps & CloudAuto-check passed
  • Frontmcp Deployment

    agentfront/frontmcp

    A skill your agent uses when deploying, building for production, packaging, or shipping a FrontMCP server.

    146 GitHub stars~9.2k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Env Vars

    vercel/vercel-plugin

    Official

    Vercel environment variable expert guidance. An agent skill from vercel/vercel-plugin.

    301 GitHub stars~3k tokensUpdated yesterday
    DevOps & CloudAuto-check: notes
  • Vercel Deploy

    aiskillstore/marketplace

    Deploy applications and websites to Vercel instantly. An agent skill from aiskillstore/marketplace.

    433 GitHub stars~1.3k tokensUpdated yesterday
    DevOps & CloudAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Questions about Clerk Multi Env Setup

What does Clerk Multi Env Setup do?

Configure Clerk for multiple environments (dev, staging, production). Clerk Multi Env Setup is an agent skill from jeremylongshore/tons-of-skills-marketplace. Configure Clerk for multiple environments (dev, staging, production).

When should I use Clerk Multi Env Setup?

Clerk Multi Env Setup fits situations like: setting up environment-specific configurations; managing multiple Clerk instances; implementing environment promotion; with phrases like clerk environments.

How do I install Clerk Multi Env Setup in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clerk-multi-env-setup -a claude-code`. Or copy the skill folder (skills/.curated/clerk-multi-env-setup in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/clerk-multi-env-setup in your project. Claude Code loads it when a task matches its description.

How do I install Clerk Multi Env Setup in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clerk-multi-env-setup -a codex`. Or copy the skill folder (skills/.curated/clerk-multi-env-setup in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/clerk-multi-env-setup in your project. Codex loads it when a task matches its description.

Can I use Clerk Multi Env Setup in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill clerk-multi-env-setup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clerk-multi-env-setup, .gemini/skills/clerk-multi-env-setup, .github/skills/clerk-multi-env-setup and .opencode/skills/clerk-multi-env-setup in your project.

What does Clerk Multi Env Setup need to run?

Going by SKILL.md and its folder, Clerk Multi Env Setup needs the command-line tools its instructions call (vercel) and credentials named NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, CLERK_WEBHOOK_SECRET and CLERK_SECRET_KEY. Our summary lists: A credential in NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY; A credential in CLERK_SECRET_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(npm:*), Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Clerk Multi Env Setup access the network?

SKILL.md names 2 domains. As links in the text: clerk.com and vercel.com. This is read from the text; nothing was executed.

Is Clerk Multi Env Setup safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Clerk Multi Env Setup use?

Clerk Multi Env Setup is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clerk Multi Env Setup use?

About 1.7k tokens (SKILL.md is roughly 6.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.4k tokens, read only when the agent opens those files.

What are the alternatives to Clerk Multi Env Setup?

Skills that share tags, products or a category with Clerk Multi Env Setup: Add Node SDK (gotempsh/temps, 833 stars), Access Protected Vercel Deployment (vercel/vercel-plugin, 301 stars), Vercel Deployment (davila7/claude-code-templates, 33k stars) and Frontmcp Deployment (agentfront/frontmcp, 146 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clerk Multi Env Setup?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.