Add CLAUDE.md (#479)

* add CLAUDE.md

* update testing guidelines
This commit is contained in:
CactusBlue 2025-02-26 14:03:52 -08:00 committed by GitHub
parent 01014ed901
commit da22db45bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

28
CLAUDE.md Normal file
View File

@ -0,0 +1,28 @@
# Development Guidelines for Stack Auth
## Build/Test/Lint Commands
- Build: `pnpm build` (all), `pnpm build:packages` (packages only), `pnpm build:backend` (backend)
- Lint: `pnpm lint` (zero warnings allowed)
- Typecheck: `pnpm typecheck`
- Test: `pnpm test` (all), `pnpm test:unit` (unit tests), `pnpm test:e2e` (e2e tests)
- Run single test: `pnpm test path/to/test.test.ts` or `pnpm test -t "test name pattern"`
- Start dependencies: `pnpm start-deps` (DB, services), `pnpm stop-deps` (shutdown)
- Dev mode: `pnpm dev` (all services) or `pnpm dev:basic` (backend+dashboard)
## Coding Guidelines
- TypeScript with strict types, prefer `type` over `interface`
- 2-space indentation, spaces in braces, semicolons required
- Return promises with `return await`, no floating promises
- Proper error handling for async code with try/catch
- Use helper functions: `yupXyz()` for validation, `getPublicEnvVar()` for env
- Switch cases must use blocks
- React Server Components preferred where applicable
- No direct 'use' imports from React (use React.use instead)
- Follow existing file structure and naming patterns
## Testing Guidelines
- Import test utilities from `/apps/e2e/test/helpers.ts`
- Prefer inline snapshot testing with `expect(response).toMatchInlineSnapshot(...)`
## Monorepo Structure
Managed with Turbo and pnpm workspaces. Core packages in `packages/`, apps in `apps/`.