google-labs-code avatar

Tdd Red Green Refactor

This enforces strict test-driven development for TypeScript projects by requiring you to write one failing test, make it pass with minimal code, then refactor. It blocks "horizontal splurging" where you write multiple tests at once, forcing a tight Red-Green-Refactor loop for each tiny feature increment. Use it when you need disciplined, verifiable progress on new features or bug fixes and want to prevent the AI from guessing or building ahead of your tests. The real value is in the backpressure: TypeScript's type system plus mandatory test failures create guardrails that keep implementations honest and incremental rather than speculative.

skills.sh installs
732
GitHub stars
28.8K
last updated
Aug 21, 2026

Install

$ npx -y skills add google-labs-code/design.md --skill tdd-red-green-refactor --agent claude-code

Installs into .claude/skills of the current project.

Files

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.

  1. Write One Test: Create a single test case (e.g., in Vitest or Jest) for the next small piece of behavior.
  2. Execute & Fail: Run the test. It must fail.
  3. 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.

  1. Minimal Implementation: Write the simplest code that satisfies the test. Do not build for the future; focus strictly on the current "Red" test.
  2. Run Tests: Execute the suite. All tests must be Green.
  3. Evidence: The transition from Red to Green is the "Proof of Work" for the developer.

Sponsors

Details

Repository
github.com/google-labs-code/design.md
Categories
Testing & QA, Code Review & Quality, Automation & Workflows, Design & UI/UX
First seen
Jun 3, 2026

More from google-labs-code/design.md

All 4
1theqtcompanyrnd avatarqt-qml-testtheqtcompanyrnd/agent-skills>-689skills.sh installs
2proffesor-for-testing avatarcompatibility-testingproffesor-for-testing/agentic-qeCross-browser, cross-platform, and cross-device compatibility testing ensuring consistent experience across environments. Use when validating browser support, t654skills.sh installs
3alirezarezvani avatarab-test-setupalirezarezvani/claude-skillsWhen the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this 636skills.sh installs
4aradotso avatars800-vehicle-network-security-testingaradotso/security-skillss800 vehicle network security testing623skills.sh installs
5eyadkelleh avatarllm-testingeyadkelleh/awesome-skills-securityComprehensive LLM security testing prompts for bias detection, data leakage, alignment testing, and adversarial prompt resistance.584skills.sh installs
6testdino-hq avatarplaywright-pomtestdino-hq/playwright-skillPage Object Model patterns for Playwright — when to use POM, how to structure page objects, and when fixtures or helpers are a better fit.583skills.sh installs