Files
trackgo-fe/.cursor/commands/tdd.md
T
shancheas f2f0be111a chore: update .gitignore and improve coding standards documentation
- 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.
2026-08-25 17:50:17 +07:00

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

  1. Scaffold types — inputs/outputs first
  2. Write failing tests (RED) with Vitest
  3. Implement the minimum (GREEN)
  4. Refactor while green
  5. 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.

Agent: .cursor/agents/tdd-guide.md Skill: .agents/skills/tdd-workflow/