AgentSkillsCN

test-driven-development

进行 TDD 开发时必须遵循:先制定测试清单,选定一项测试用例,按照“红→绿→重构”的流程执行,随后更新测试清单并不断迭代。请始终打开 references/test-driven-development.md。

SKILL.md
--- frontmatter
name: test-driven-development
description: "MANDATORY when doing TDD: make a Test List, pick one, Red→Green→Refactor, update the list, repeat. Always open references/test-driven-development.md."
metadata:
  short-description: Test-driven development workflow

Purpose

Use this skill to keep TDD as a repeatable procedure: you do not “jump ahead” into a large implementation.

The workflow is: Test List → pick one → Red → Green → Refactor → update the list → repeat.

When to use

Use this skill when:

  • You are adding new behavior and can drive it from tests.
  • You are about to refactor and want tests to protect the behavior.
  • You want to keep changes small and verifiable.

How to use

  1. Open references/test-driven-development.md. Start from the template.

  2. Write a Test List first (3–10 items). Pick the smallest item.

  3. Red: write the failing test with a clear name and intent.

  4. Green: implement the simplest code to pass.

  5. Refactor: improve readability / modularity while keeping tests green.

  6. Repeat: update the Test List (split or reorder), then go back to step 2.

Output expectation

  • Always show the current Test List and which item you are implementing now.
  • Keep each iteration small; avoid combining multiple behaviors in one step.