tdd

Implements test-first development through one failing test and one working change at a time.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/alex-jordan547/agent-setup --skill tdd-alex-jordan547
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/alex-jordan547/agent-setup/tree/main/skills/tdd
Command: npx skills add https://github.com/alex-jordan547/agent-setup --skill tdd-alex-jordan547

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? It prevents over-engineered test suites and implementation-coupled tests by enforcing a disciplined red-green-refactor loop grounded in observable behavior rather than internal structure. ## Core Features & Use Cases - Incremental test-first loop: Write one meaningful failing test, confirm it fails for the right reason, then make the smallest change that passes it. - Behavior-focused testing guidance: Test through public contracts instead of mocking internal collaborators or asserting on call counts. - Boundary mocking rules: Mock only external boundaries like payment APIs, time, and randomness, with dependency injection and SDK-style interfaces for mockability. - Use Case: When asked to add a checkout feature, write a failing test for the observable checkout behavior, implement the minimal code to pass it, then repeat for the next behavior while keeping tests green. ## Quick Start Use the tdd skill to implement the new checkout feature test-first, one failing test and one small change at a time.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I practice test-driven development on a new feature?

Write one meaningful failing test against the public contract, confirm it fails for the expected missing behavior, then make the smallest implementation that passes. Repeat for each subsequent behavior instead of writing the whole test suite upfront.

What should I mock in unit tests?

Mock only system boundaries such as external APIs, time, randomness, and sometimes databases or the file system. Never mock your own classes or internal collaborators, since that couples tests to implementation details.

Why do my tests break when I refactor code?

Tests break during refactoring when they assert on internal method names, call counts, or private methods instead of observable behavior. Test through the public interface so internal restructuring leaves the suite green.

When should I refactor during TDD?

Refactor only after a test passes and the working change reveals a concrete friction, such as repeated logic or unnecessary indirection. Keep the change minimal, rerun the tests, and avoid expanding into a broader architecture audit.

How do I make external API calls easier to mock?

Use dependency injection to pass clients in rather than constructing them internally, and prefer SDK-style interfaces with one function per operation. This gives each mock a single return shape without conditional logic in test setup.