tdd-workflows-tdd-red

Generate failing tests for the TDD red phase to define expected behavior and edge cases.

Author

Install

Hot:7

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

TDD Red Phase - Skills for the Red Phase of Test-Driven Development

Skill Overview


Before writing implementation code, first generate failing tests that define the expected behavior to ensure development goals are clear and test coverage is comprehensive.

Suitable Scenarios

1. New Feature Development


When you need to write code for a new feature, use this skill to define expected behavior in advance, including the happy path, exception handling, and boundary conditions—so the development direction is clear.

2. Test Protection Before Refactoring


Before modifying existing code, write test cases for the current behavior to create a safety net and prevent refactoring from breaking existing functionality.

3. API Interface Design


Generate contract tests for REST APIs, GraphQL, or other interfaces to clearly define input/output specifications, error codes, and exceptional scenarios.

Core Capabilities

1. Multi-Framework Test Generation


Supports mainstream testing frameworks and languages, including Python (pytest), JavaScript/TypeScript (Jest/Vitest), Go (table-driven tests), Ruby (RSpec), and Java (JUnit). Automatically generates test code structures that follow each framework’s best practices.

2. Comprehensive Behavioral Coverage


Not only test the happy path, but systematically cover edge cases, including nulls, boundary values, special characters, concurrent access, network errors, and more—ensuring tests are complete and robust.

3. Verifiable Failing Design


The generated tests will fail correctly due to missing implementation code—not because of syntax errors or configuration issues. Each test includes clear error diagnostics to help quickly identify the root cause.

Common Questions

What does the TDD red phase mean?


TDD (Test-Driven Development) is divided into three phases: Red, Green, and Refactor. The red phase means that before writing any implementation code, you first write tests that are expected to fail, with the purpose of clearly defining expected behavior. Only when tests fail because the functionality is not implemented can you proceed to the implementation (green) phase.

Why must tests fail at the start?


This is a core principle of TDD. If tests pass immediately, it means the tests are not truly validating the new behavior, or the tests themselves have problems. Correct failure proves that the tests are checking for missing functionality; only passing tests afterward can confirm that the implementation is correct.

Do test failures indicate code problems or test problems?


When using this skill, the tests should fail due to missing implementation—that is the correct state. If the failure is caused by syntax errors, import failures, or configuration issues, then you need to check the test code itself. The generated tests include diagnostic information to help distinguish between these two situations.

What scenarios are included in edge-case testing?


Edge cases typically include: null values (null, undefined, empty strings/arrays), boundary values (minimum/maximum values, single elements), special characters (Unicode, whitespace), invalid state transitions, concurrency conflicts, timeouts, permission errors, and more. This skill will automatically identify and generate the corresponding tests based on the specific scenario.

How many tests should be written for the TDD red phase?


It depends on the complexity and criticality of the feature. In general, at least cover: the happy path, the main error paths, and obvious edge cases. This skill systematically identifies which scenarios need coverage to avoid missing important boundary conditions.