AgentSkillsCN

tdd

采用“测试驱动开发”工作流。在通过测试实现功能、践行TDD,或当用户提到“先写测试”时使用。

SKILL.md
--- frontmatter
name: tdd
description: Test-Driven Development workflow. Use when implementing features with tests, doing TDD, or when user mentions "write tests first".

TDD Workflow

Phase 1: Write Tests

  1. Write tests based on expected input/output pairs
  2. Do NOT create mock implementations for functionality that doesn't exist yet
  3. Run tests and confirm they FAIL
  4. Do NOT write implementation code yet
  5. Commit tests: git commit -m "test: add tests for [feature]"

Phase 2: Implement

  1. Write code to pass the tests
  2. Do NOT modify the tests
  3. Keep iterating until all tests pass
  4. Verify with independent subagents that implementation isn't overfitting to tests

Phase 3: Commit

  1. Run full test suite
  2. Commit: git commit -m "feat: implement [feature]"