with one click
tdd-red-green-refactor
// 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.
// 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.
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.
Generates a deeply contextual, progressive-disclosure briefing for any GitHub repository. It builds a mental model of the code before analyzing issues and PRs to provide actionable insights. Use when asked for a "GitHub report," "repo status," "daily briefing," or to "catch up on a codebase."
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.
Find bugs in the Stitch SDK using a real API key. Covers standard functional edges and tricky situations.
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.
Run the full Stitch SDK generation pipeline. Use when a new tool is added, or the SDK needs to be regenerated end-to-end.
| 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. |
This skill implements a structural framework for AI-assisted programming to ensure every line of code is verifiable, typed, and purposeful.
You must prove the feature does not exist and that your test is valid.
ReferenceError: add is not defined) and not a configuration error.Make the test pass as quickly and simply as possible.
Improve the code structure while maintaining the "Green" state.
You are strictly forbidden from writing a large "splurge" of multiple tests at once. You must follow a strictly incremental loop:
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.
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.
Step 1: Red
// 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
// math.ts
export const add = (a: any, b: any) => {
return 4; // Passes: Minimal code to satisfy the test
};
Step 3: Refactor
// 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
};