tdd-red-green-refactor

Enforces a Red-Green-Refactor TDD workflow for TypeScript and Node.js development.

Updated May 22, 2026
One-click install
npx skills add https://github.com/Asygnuz-S-A-S/one-star --skill tdd-red-green-refactor-asygnuz-s-a-s
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd-red-green-refactor
Source: https://github.com/Asygnuz-S-A-S/one-star/tree/main/.agents/skills/tdd
Command: npx skills add https://github.com/Asygnuz-S-A-S/one-star --skill tdd-red-green-refactor-asygnuz-s-a-s

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI-assisted coding often produces large, unverified code blocks that are hard to trust and debug. This Skill enforces a disciplined Test-Driven Development cycle so every feature, bug fix, or migration is backed by a failing test first, a minimal passing implementation, and a safe refactoring step. ## Core Features & Use Cases - Three-Phase Cycle: Guides the AI through Red (write one failing test), Green (write the minimal code to pass), and Refactor (clean up while tests stay green). - Incremental Discipline: Forbids writing multiple tests at once, requiring a strict one-test-at-a-time loop for every sub-feature. - Integrity Rules: Prevents modifying existing tests just to make weak implementations pass, using TypeScript typing and assertions as backpressure against low-quality code. - Use Case: When adding a new utility function in a Vitest-based TypeScript project, the Skill ensures the AI writes a failing test first, proves the failure, implements the minimal fix, and only then refactors with type safety. ## Quick Start Use the TDD skill to implement the new checkout discount function in TypeScript, writing one failing Vitest test at a time before each implementation step.

Frequently Asked Questions about tdd-red-green-refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply test-driven development in TypeScript projects?▼

Follow the Red-Green-Refactor cycle: write one failing test in Vitest or Jest, implement the minimal code to make it pass, then refactor while keeping all tests green. Repeat this loop for each small piece of behavior.

How to write a failing test before implementation in Vitest?▼

Import the not-yet-existing function in your test file and assert the expected behavior, for example expect(add(2, 2)).toBe(4). Running the test produces a ReferenceError, confirming the failure comes from missing logic rather than a configuration problem.

Does this TDD workflow work with Jest as well as Vitest?▼

Yes, the Red-Green-Refactor cycle is test-runner agnostic and works with both Vitest and Jest in TypeScript and Node.js projects. The skill documentation explicitly references both frameworks for the test phase.

Why should I avoid writing multiple tests at once in TDD?▼

Writing many tests at once, called horizontal splurging, removes the feedback loop that validates each small behavior incrementally. The one-test-at-a-time loop ensures every line of implementation is directly justified by a failing test.

When should I modify an existing test during refactoring?▼

Only modify an existing test when the underlying requirement has changed, never to make a difficult implementation pass. Changing tests to accommodate weak code destroys the safety net that makes refactoring safe.