tdd-workflows-tdd-green

Implement the minimal code needed to make failing tests pass in the TDD green phase.

Author

Install

Hot:4

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-green&locale=en&source=copy

TDD Green Phase - Test-Driven Development Green Phase

Skill Overview


The TDD Green Phase skill helps developers implement the smallest amount of code needed to make failing tests pass, following the green-phase principle of the “red-green-refactor” loop in test-driven development.

Suitable Scenarios

  • Quick fixes after TDD test failures

  • When unit tests or integration tests fail, you need to write the minimum viable code to make the tests pass, keeping the test-driven development workflow and momentum.

  • MVP (Minimum Viable Product) development

  • In the early stages of feature development, focus on implementing the simplest code that satisfies the test requirements, avoiding over-engineering and premature optimization.

  • Django/Express backend API development

  • Practice the TDD workflow in web frameworks: start with simple functions and gradually evolve into layered architectures such as class-based views, middleware, and service layers.

    Core Features

  • Minimum-code implementation strategy

  • Provides an evolution path from inline code to a layered architecture, including Django’s Inline → Class-based → Generic Views patterns and Express’s Inline → Middleware → Service Layer patterns.

  • Control of the TDD loop rhythm

  • Helps developers stay disciplined during the green phase—implement only what the current test requires, and postpone optimizations and design improvements to the refactor phase.

  • Technical debt tracking

  • While quickly implementing to get tests passing, record shortcuts and debt items that need improvement, ensuring a clear checklist for the subsequent refactor phase.

    Common Questions

    What are the core principles of the TDD Green Phase?


    The core of the green phase is “the simplest implementation”—write the minimum code required to make the current test pass. This is not an invitation to write poor code, but a way to maintain development momentum by deferring design optimizations to the refactor phase.

    How much code should be written in the green phase?


    Write only enough to make the next test pass. For example, if the test requires returning a list of products, write a simple query that returns that list. In the green phase, don’t consider caching, pagination, permissions, and similar requirements unless there are already tests for them.

    Is this skill suitable for the refactor phase?


    No. TDD Green Phase is specifically for the green step in the “red-green-refactor” loop—i.e., implementing quickly after a test fails. If the tests are already passing and you need to improve the design, you should enter the refactor phase (Refactor) instead of using this skill.