| name | debug |
| description | Investigate bugs using a systematic approach: reproduce, identify the layer, write a failing test, fix root cause. |
Steps
- Reproduce: Identify the exact steps to reproduce the issue
- Read errors: Check terminal, browser console, and test output
- Identify the layer: Is the bug in Domain, Database, API, or Frontend?
- Write a failing test that demonstrates the bug
- Fix the root cause (not just the symptom)
- Verify: Run the test, ensure it passes
- Run full suite:
pnpm test && pnpm lint
Common Debug Commands
curl -s http://localhost:3000/health | jq
pnpm --filter @acme/database db:studio
pnpm --filter @acme/domain test -- --run src/use-cases/__tests__/MyUseCase.test.ts
pnpm test:e2e --headed --project=chromium
pnpm lint
Layer-Specific Tips
| Layer | Common Issues |
|---|
| Domain | Missing validation, wrong error type |
| Database | Schema mismatch, missing seed data, FK constraints |
| API | Missing @Public() decorator, wrong DI token, DTO validation |
| Frontend | Wrong query key, missing invalidation, stale cache |