- Added .cursor/sessions/* to .gitignore to prevent session files from being tracked. - Enhanced coding standards in SKILL.md by adding semicolons to TypeScript examples for consistency. - Improved formatting in continuous learning, detail layout, and other SKILL.md files for better readability. These changes aim to streamline development processes and maintain code quality across the project.
1.2 KiB
1.2 KiB
description
| description |
|---|
| Enforce test-driven development. Scaffold types, write Vitest tests FIRST, then implement the minimum to pass. Ensure 80%+ coverage. |
TDD Command
This command invokes the tdd-guide agent.
What This Command Does
- Scaffold types — inputs/outputs first
- Write failing tests (RED) with Vitest
- Implement the minimum (GREEN)
- Refactor while green
- Check coverage (80%+)
When to Use
- New validators, transformers, stores, components
- Bug fixes (reproducing test first)
- Refactors of existing logic
Cycle
RED → GREEN → REFACTOR → REPEAT
Example
User: /tdd Add validation for the full-page name field
// full-page.validator.test.ts
import { createFullPageSchema } from './full-page.validator';
it('rejects an empty name', () => {
const schema = createFullPageSchema((k) => k);
expect(schema.safeParse({ code: 'ABC', name: '' }).success).toBe(false);
});
pnpm --filter web test
pnpm test
pnpm check:all
Mock @repo/core-api / apiClient, not a database. UI in packages/ui uses Testing Library.
Related
Agent: .cursor/agents/tdd-guide.md
Skill: .agents/skills/tdd-workflow/