test-driven-development

Guides test-first development using the red-green-refactor cycle for code changes and bug fixes.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/CodeCrafterAdi2006/Ink-and-Code --skill test-driven-development-codecrafteradi2006
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/CodeCrafterAdi2006/Ink-and-Code/tree/main/Skills/test-driven-development
Command: npx skills add https://github.com/CodeCrafterAdi2006/Ink-and-Code --skill test-driven-development-codecrafteradi2006

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Code changes made without tests ship unverified behavior, and bug fixes without reproduction tests leave no regression guard. This Skill enforces a disciplined test-first workflow so every behavior change is proven by a failing-then-passing test. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Write a failing test first, implement the minimal code to pass it, then refactor with tests staying green. - Prove-It Pattern for Bug Fixes: Reproduce any reported bug with a failing test before attempting a fix, guaranteeing the fix actually works. - Test Pyramid & Sizing Guidance: Allocate effort across unit, integration, and E2E tests, and classify tests by resource size (small, medium, large). - Use Case: A bug report says completing a task doesn't set its timestamp. Write a failing test asserting completedAt is set, implement the fix, watch the test pass, then run the full suite to confirm no regressions. ## Quick Start Ask the agent to implement a new feature or fix a bug using test-driven development, starting with a failing test before writing any implementation code.

Frequently Asked Questions about test-driven-development

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 a failing test that specifies the expected behavior first, then write the minimum code to make it pass, then refactor while keeping tests green. Repeat this red-green-refactor cycle for each new behavior.

How do I write a regression test for a bug fix?

Reproduce the bug with a test that fails against the current code before attempting any fix. Once the test confirms the bug exists, implement the fix and verify the test passes, then run the full suite to catch regressions.

Should I use mocks or real implementations in unit tests?

Prefer real implementations first, then fakes, stubs, and finally mocks as a last resort. Reserve mocks for dependencies that are slow, non-deterministic, or have uncontrollable side effects like external APIs or email sending.

When should I not write tests for a change?

Skip tests only for pure configuration changes, documentation updates, or static content edits with no behavioral impact. Any change to logic, behavior, or edge case handling should have a corresponding test.

Why do my tests break every time I refactor code?

Tests that assert on internal method calls or implementation details break during refactoring even when behavior is unchanged. Assert on inputs and outputs (state-based testing) instead of interaction sequences.