Official agent skill

TDD Red Green Refactor

by google-labs-code in google-labs-code/stitch-sdk

Enforces a disciplined Red-Green-Refactor (TDD) workflow in TypeScript/Node.js.

OfficialApache-2.0Auto-check passedTesting & QA

Install TDD Red Green Refactor

skills CLI
$ npx skills add google-labs-code/stitch-sdk --skill tdd-red-green-refactor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install google-labs-code/stitch-sdk tdd-red-green-refactor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/google-labs-code/stitch-sdk.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/tdd .claude/skills/tdd-red-green-refactor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
tdd-red-green-refactor
GitHub stars
1.8k
Token cost
~755 tokens
SKILL.md length
333 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Enforces a disciplined Red-Green-Refactor (TDD) workflow in TypeScript/Node.js.

  • Works in 6 steps: Red (Establish Failure) → Green (Minimal Pass) → Refactor (Clean Up) → …
  • Tasks that involve Test-driven development
  • SKILL.md covers The Three-Phase Cycle, Core Operational Rules and Example Workflow (TypeScript +…
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

TDD Red Green Refactor is an agent skill from google-labs-code/stitch-sdk, published by the product's own GitHub organization. Enforces a disciplined Red-Green-Refactor (TDD) workflow in TypeScript/Node.js. Use this whenever creating new features, fixing bugs, or migrating logic to ensure high-quality, verifiable implementations.

Its SKILL.md is about 760 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Test-driven development. It works with TypeScript and Node.js. The repository describes itself as: Generate UI screens from text prompts and extract their HTML and screenshots programmatically. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Test-driven development

Example prompts

  • “Use the tdd-red-green-refactor skill to enforce a disciplined Red-Green-Refactor (TDD) workflow in TypeScript/Node.js”
  • “/tdd-red-green-refactor”

Requirements

  • Node.js

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Red (Establish Failure)
  2. Green (Minimal Pass)
  3. Refactor (Clean Up)
  4. No "Horizontal Splurging"
  5. Impose Backpressure
  6. Verification of Integrity

What it can do on your machine

Read from SKILL.md and the folder at commit e3f8ece. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

TDD Red Green Refactor loads about 755 tokens when it runs. Until then it costs about 57 tokens; SKILL.md has 333 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~57
When it runs · the whole SKILL.md, loaded when a task matches
~755

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from google-labs-code/stitch-sdk at commit e3f8ece, republished under its Apache-2.0 licence (© google-labs-code). 333 words, ~755 tokens.

Download SKILL.mdSave it as .claude/skills/tdd-red-green-refactor/SKILL.md (or your agent's skills folder).
name
tdd-red-green-refactor
description
Enforces a disciplined Red-Green-Refactor (TDD) workflow in TypeScript/Node.js. Use this whenever creating new features, fixing bugs, or migrating logic to ensure high-quality, verifiable implementations.

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.
Phase 3: Refactor (Clean Up)

Improve the code structure while maintaining the "Green" state.

  1. Clean Up: Improve naming, remove duplication, and optimize the code written in Phase 2.
  2. Safety Net: Rerun the tests after every change. If they turn Red, revert the change immediately.

Core Operational Rules

1. No "Horizontal Splurging"

You are strictly forbidden from writing a large "splurge" of multiple tests at once. You must follow a strictly incremental loop:

  • Write 1 Test -> See it Fail -> Write 1 Fix -> See it Pass.
  • Repeat this loop for every sub-feature.
2. Impose Backpressure

Use automated assertions and strong typing (TypeScript) as backpressure to prevent the AI from "guessing" the solution or "playing in the mud" with low-quality code.

3. Verification of Integrity

Never modify an existing test to make a failing implementation pass. If a test must change, it must be because the requirement changed, not because the code is difficult to write.


Example Workflow (TypeScript + Vitest)

Step 1: Red

typescript
// math.test.ts
import { describe, it, expect } from "vitest";
import { add } from "./math";

describe("add", () => {
  it("should sum two numbers", () => {
    expect(add(2, 2)).toBe(4); // Fails: ReferenceError: add is not defined
  });
});

Step 2: Green

typescript
// math.ts
export const add = (a: any, b: any) => {
  return 4; // Passes: Minimal code to satisfy the test
};

Step 3: Refactor

typescript
// math.ts
/**
 * Sums two numbers with explicit type safety.
 */
export const add = (a: number, b: number): number => {
  return a + b; // Passes: Proper implementation with safety net
};

© google-labs-code, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/tdd of google-labs-code/stitch-sdk.

Open the folder on GitHubat commit e3f8ece

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders. This page covers the copy in google-labs-code/stitch-sdk, which our catalogue first saw on October 7, 2026.

Compare with similar skills

TDD Red Green Refactor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

TDD Red Green Refactor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
TDD Red Green Refactor this skillgoogle-labs-code/stitch-sdk1.8k—~755Automated safety check: PassApache-2.0
TDDccusage/ccusage19k—~665Automated safety check: PassCustom licence
E2E Testcrowdin/crowdin-api-client-js139—~893Automated safety check: NotesMIT
Bungalfrevn/apollo237—~2kAutomated safety check: NotesMIT
Bug HuntUse-Tusk/drift-node-sdk173—~3.6kAutomated safety check: PassApache-2.0
Bunbastani-inc/atomic846—~2.8kAutomated safety check: PassCustom licence

Similar skills

  • TDD

    ccusage/ccusage

    Guides t-wada Red-Green-Refactor TDD for ccusage logic changes.

    19k GitHub stars~665 tokensUpdated today
    Testing & QAAuto-check passed
  • E2E Test

    crowdin/crowdin-api-client-js

    Run end-to-end tests against the real Crowdin or Crowdin Enterprise API using credentials from .env.

    139 GitHub stars~893 tokensUpdated 5 days ago
    Testing & QAAuto-check: notes
  • Bun

    galfrevn/apollo

    A skill your agent uses when building, running, testing, or bundling JavaScript/TypeScript applications.

    237 GitHub stars~2k tokensUpdated 1 mo ago
    Testing & QAAuto-check: notes
  • Bug Hunt

    Use-Tusk/drift-node-sdk

    Hunt for instrumentation bugs by analyzing code gaps and running e2e tests through DISABLED/RECORD/REPLAY cycle

    173 GitHub stars~3.6k tokensUpdated 5 mo ago
    Testing & QAAuto-check passed
  • Bun

    bastani-inc/atomic

    A skill your agent uses when building, testing, and deploying JavaScript/TypeScript applications.

    846 GitHub stars~2.8k tokensUpdated today
    Testing & QAAuto-check passed
  • Node

    HsienW/chat-gun

    Provides domain-specific best practices for Node.js development with TypeScript, covering type stripping, async patterns, error handling, streams, modules, testing, performance, caching, logging…

    143 GitHub stars~1.6k tokensUpdated 3 days ago
    Testing & QAAuto-check passed

More from google-labs-code/stitch-sdk

All 9 skills in this repo
  • Stitch SDK Development

    google-labs-code/stitch-sdk

    Official

    Develop the Stitch SDK. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~3.4k tokensUpdated 7 days ago
    Auto-check passed
  • Stitch SDK Domain Design

    google-labs-code/stitch-sdk

    Official

    Design the domain model for the Stitch SDK. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~2.4k tokensUpdated 7 days ago
    Auto-check passed
  • Stitch SDK Pipeline

    google-labs-code/stitch-sdk

    Official

    Run the full Stitch SDK generation pipeline. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~2k tokensUpdated 7 days ago
    Auto-check passed
  • Stitch SDK Readme

    google-labs-code/stitch-sdk

    Official

    Generate or update the README for the Stitch SDK. An agent skill from google-labs-code/stitch-sdk.

    1.8k GitHub stars~1.8k tokensUpdated 7 days ago
    Auto-check passed
  • Stitch SDK Usage

    google-labs-code/stitch-sdk

    Official

    Use the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images.

    1.8k GitHub stars~2.8k tokensUpdated 7 days ago
    Auto-check passed
  • Typed Service Contracts

    google-labs-code/stitch-sdk

    Official

    Architecture standard for building robust, type-safe TypeScript services using the "Spec and Handler" pattern.

    1.8k GitHub stars~1.4k tokensUpdated 7 days ago
    Auto-check passed

Categories

Questions about TDD Red Green Refactor

What does TDD Red Green Refactor do?

Enforces a disciplined Red-Green-Refactor (TDD) workflow in TypeScript/Node.js. TDD Red Green Refactor is an agent skill from google-labs-code/stitch-sdk, published by the product's own GitHub organization.js.

When should I use TDD Red Green Refactor?

TDD Red Green Refactor fits situations like: tasks that involve Test-driven development.

How do I install TDD Red Green Refactor in Claude Code?

Run `npx skills add google-labs-code/stitch-sdk --skill tdd-red-green-refactor -a claude-code`. Or copy the skill folder (.agents/skills/tdd in google-labs-code/stitch-sdk) into .claude/skills/tdd-red-green-refactor in your project. Claude Code loads it when a task matches its description.

How do I install TDD Red Green Refactor in Codex?

Run `npx skills add google-labs-code/stitch-sdk --skill tdd-red-green-refactor -a codex`. Or copy the skill folder (.agents/skills/tdd in google-labs-code/stitch-sdk) into .agents/skills/tdd-red-green-refactor in your project. Codex loads it when a task matches its description.

Can I use TDD Red Green Refactor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add google-labs-code/stitch-sdk --skill tdd-red-green-refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/tdd-red-green-refactor, .gemini/skills/tdd-red-green-refactor, .github/skills/tdd-red-green-refactor and .opencode/skills/tdd-red-green-refactor in your project.

What does TDD Red Green Refactor need to run?

SKILL.md names no scripts, command-line tools or credentials: TDD Red Green Refactor is instructions for the agent only. Our summary lists: Node.js.

Does TDD Red Green Refactor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is TDD Red Green Refactor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does TDD Red Green Refactor use?

TDD Red Green Refactor is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does TDD Red Green Refactor use?

About 755 tokens (SKILL.md is roughly 3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to TDD Red Green Refactor?

Skills that share tags, products or a category with TDD Red Green Refactor: TDD (ccusage/ccusage, 19k stars), E2E Test (crowdin/crowdin-api-client-js, 139 stars), Bun (galfrevn/apollo, 237 stars) and Bug Hunt (Use-Tusk/drift-node-sdk, 173 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains TDD Red Green Refactor?

google-labs-code (a GitHub organization, an official publisher) maintains it in google-labs-code/stitch-sdk, which has 1,825 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 1, 2026.

Source: google-labs-code/stitch-sdk on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.