diff --git a/CLAUDE.md b/CLAUDE.md index cdf9c920c..2e15e3b17 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,6 +6,9 @@ - `npm run typecheck`: Type checking - `npm run lint`: Linting - `npm run format`: Prettier formatting +- `npm run test:component`: Run component tests with browser environment +- `npm run test:unit`: Run all unit tests +- `npm run test:unit -- tests-ui/tests/example.test.ts`: Run single test file ## Development Workflow @@ -48,3 +51,11 @@ When referencing Comfy-Org repos: 1. Check for local copy 2. Use GitHub API for branches/PRs/metadata 3. Curl GitHub website if needed + +## Common Pitfalls + +- NEVER use `any` type - use proper TypeScript types +- NEVER use `as any` type assertions - fix the underlying type issue +- NEVER use `--no-verify` flag when committing +- NEVER delete or disable tests to make them pass +- NEVER circumvent quality checks diff --git a/src/CLAUDE.md b/src/CLAUDE.md index 5aa141a1a..a4b273c7b 100644 --- a/src/CLAUDE.md +++ b/src/CLAUDE.md @@ -6,9 +6,22 @@ - Use `api.apiURL()` for backend endpoints - Use `api.fileURL()` for static files -- Examples: - - Backend: `api.apiURL('/prompt')` - - Static: `api.fileURL('/templates/default.json')` + +#### ✅ Correct Usage +```typescript +// Backend API call +const response = await api.get(api.apiURL('/prompt')) + +// Static file +const template = await fetch(api.fileURL('/templates/default.json')) +``` + +#### ❌ Incorrect Usage +```typescript +// WRONG - Direct URL construction +const response = await fetch('/api/prompt') +const template = await fetch('/templates/default.json') +``` ### Error Handling