spences10/skills

tdd

Test-driven development with a red-green-refactor loop. Use when explicitly asked for TDD, red-green-refactor, test-first development, or integration-test-led feature work.

First seen May 7, 2026

Installation

$ npx skills add spences10/skills --skill tdd

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from spences10/skills · top by installs.

npx skills add spences10/skills

Browse all from spences10/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 15
Default branch main
Open issues 1
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

More metadata
last_updated
2026-05-10
verified_against
current local skill refresh

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,798 B
  • docs SUMMARY.md 201 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 27 installs

SKILL.md

Test-Driven Development

Drive implementation through tests using a red-green-refactor loop.

Adapted from Matt Pocock's TDD skill.

Philosophy

Test behavior through public interfaces, not implementation details. Good tests read like specifications for what the system does. They should survive internal refactors because they do not know about private functions, internal collaborators, or storage details.

Prefer integration-style tests that exercise real code paths. Mock only at system boundaries: network calls, databases, file systems, clocks, and third-party services. See [mocking.md](references/mocking.md).

When to Use

Use this skill only when the user asks for:

  • TDD
  • red-green-refactor
  • test-first development
  • integration-test-led feature work
  • fixing a bug by first writing a failing regression test

Do not activate for general “write tests” or “add coverage” requests.

Workflow

1. Plan the Interface

Before writing code, identify the public surface area and behaviors:

  • What function, endpoint, component, command, or module will callers use?
  • What inputs and outputs matter?
  • What are the most important success, failure, and edge cases?
  • Which behaviors should be tested first?

Confirm the plan with the user when scope is ambiguous. Design for the caller, not the implementation. See [interface-design.md](references/interface-design.md).

2. Write One Tracer Bullet Test

Write one test for the simplest meaningful behavior. It must:

  • Use the public interface
  • Assert observable behavior
  • Fail for the expected reason
RED: one behavior test exists and fails

Do not write all tests first. That creates horizontal slices: tests for imagined behavior before the implementation teaches you anything.

3. Make It Green

Write the minimum implementation needed for that one test to pass.

GREEN: the new test passes with minimal code

Hardcoding is acceptable if it is genuinely the smallest step. Do not add speculative features for future tests.

4. Repeat Vertically

Add the next behavior one cycle at a time:

RED → GREEN: behavior 1
RED → GREEN: behavior 2
RED → GREEN: behavior 3

Each new test should respond to what you learned from the previous cycle.

5. Refactor Under Green

Only refactor when tests are green. Remove duplication, improve names, deepen modules, and simplify interfaces while keeping the suite passing. See [refactoring.md](references/refactoring.md).

Per-Cycle Checklist

  • Test describes behavior, not implementation
  • Test uses public interface only
  • Test would survive an internal refactor
  • Code is minimal for the current test
  • No speculative behavior was added

Anti-patterns

  • Writing implementation before the test
  • Writing many tests before making one pass
  • Testing private methods or internal state
  • Mocking internal collaborators by default
  • Making tests pass by weakening assertions
  • Refactoring while red

References

  • [deep-modules.md](references/deep-modules.md) - Why to test surface area, not internals
  • [interface-design.md](references/interface-design.md) - Contract-first design
  • [mocking.md](references/mocking.md) - When and how to use test doubles
  • [refactoring.md](references/refactoring.md) - Safe refactoring under green tests
  • [tests.md](references/tests.md) - Test structure, naming, and assertions