tdd-workflows-tdd-cycle

Use when working with tdd workflows tdd cycle

Author

Install

Hot:0

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-tdd-workflows-tdd-cycle&locale=en&source=copy

TDD Workflows - Complete Test-Driven Development Workflow

Skills Overview


This is a strict test-driven development (TDD) workflow executor that uses the red-green-refactor loop and stage validation checkpoints to help developers build high-quality code with a test-first approach.

Use Cases

1. Test-First Code Development


When you need to follow a rigorous TDD process, this skill enforces the discipline of “write the test first, then implement.” It ensures that every line of code has corresponding test coverage. Whether you are developing new features or refactoring existing code, tests always lead.

2. Code Quality Improvement Projects


For projects that aim to improve code coverage, reduce defect rates, and enhance maintainability, the TDD workflow provides a complete validation system, including coverage thresholds (line coverage 80%, branch coverage 75%) and refactor triggers (refactor when complexity > 10).

3. Agile Team Collaboration


For teams using agile development, the TDD workflow standardizes test development practices, supporting both incremental development and test-suite modes. This ensures that team members remain aligned on test standards, architectural design, and continuous improvement.

Core Features

1. Strict TDD Loop Execution


Execute the full red-green-refactor cycle across three stages: RED (write a failing test), GREEN (minimal implementation), and REFACTOR (refactor the code). Each stage has its own validation checkpoint to ensure no step is skipped. Supports both incremental mode (develop one test at a time) and test-suite mode (batch develop all tests).

2. Intelligent Coverage Control


Automatically track four coverage metrics: line coverage, branch coverage, function coverage, and statement coverage. Set clear quality gates: the coverage of critical paths must reach 100% to ensure no core logic is missed. After each stage, a coverage report is automatically generated.

3. Anti-Pattern Detection and Recovery


Detect and block common TDD violations, including writing the implementation before the test, skipping the refactor stage, and modifying tests to make them pass. Once a breach of discipline is detected, execution stops immediately and a rollback plan is provided to help developers get back on the right track.

FAQs

What is the TDD red-green-refactor loop?


Red-green-refactor is the core loop of test-driven development, consisting of three stages: RED first writes a failing test; GREEN writes the minimum code to make the test pass; REFACTOR optimizes code quality while keeping the tests passing. This loop repeats continuously, ensuring the code always has test protection and quality improves over time.

Does TDD slow down development?


It may feel slower at first, but in the long run it actually improves efficiency. Test-first practices catch bugs earlier and reduce later debugging time. Refactoring with test protection lowers the risk of mistakes. The code becomes easier to maintain. This skill helps teams quickly adapt to the TDD rhythm through automated validation and stage checkpoints.

How do I choose incremental mode or test-suite mode?


Incremental mode is suitable for complex features or beginner developers—handling one test at a time reduces cognitive load and makes issues easier to pinpoint. Test-suite mode is suitable for simple features or experienced teams—batch writing all tests helps better capture the overall requirements. Both modes follow the same red-green-refactor discipline.