test-driven-development

Enforce a test-first workflow with red-green-refactor cycles and 80% coverage.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/khoabd/paperclip --skill test-driven-development-khoabd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/khoabd/paperclip/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/khoabd/paperclip --skill test-driven-development-khoabd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates the risk of shipping buggy, hard-to-maintain code that requires costly post-deployment debugging and rework by enforcing a test-first development workflow that catches issues early in the creation process.

Core Features & Use Cases

  • Strict TDD Workflow: Enforces the red-green-refactor cycle, requiring developers to write a failing test before implementing any production code, then refactor only after tests pass.
  • Clear Quality Targets: Sets explicit coverage goals (80%+ unit test line coverage, integration tests covering happy path and 2 error paths, E2E tests for critical user journeys) to ensure sufficient test depth.
  • Use Case: When building a new user authentication endpoint, use this skill to first write failing tests for valid login, invalid password, and non-existent user scenarios, then implement the endpoint logic to pass all tests before refactoring for performance.

Quick Start

Use the test-driven-development skill to write failing test cases for the new order processing function before writing any of its 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 start writing unit tests before implementing new functions?

To start writing unit tests first, write a failing test case for the new function before creating any implementation code. This test-driven workflow enforces the red-green-refactor cycle, requiring tests to fail initially, pass after implementation, and then undergo refactoring for optimized code quality.

What is the red-green-refactor cycle in test-driven development?

The red-green-refactor cycle in test-driven development mandates writing a failing test first, implementing the minimum production code to make it pass, and then refactoring the code. This workflow prevents the delivery of bug-prone code by catching issues early in the creation process.

How much unit test coverage do I need for maintainable code?

Maintainable code requires 80% or higher unit test line coverage. Additionally, integration tests must cover both the happy path and at least two error paths, alongside end-to-end tests for critical user journeys, to meet defined software quality standards.

Can I use test-driven development for building API endpoints?

Yes, test-driven development applies to building API endpoints. When creating a new endpoint, write failing tests for valid inputs, invalid inputs, and missing data scenarios first, then implement the endpoint logic to pass all tests before refactoring.

Why write failing tests before writing production code?

Writing failing tests before production code ensures the test accurately validates the intended logic and prevents untested code from being shipped. This strict test-first approach eliminates costly post-deployment debugging by catching behavioral issues early.

Does test-driven development require integration tests for error paths?

Yes, test-driven development requires integration tests covering both the happy path and two error paths. This ensures sufficient test depth to validate that the code correctly handles unexpected scenarios and maintains long-term maintainability.