Skip to content

feat(tdd): add TPP + ZOMBIES next-test selection to the /tdd skill#108

Open
Hyperman012 wants to merge 1 commit into
testdouble:mainfrom
Hyperman012:feat/tdd-test-selection-tpp-zombies
Open

feat(tdd): add TPP + ZOMBIES next-test selection to the /tdd skill#108
Hyperman012 wants to merge 1 commit into
testdouble:mainfrom
Hyperman012:feat/tdd-test-selection-tpp-zombies

Conversation

@Hyperman012

Copy link
Copy Markdown

Summary

The /tdd skill's loop says to write a failing test and make it pass; it does not say which test to write next. This PR adds the two complementary test-selection heuristics as a new progressive-disclosure reference for the skill:

  • Transformation Priority Premise (TPP), Robert C. Martin's ranked list of code transformations, simplest first. Pick the test whose passing requires the highest-priority transformation still available.
  • ZOMBIES, James Grenning's Zero, One, Many, Boundaries, Interface, Exceptions, Simple mnemonic, as the concrete ordering for the same simplest-first selection.

What's included

  • han-coding/skills/tdd/references/test-selection.md (new): the canonical 14-transformation table, the "as the tests get more specific, the code gets more generic" principle, the decision-point rule with the bubble-sort/quicksort demonstration, the ZOMBIES table and Z-O-M ordering rule, diagnostic signals, a worked sum() example, and sources (Martin, Grenning, Langr).
  • han-coding/skills/tdd/SKILL.md: three hooks at the skill's existing seams. Step 2 orders a behavior's candidate tests Zero -> One -> Many; Step 3 uses the ranking to pick among qualifying items (and to detect a missing smaller test); the frontmatter description gains TPP and ZOMBIES trigger vocabulary.
  • docs/skills/han-coding/tdd.md: a Key concepts bullet and two Sources entries, per the long-form-doc coverage rule.

Alignment with the skill's existing discipline

The reference reconciles the heuristics with the skill rather than importing them wholesale:

  • User value picks the behavior; TPP picks the test. Step 2's outside-in user-value ordering and TPP's simplest-first ordering answer different questions and do not compete.
  • TPP is how you find Beck's "one step test" that Step 3 already asks for.
  • The gears stay small because the tests were chosen small. Fake It is nil -> constant; Triangulate adds the example that forces constant -> scalar.
  • A confirming first-run pass maps onto the observed-failure gate's existing "behavior already exists" diagnosis instead of fighting it.

Field test

Exercised by driving the modified skill through the Prime Factors kata (Ruby/minitest), with per-cycle logging and one commit per cycle for an auditable order. Results:

  • Test order emerged as the canonical TPP sequence: of(1) (Z, nil -> constant), of(2) (O, unconditional -> if), of(3) (O, constant -> scalar via triangulation), of(4) (M, if -> while), of(9) (M, divisor generalization), of(12) (confirming test).
  • The confirming test on 12 passed on first run; the observed-failure gate tripped and the "behavior already exists" diagnosis applied, exactly as the reference predicts.
  • The classic nested-while algorithm emerged without being planned. Final suite: 6 runs, 6 assertions, 0 failures, 0 errors, 0 skips.
  • Two ambiguities the field test surfaced in the new material are fixed in this PR: a tie-break rule for candidates demanding the same transformation, and a note that one test may force a small cluster of transformations (compare by the deepest-ranked member).

Two pre-existing observations from the same run, out of scope here but noted for maintainers: on a first-run pass the "cross it off and pick the next one" instruction skips that cycle's otherwise non-skippable refactor statement, and Step 5 gives no instruction for projects with no lint or build command configured.

Credit and sources

Ported from Dale Stewart's nw-tpp-methodology skill for nWave (nWave-ai/nWave#67) and his write-up "The Next Test" (https://meresoftware.substack.com/p/the-next-test), adapted to this skill's loop, reference conventions, and writing voice. Primary sources: Martin's "The Transformation Priority Premise", "Transformation Priority and Sorting", and "The Cycles of TDD"; Grenning's "TDD Guided by ZOMBIES"; Langr's Modern C++ Programming with Test-Driven Development.

🤖 Generated with Claude Code

The red-green-refactor loop says to write a failing test and make it
pass; it does not say which test to write next. This adds the two
complementary selection heuristics as a new progressive-disclosure
reference for the /tdd skill:

- Transformation Priority Premise (Robert C. Martin): the ranked list
  of code transformations, simplest first. Pick the test whose passing
  requires the highest-priority transformation still available.
- ZOMBIES (James Grenning): Zero -> One -> Many plus Boundaries,
  Interface, Exceptions, Simple, as the concrete ordering for the same
  simplest-first selection.

Wiring follows the skill's existing seams: Step 2 orders a behavior's
candidate tests Zero -> One -> Many, Step 3 uses the ranking to find
Beck's "one step test", and the frontmatter description gains TPP and
ZOMBIES trigger vocabulary. The reference reconciles the heuristics
with the skill's outside-in user-value ordering (user value picks the
behavior, TPP picks the test), the implementation gears (Fake It is
nil -> constant, Triangulate forces constant -> scalar), and the
observed-failure gate (a confirming first-run pass is the
behavior-already-exists arm). Long-form doc gains the key concept and
the two sources.

Ported from the nWave nw-tpp-methodology skill (nWave-ai/nWave#67) and
"The Next Test" (meresoftware.substack.com/p/the-next-test).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mxriverlynn

Copy link
Copy Markdown
Collaborator

Hi @Hyperman012 - this is great! i hadn't heard about these forms of test selection, but after reading everything in this PR, it makes sense. I think somewhere in my career, i ended up picking up some informal version of these ideas.

i'll give this update a few runs over the next few days and let you know if i have any feedback. thank you!

@Hyperman012

Copy link
Copy Markdown
Author

Hi @Hyperman012 - this is great! i hadn't heard about these forms of test selection, but after reading everything in this PR, it makes sense. I think somewhere in my career, i ended up picking up some informal version of these ideas.

i'll give this update a few runs over the next few days and let you know if i have any feedback. thank you!

Absolutely! I love this stuff! and i've been loving these Han skills. so thank you for publishing so i can add on!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants