.agents/skills/clerk-testing/SKILL.md
E2E testing for Clerk apps. Use with Playwright or Cypress for auth flow tests.
npx skillsauth add Mohamedghaly140/sg-shop-web 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
Enforce web security and avoid security vulnerabilities
development
Build clean, scalable UIs with Tailwind CSS using modern utilities and variants
development
Utilize built-in browser APIs (like Popover API, View Transitions etc) instead of building features manually via JavaScript
development
Build clean, modern React components that apply common best practices and avoid common pitfalls like unnecessary state management or useEffect usage