tdd

Implement behavior through a red-green-refactor loop with public interface tests.

1|Updated May 22, 2026
One-click install
npx skills add https://github.com/spontus-reach/spontus --skill tdd-spontus-reach
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/spontus-reach/spontus/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/spontus-reach/spontus --skill tdd-spontus-reach

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

TDD helps you build correct functionality faster by forcing short feedback loops where tests drive the next small implementation step, reducing regressions and brittle test suites.

Core Features & Use Cases

  • Test-first vertical slices: Build one small behavior at a time using a red-green-refactor flow so each test proves an end-to-end capability through public interfaces.
  • Behavior-driven testing guidance: Write integration-style tests that validate observable outcomes rather than mocking internal collaborators or private methods.
  • Design for testability: Use small/deep modules and interface design practices (dependency injection, return results over side effects, small surface areas) to make tests straightforward and resilient.

Quick Start

Use the tdd skill when you want to develop a new feature or fix a bug by defining the expected behavior first, then implementing the minimal code to make the public-facing test pass, and finally refactoring safely after all tests are green.

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement new features using test-driven development?

Test-driven development builds features incrementally using a red-green-refactor loop. You write a failing test first, implement minimal code to pass it, then refactor safely while keeping all tests green.

What is the best way to write integration tests that validate observable outcomes?

Behavior-driven integration tests validate observable outcomes through public interfaces rather than mocking internal collaborators or private methods. This approach prioritizes vertical slice execution and tracer bullets to prove end-to-end capabilities without horizontal test planning.

When should I use dependency injection for testability?

Use dependency injection for testability when designing small, deep modules with minimal surface areas. This practice, alongside returning results over side effects, makes integration tests straightforward and resilient by reducing reliance on mocking internal collaborators.

Can I refactor code before all my tests are green?

Refactoring should only occur after all tests are green. The test-driven development cycle applies refactor-after-green guardrails specifically to prevent speculative modifications, ensuring you only improve internal structure once correct behavior is verified.

Does test-driven development work for fixing bugs or only for new features?

Test-driven development applies to both feature development and bug fixing. For bug fixes, you write a test that reproduces the incorrect behavior first, making it fail red, then implement the minimal fix to turn it green before refactoring.