tdd

GitHub

指导工厂构建者遵循TDD红绿循环进行开发。明确以预定义接口为测试边界,坚持‘一测试一实现’的垂直切片模式,禁止在红色阶段重构或过度设计,确保测试验证行为而非实现细节。

skills/tdd/SKILL.md DanMcInerney/architect-loop

Trigger Scenarios

执行测试驱动开发 编写单元测试 遵循红绿循环规范

Install

npx skills add DanMcInerney/architect-loop --skill tdd -g -y
More Options

Use without installing

npx skills use DanMcInerney/architect-loop@tdd

指定 Agent (Claude Code)

npx skills add DanMcInerney/architect-loop --skill tdd -a claude-code -g -y

安装 repo 全部 skill

npx skills add DanMcInerney/architect-loop --all -g -y

预览 repo 内 skill

npx skills add DanMcInerney/architect-loop --list

SKILL.md

Frontmatter
{
    "name": "tdd",
    "description": "Test-driven development for factory builders. Use when a ship job implements at the issue's pre-agreed seams — the red -> green loop, one test then one minimal implementation per cycle, never a refactor while RED."
}

Test-Driven Development

TDD is the red -> green loop. This skill is the reference that makes that loop produce tests worth keeping. Consult it before and during the loop, not after. Name things with the codebase-design vocabulary (skills/codebase-design/SKILL.md), preloaded beside this skill.

Seams are pre-agreed, not interviewed

A seam is the public boundary you test at — the interface where you observe behavior without reaching inside. In this factory the seams are already agreed before you start: they're named in the issue body and the spec. A builder never interviews a user to find seams; if an issue names none, that's a spec gap to report, not a prompt to go ask someone.

Frozen checks under docs/checks/ are read-only grading — not your tests. They verify the slice from outside, after the fact. Write your own tests at the issue's named seams and run them yourself before you report. A green frozen check with no tests of your own is not done.

What a good test is

Tests verify behavior through the seam, not implementation details. A good test reads like a specification and survives refactors because it doesn't care about internal structure. See tests.md for examples and mocking.md for mocking guidance.

Anti-patterns

  • Implementation-coupled — mocks internal collaborators, tests private methods, or verifies through a side channel. Tell: it breaks on refactor with no behavior change.
  • Tautological — the assertion recomputes the expected value the way the implementation does, so it passes by construction. Expected values come from an independent source: a known-good literal, a worked example, the spec.
  • Horizontal slicing — writing every test first, then all implementation. Work in vertical slices instead: one test -> one minimal implementation -> repeat, each test a tracer bullet answering what the last cycle taught you.

Rules of the loop

  • Red before green. Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
  • One slice at a time. One seam, one test, one minimal implementation per cycle.
  • Never refactor while RED. Refactoring belongs to review, not the red -> green cycle.
  • Mock at system boundaries only — external systems, time, randomness. Never your own modules.

Report only what you proved

Evidence-ground every claim: report only what a tool result from this session actually shows — the command output and exit code from a test you ran, not a claim of passing without the run behind it.

Version History

  • 164d32c Current 2026-07-19 18:15

Same Skill Collection

skills/adversarial-review/SKILL.md
skills/architect-fast/SKILL.md
skills/architect-research/SKILL.md
skills/architect/SKILL.md
skills/codebase-design/SKILL.md
skills/frozen-checks/SKILL.md
skills/integrate/SKILL.md
skills/to-spec/SKILL.md
skills/final-review/SKILL.md
skills/to-issues/SKILL.md

Metadata

Files
0
Version
164d32c
Hash
86c5ca8d
Indexed
2026-07-19 18:15

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-29 16:08
浙ICP备14020137号-1 $お客様$