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
Claude Code
$ npx -y skills add hylarucoder/hai-stack --skill hai-tdd --agent claude-code
Codex
$ npx skills add hylarucoder/hai-stack --skill hai-tdd -a codex -y
Cursor
$ npx skills add hylarucoder/hai-stack --skill hai-tdd -a cursor -y
Gemini CLI
$ npx skills add hylarucoder/hai-stack --skill hai-tdd -a gemini-cli -y
GitHub Copilot
$ npx skills add hylarucoder/hai-stack --skill hai-tdd -a github-copilot -y
OpenCode
$ npx skills add hylarucoder/hai-stack --skill hai-tdd -a opencode -y
Windsurf
$ npx skills add hylarucoder/hai-stack --skill hai-tdd -a windsurf -y
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.…
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid…
Converts books and documents (PDF, EPUB, DOCX, HTML, Markdown, plain text, RTF, MOBI/AZW with Calibre) into structured agent…
Set up the owner profile so a personal agent knows who it works for (first-run setup, \"get to know me\"), or distill colleague,…