tdd-red-green-refactor
Red-Green-Refactor (TDD) Skill: TypeScript Edition
This skill implements a structural framework for AI-assisted programming to ensure every line of code is verifiable, typed, and purposeful.
The Three-Phase Cycle
Phase 1: Red (Establish Failure)
You must prove the feature does not exist and that your test is valid.
- Write One Test: Create a single test case (e.g., in Vitest or Jest) for the next small piece of behavior.
- Execute & Fail: Run the test. It must fail.
- Verify: Ensure the failure is related to the missing logic (e.g.,
ReferenceError: add is not defined) and not a configuration error.
Phase 2: Green (Minimal Pass)
Make the test pass as quickly and simply as possible.
- Minimal Implementation: Write the simplest code that satisfies the test. Do not build for the future; focus strictly on the current "Red" test.
- Run Tests: Execute the suite. All tests must be Green.
- Evidence: The transition from Red to Green is the "Proof of Work" for the developer.
Phase 3: Refactor (Clean Up)
More from google-labs-code/stitch-sdk
stitch-sdk-usage
Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images. Use when the user wants to consume the SDK in their application.
171stitch-sdk-readme
Generate or update the README for the Stitch SDK. Use the Bookstore Test structure and source the current API from the codebase. Use when the README needs to be written or updated.
108stitch-sdk-development
Develop the Stitch SDK. Covers the generation pipeline, dual modality (agent vs SDK), error handling, and Traffic Light (Red-Green-Yellow) implementation workflow. Use when adding features, fixing bugs, or understanding the architecture.
98stitch-sdk-domain-design
Design the domain model for the Stitch SDK. Use when mapping MCP tools to domain classes and bindings in domain-map.json. This is Stage 2 of the generation pipeline.
95stitch-sdk-pipeline
Run the full Stitch SDK generation pipeline. Use when a new tool is added, or the SDK needs to be regenerated end-to-end.
94stitch-sdk-bug-bash
Find bugs in the Stitch SDK using a real API key. Covers standard functional edges and tricky situations.
39