agentsclimarketplace

Tdd

Skill wachawo/claude-skills/skills/tdd

Test-driven development with the red-green-refactor cycle. Use when the user wants to develop features or fix bugs via TDD, mentions "red-green-refactor", asks for integration tests, or requests a test-first approach.From its SKILL.md

Install
npx -y skills add wachawo/claude-skills --skill tdd

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.4 KB, 934 tokens by cl100k_base, as published. Nobody here has run it

Test-Driven Development

Philosophy

Core principle: tests must verify behavior through public interfaces, not implementation details. The code may change completely; the tests should not.

Good tests are integration-style: they exercise real code paths through public APIs. They describe what the system does, not how. A good test reads like a specification: "user can checkout with valid cart" immediately tells you which capability exists. Such tests survive refactorings because they are indifferent to internal structure.

Bad tests are coupled to implementation. They mock internal collaborators, test private methods, or verify state through external means (e.g. reaching directly into the database instead of using the interface). A red flag: the test breaks during a refactor even though behavior did not change. If renaming an internal function breaks the tests, those tests were testing implementation, not behavior.

For examples see tests.md; for the mocking guide see mocking.md.

Anti-pattern: horizontal slicing

Do NOT write all the tests first and then all the implementation. That is "horizontal slicing" — interpreting RED as "write all the tests" and GREEN as "write all the code".

This produces bad tests:

  • Tests written in a batch test imagined behavior, not real behavior
  • You end up testing the shape of things (data structures, function signatures) rather than user-facing behavior
  • Tests become insensitive to real changes — they pass when behavior is broken, and fail when it is fine
  • You outrun your headlights, fixating on test structure before understanding the implementation

The right approach: vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned in the previous cycle. Because you have just written the code, you know exactly which behavior matters and how to verify it.

WRONG (horizontal):
  RED:   test1, test2, test3, test4, test5
  GREEN: impl1, impl2, impl3, impl4, impl5

RIGHT (vertical):
  RED→GREEN: test1→impl1
  RED→GREEN: test2→impl2
  RED→GREEN: test3→impl3
  ...

Workflow

1. Planning

When exploring the codebase, use the project's domain glossary so that test names and interface vocabulary match the project's language, and follow the ADRs in the area you are modifying.

Before writing code:

  • Confirm with the user which interface changes are required
  • Confirm with the user which behaviors to test (prioritize them)
  • Look for opportunities for deep modules (narrow interface, deep implementation)
  • Design interfaces for testability
  • List behaviors to test (not implementation steps)
  • Get the plan approved by the user

Ask: "What should the public interface be? Which behaviors are most important to test?"

You cannot test everything. Clarify with the user which behaviors matter most. Focus testing on critical paths and complex logic, not every possible edge case.

2. Tracer Bullet

Write ONE test that confirms ONE fact about the system:

RED:   Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passes

This is your tracer bullet — it proves the path works end-to-end.

3. Incremental cycle

For each remaining behavior:

RED:   Write next test → fails
GREEN: Minimal code to pass → passes

Rules:

  • One test at a time
  • Just enough code to pass the current test
  • Do not anticipate future tests
  • Tests focus on observable behavior

4. Refactor

Once all tests pass, look for refactor candidates:

  • Extract duplication
  • Deepen modules (hide complexity behind simple interfaces)
  • Apply SOLID principles where natural
  • Consider what the new code reveals about existing code
  • Run the tests after every refactoring step

Never refactor on RED. Get to GREEN first.

Per-cycle checklist

[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Test would survive internal refactor
[ ] Code is minimal for this test
[ ] No speculative features added

What ships with it: 5 files

5.5 KB alongside SKILL.md

Gives 3 of the 12 instructions most tdd skills give in 934 tokens

Counted across 439 of the 443 authors here whose files we hold, read 2026-08-07

  • Write minimal code to pass the testhere, and in 304 of 439, across 222 files
  • Write a failing test firstin 174 of 439, across 111 files
  • Refactor code only after tests passin 172 of 439, across 102 files
  • Watch the test fail before writing codein 145 of 439, across 97 files
  • Test one behavior per testin 108 of 439, across 46 files
  • Refactor code while keeping tests greenhere, and in 100 of 439, across 88 files
  • Delete code written before testsin 99 of 439, across 55 files
  • Run tests after each refactor stephere, and in 88 of 439, across 57 files
  • Confirm the test fails for the right reasonin 66 of 439, across 62 files
  • Use real code instead of mocks unless unavoidablein 60 of 439, across 17 files
  • Reproduce bugs with a test before fixingin 53 of 439, across 36 files
  • Write tests before implementationin 51 of 439, across 43 files

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 326,758. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.