testdouble/han/tdd
Claude Code and agent skill by testdouble/han
- community
Checking that the SKILL.md file is still in the repository.
Write code through a disciplined, BDD-framed Test-Driven Development loop: build a behavior test list, then drive each behavior through red-green-refactor with an enforced observed-failure gate. Use when the user wants to implement, build, or write code test-first, "do TDD", follow "red-green-refactor", drive code from tests, choose the next test by the Transformation Priority Premise (TPP) or ZOMBIES ordering, or grow a feature behavior-by-behavior with tests leading. This skill writes and changes code; it does not produce a test plan document (use automated-test-planning, or manual-test-planning for a plan a person runs by hand), review or audit existing code (use code-review), restructure existing code outside a TDD loop (use refactor, or plan-a-change to plan a multi-module restructure), specify what a feature should do (use plan-a-feature), or find the root cause of a bug (use investigate). Runs its loop to completion without pausing for review; to review each behavior as it lands, use pairing.
Install
npx vskill@latest install testdouble/han/tddSKILL.md
The same SKILL.md was published earlier as testdouble/han/tdd.
Project Context
- git installed: !
which git 2>/dev/null || echo "not installed" - current branch: !
git branch --show-current 2>/dev/null || echo unknown - CLAUDE.md: !
find . -maxdepth 1 -name "CLAUDE.md" -type f - project-discovery.md: !
find . -maxdepth 3 -name "project-discovery.md" -type f - personal config directory: !
bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude" - project .han/config.md: !
cat .han/config.md 2>/dev/null || echo ""
As your first action, use the Read tool on .han/config.md inside the personal config directory path above. A read that returns no file is no personal configuration: continue silently. When that file or the project .han/config.md probe supplies content, apply it per config-rule.md, which governs precedence between the two files, relative-path resolution, and what to do with a file that reads but cannot be used.
Constraints (read before anything else)
This skill writes production and test code in your working tree. It is an execution skill, not a document generator. These constraints shape every step and override any instinct to move faster.
- The observed-failure gate is load-bearing. No production-code change until a test has been run and observed to
fail for the intended reason in this loop. A test that passes on first run is a stop-and-diagnose signal, not progress. This single rule is what separates real TDD from TDD-flavored code. The verbatim Three Laws and Canon TDD steps it derives from are in references/tdd-loop.md; pull that reference when a step needs the canon or the implementation gears.
- The scope gate is the observed-failure gate's companion. The observed-failure gate proves a red is genuine. It
does not prove the test deserved to exist in this build. No production-code change outside the scope boundary recorded in Step 1, and least of all in shared or cross-application code other consumers depend on. A list item whose green requires an out-of-scope edit is a stop, never an implement; Step 2 carries the resolution ladder that Step 3 works.
- Two hats. Never refactor while any test is red. See references/tdd-loop.md for the
canonical statement.
- One behavior at a time. Exactly one test list item becomes one runnable test per loop. Newly discovered scenarios
are written to the list and deferred, never implemented in the current loop.
- BDD framing. Tests describe observable behavior, named in the project's existing test-naming convention, asserting
outcomes through the public interface — never private state. The behavior-naming and Given/When/Then protocol is in references/bdd-framing.md; pull it when Step 2 needs it.
- You will be tempted to fake this. The specific ways an agent fakes TDD, and the discipline that catches each, are
in references/failure-modes.md; pull it when a loop feels off (a test passes on first run, no red is shown, the implementation has outrun the test, refactor is being skipped).
- YAGNI governs the refactor step and the test list. Apply the rule in
../../references/yagni-rule.md: remove duplication, but do not add abstractions, configuration, or indirection without evidence. Speculative structure added "for flexibility" during refactor is a YAGNI candidate. Speculative scenarios on the test list are deferred with a reopen trigger, never silently added.
Test-Driven Development
Step 1: Resolve Project Config and Confirm Scope
Resolve commands. Read CLAUDE.md's ## Project Discovery section for the test command (under ### Commands and Tests, not ### Frameworks and Tooling), the lint command, the build command, language, and framework. If absent, fall back to project-discovery.md. If still absent, run ${CLAUDE_SKILL_DIR}/scripts/detect-tdd-context.sh and parse its output for git state and manifest-inferred commands. Store the resolved test, lint, and build commands for use in every later step.
Resolve standards and decisions. Resolve the coding-standards directory and ADR directory the same way: read CLAUDE.md's ## Project Discovery section; fall back to project-discovery.md; fall back to Glob defaults (docs/, docs/adr/, docs/coding-standards/, docs/decisions/). Also check CLAUDE.md and AGENTS.md for inline standards. Read the standards and ADRs whose titles, paths, or one-line summaries indicate they govern the area being built. Cap at five documents; if more than five look relevant, list them and read only the five with the strongest apparent relevance — defer the rest until refactor surfaces a need. These govern the green and refactor steps. If none exist, state that plainly and plan to infer conventions from the surrounding code instead.
Resolve the scope boundary. Name, in files and directories, what this work is allowed to change, because the scope gate tests every candidate edit against it. Inside the boundary: the files, directories, or module the request names, plus the tests that cover them. Outside it: everything the named code merely reaches, meaning shared libraries, engines, packages, and any code a second application or consumer also uses, plus code another team owns per CODEOWNERS. When the request names no files, take the application or package the requested behavior lives in as the boundary and treat its dependencies as outside it. Record the boundary; you will test list items and production edits against it.
Report scope, then proceed (no gate). This skill runs autonomously after the initial request: it does not stop for confirmation. State to the user, in a few lines: the behavior or feature to be built, whether this is net-new behavior or a fix to existing broken behavior (a reported bug, a failing case, a fix being driven back in after /investigate, or code that already exhibits the error — recognize the fix case from those signals, not only from the word "bug"), the scope boundary you just recorded, the resolved test/lint/build commands, the standards and ADRs found (or that none were), the current branch, and that the skill will now write code in a red-green-refactor loop. If current branch from Project Context is the repository's default branch (main or master), recommend working on a branch, but do not wait for an answer. This is a report the user reads while the work runs, not a gate. Continue immediately to Step 2 without waiting for a response.
The one exception. If the initial request or the provided context explicitly states the human wants to review, verify, or approve the plan or test list before implementation, then this becomes a gate: build the test list in Step 2, present it together with this scope report, and wait for approval before starting the Step 3 loop. Absent an explicit request like that, the skill runs to completion without further human input.
Two things can still block a run, both hard dependencies rather than discretionary checkpoints. A missing test command is the first: if it could not be resolved from CLAUDE.md, project-discovery.md, the discovery script, or manifest inference, ask the user for it, because TDD is impossible without a way to run tests. Exhaust inference before asking. The second is the top rung of the scope gate's resolution ladder in Step 2, reached only when the requested behavior cannot be delivered without an out-of-scope change.
Step 2: Build the BDD Test List
Turn the requested feature or behavior into a test list (Kent Beck's "test list" pattern). Each item is one observable behavior, phrased as a behavior sentence, not as an implementation note. "Returns the unrounded fee for a sub-dollar charge" is a list item; "use a BigDecimal" is not. Follow references/bdd-framing.md for how to phrase and name behaviors, and which test-naming convention to adopt (the project's existing convention and any discovered coding standard win over a literal "should" default).
Fixing existing broken behavior is a regression test, not a bug-asserting test. When the work fixes broken behavior, the list item names the _desired correct_ behavior, not the current broken one: "returns the rounded total for a refund" (red now because the bug is present, green once the fix lands), never "raises ArgumentError on a refund" — a test that asserts the error the bug produces passes while the bug is present and breaks when you fix it, locking the bug in. The regression test asserts what the code _should_ do. The boundary: asserting that the code raises is the _correct_ test when raising is the specified desired behavior (raise on invalid input); it is wrong only when the raised error _is the bug being fixed_.
Order the list outside-in by user value: the next item is the most important thing the system does not yet do. When one behavior expands into several candidate tests (the empty case, the single case, the many case, the boundaries), order those tests simplest-first — Zero → One → Many — so each test forces the smallest generalization of the code. The ranking behind that order is in references/test-selection.md; pull it when the order is not obvious. For an item that is user-observable behavior at a system boundary, write the outer acceptance test for it _first_ (it will be red until its inner behaviors exist) and record it as the outer loop for that item. For internal or utility behavior with no meaningful system boundary, the outer acceptance test is optional; the inner loop alone is correct.
Apply YAGNI to the list itself. A scenario earns a place only with evidence it is needed now (a user-described need, a named dependency, an existing code path that breaks, a regulation, a real incident). Scenarios that fail the evidence test go to a deferred list with the trigger that would reopen them. Do not pad the list for symmetry or completeness.
Then apply the scope gate to the list. YAGNI asks whether a behavior has evidence it is needed. The scope gate asks a question no amount of evidence answers: would making this test pass require changing a file outside the Step 1 boundary? Ask it of every item, and ask it hardest of items that arrived from a test plan, an analysis report, or an agent finding carrying a severity label. A CRIT or HIGH label is evidence the finding is real. It is never evidence the fix belongs to this ticket, and an item whose own text names a production change as a prerequisite ("this requires first adding an explicit order") is that production change wearing a test's clothes.
The resolution ladder. Work it in order and stop at the first rung that resolves the item. Never skip to implementing the out-of-scope change.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinghan-coding/skills/tdd/SKILL.md
Popularity
- Repository stars
- 186
- Repository forks
- 17
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 6 Jul 2026, 4 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/testdouble/han/tdd)