tdd-practices

Guide developers through the RED-GREEN-REFACTOR TDD cycle.

9|Updated Jan 31, 2017
One-click install
npx skills add https://github.com/ssiumha/dots --skill tdd-practices-ssiumha
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-practices
Source: https://github.com/ssiumha/dots/tree/main/prompts/skills/tdd-practices
Command: npx skills add https://github.com/ssiumha/dots --skill tdd-practices-ssiumha

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

TDD Practices provides a structured workflow (RED-GREEN-REFACTOR) and AI-safety nets to guide feature development, bug fixes, and refactoring with test-first discipline.

Core Features & Use Cases

  • Phase-based TDD workflow (Phase 1-Phase 5) including RED, GREEN, REFACTOR
  • AI Red Flags to detect loops, unintended feature drift, and test-ticking
  • Resource references: patterns.md, strategies.md, refactoring.md, ai-coding.md
  • Integration with living-docs for traceability

Quick Start

Say "Start TDD session" and follow the phase sequence; run tests, incorporate AI feedback, and progress to REFACTOR.

Frequently Asked Questions about tdd-practices

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

FAQPage Schema
How do I implement test-driven development to improve code quality?

Test-driven development (TDD) is a discipline where you write tests before implementation code. The RED-GREEN-REFACTOR cycle guides you: write a failing test (RED), implement minimal code to pass it (GREEN), then improve the code without changing behavior (REFACTOR). This approach ensures every feature has verifiable tests and reduces bugs.

What is the RED-GREEN-REFACTOR cycle and how does it work?

RED-GREEN-REFACTOR is a three-phase TDD workflow. RED: write a test that fails. GREEN: write minimal code to pass the test. REFACTOR: improve code quality, design, and documentation while keeping tests passing. This cycle repeats for each feature, ensuring test coverage and preventing feature drift.

How can I avoid common TDD mistakes like test ticking or unintended feature additions?

AI Red Flags catch loops, test ticking (writing tests without real implementation), and unauthorized feature drift during development. The structured phase-based workflow enforces test isolation, prevents scope creep, and maintains regression safety through continuous testing and explicit verification at each step.

Can I use TDD for bug fixes and refactoring, or just new features?

TDD applies across feature development, bug fixes, and refactoring. For each task, follow the same RED-GREEN-REFACTOR cycle: write a test that reproduces the issue or validates the improvement, implement the fix or refactoring, then verify with passing tests and documentation updates.

What preparation do I need before starting a TDD session?

Begin by creating a test list outlining the small, verifiable tests required for your task. Run a baseline to establish current behavior. Then initiate a TDD session following the five-phase workflow, incorporating AI feedback and adhering to test isolation rules to maintain code integrity.

How does TDD ensure my code stays maintainable and safe during iteration?

TDD enforces one small, verifiable test per step with explicit test isolation, preventing hidden dependencies. Continuous regression testing through each phase catches breakage immediately. Regular refactoring and documentation updates during the REFACTOR phase maintain code clarity and long-term safety.