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/design.md
typed-service-contracts
Architecture standard for building robust, type-safe TypeScript services using the "Spec and Handler" pattern. Use when building CLIs, libraries, or complex business logic.
111agent-dx-cli-scale
A scoring scale for evaluating how well a CLI is designed for AI agents, based on the "Rewrite Your CLI for AI Agents" principles.
100ink
Ink terminal renderer for json-render that turns JSON specs into interactive terminal UIs. Use when working with @json-render/ink, building terminal UIs from JSON, creating terminal component catalogs, or rendering AI-generated specs in the terminal.
94