.agents/skills/clerk-testing/SKILL.md
E2E testing for Clerk apps. Use with Playwright or Cypress for auth flow tests.
npx skillsauth add clerk/stripe-webhooks-example clerk-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Framework | Documentation | |-----------|---------------| | Overview | https://clerk.com/docs/guides/development/testing/overview | | Playwright | https://clerk.com/docs/guides/development/testing/playwright/overview | | Cypress | https://clerk.com/docs/guides/development/testing/cypress/overview |
Test auth = isolated session state. Each test needs fresh auth context.
clerkSetup() initializes test environmentsetupClerkTestingToken() bypasses bot detectionstorageState persists auth between tests for speedpk_test_* and sk_test_* keys onlysetupClerkTestingToken() before navigating to auth pagespk_test_xxx, sk_test_xxxstorageState for faster testspage.waitForSelector('[data-clerk-component]') for Clerk UI| Pattern | Problem | Fix |
|---------|---------|-----|
| Production keys in tests | Security risk | Use pk_test_* keys |
| No setupClerkTestingToken() | Auth fails | Call before navigation |
| UI-based sign-in every test | Slow tests | Use storageState |
Playwright: Use globalSetup for auth state
Cypress: Add addClerkCommands({ Cypress, cy }) to support file
clerk-setup - Install Clerk before adding testsclerk-nextjs-patterns - Next.js patterns being testeddevelopment
Guides Stripe integration decisions — API selection (Checkout Sessions vs PaymentIntents), Connect platform setup (Accounts v2, controller properties), billing/subscriptions, Treasury financial accounts, integration surfaces (Checkout, Payment Element), migrating from deprecated Stripe APIs, and security best practices (API key management, restricted keys, webhooks, OAuth). Use when building, modifying, or reviewing any Stripe integration — including accepting payments, building marketplaces, integrating Stripe, processing payments, setting up subscriptions, creating connected accounts, or implementing secure key handling.
tools
Clerk authentication router. Use when user asks about adding authentication, setting up Clerk, custom sign-in flows, Swift or native iOS auth, native Android auth, Next.js patterns, React patterns, Vue patterns, Nuxt patterns, Astro patterns, TanStack Start patterns, Expo patterns, React Router patterns, Chrome Extension patterns, organizations, syncing users, or testing. Automatically routes to the specific skill based on their task.
development
Clerk webhooks for real-time events and data syncing. Always output complete, copy-paste-ready webhook handlers with verifyWebhook(req) verification. Listen for user creation, updates, deletion, and organization events. Build event-driven features like database sync, notifications, integrations.
testing
Add Clerk authentication to any project by following the official quickstart guides.