code-review-and-qualit…
Reviews a code change for correctness, security, maintainability, architecture, performance, and verification gaps, or performs a…
Drives a real behavior change through red-green-refactor and records the failing RED evidence, minimal GREEN implementation, refactor decision, and verification commands. Use when the user explicitly asks for TDD/tests first, adds or fixes testable behavior, or needs regression
$ npx -y skills add hylarucoder/hai-stack --skill hai-tdd --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/hai-tddContext preview
The summary Claude sees to decide when to auto-load this skill.
Drives a real behavior change through red-green-refactor and records the failing RED evidence, minimal GREEN implementation, refactor decision, and verification commands. Use when the user explicitly asks for TDD/tests first, adds or fixes testable behavior, or needs regression
name: hai-tdd description: | Drives a real behavior change through red-green-refactor and records the failing RED evidence, minimal GREEN implementation, refactor decision, and verification commands. Use when the user explicitly asks for TDD/tests first, adds or fixes testable behavior, or needs regression protection(先写测试、红绿重构、补回归测试). Do not force TDD onto documentation, configuration, styling, renames, package moves, or other purely structural changes; report honest non-TDD verification instead.
For Chinese readers, see `SKILL.zh_CN.md`. The English `SKILL.md` is the execution source of truth.
Drive development with tests: write a failing test first, confirm it fails for the right reason, write the smallest implementation that passes, then refactor while keeping tests green. This is not "add tests at the end" — TDD defines behavior before implementation.
Red, then green, then refactor.
Do not write production code before a failing test. A test that never failed first has not proven it constrains the target behavior — so the RED failure is the evidence, not a formality. If implementation already exists without a test, do not call the process TDD; either label it as tests-after or return to a test-first path.
Do not invent a test merely to satisfy the ritual. TDD is for behavior and stable contracts, not for creating ad hoc structural tripwires around a one-off cleanup.
Select honest non-TDD verification without pausing for permission when:
In these cases, say TDD does not fit this slice. Use compile failures, existing tests, static checks, or tests-after verification instead of manufacturing a RED test. Ask the user only when the choice would materially change the requested behavior or scope.
Never add tests whose only purpose is to make a structural refactor look like TDD. Do not add:
Architecture/static boundary tests are allowed only when all of the following are true:
When no legitimate RED exists, prefer this sentence over a fake test: "No TDD for this slice: this is a structural refactor. I will validate it with compiler errors, existing tests, and focused runtime checks."
1. Define the target behavior.
2. RED: write the failing test first.
3. Verify RED.
the behavior already exists, the reproduction is wrong, or this is regression/tests-after work, then label the evidence honestly.
4. GREEN: write the minimal implementation.
5. Verify GREEN.
6. REFACTOR.
7. Continue with the next behavior.
Good TDD tests:
Traps not already caught by the workflow steps above:
让 Coding Agent 把软件迭代做对:从真实问题出发,完成改动,用证据确认结果。 支持:大多数能读取 Skills(SKILL.md)的 Coding Agent,例如 Claude Code、Codex。 hai-stack 由 @海拉鲁编程客 创建。它把一次软件迭代拆成判断、设计、动手、确认、沉淀五步,每一步都有对应的技能。
Reviews a code change for correctness, security, maintainability, architecture, performance, and verification gaps, or performs a…
Audits an entity model field by field: what should exist, what exists now, where each value belongs (column, config, computed…
Challenges an overly conservative, incremental, or compatibility-led proposal with a bold target model, a concrete…
Pressure-tests an ambitious proposal and returns a landing judgment, one minimum viable proof, explicit cuts, success/failure…
Investigates architecture and change complexity from repository runtime paths to bounded modules, React components, and shared…
Produces a ready-to-run ast-grep command or reusable YAML lint/codemod rule, validated against positive and negative fixtures.…