- Introduced coding standards for TypeScript and React in SKILL.md. - Added continuous learning skill with configuration and evaluation scripts. - Created detail layout guidelines for read-only pages. - Established form layout rules for data-entry forms. - Documented project guidelines for the frontend monorepo. - Implemented security review checklist for frontend/Electron applications. - Developed a verification loop skill for comprehensive session checks. This commit enhances the skill set available for developers, ensuring adherence to best practices and improving code quality.
57 lines
1.2 KiB
Markdown
57 lines
1.2 KiB
Markdown
---
|
|
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
|
|
```
|
|
|
|
```typescript
|
|
// 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)
|
|
})
|
|
```
|
|
|
|
```bash
|
|
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/`
|