tdd

Guide TypeScript development with a Vitest-based RED-GREEN-REFACTOR TDD cycle.

Updated Feb 6, 2026
One-click install
npx skills add https://github.com/vgeshel/template-typescript --skill tdd-vgeshel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/vgeshel/template-typescript/tree/main/.claude/skills/tdd
Command: npx skills add https://github.com/vgeshel/template-typescript --skill tdd-vgeshel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Structured guidance for implementing features and bug fixes using test-driven development with Vitest, ensuring robust test coverage and high-quality code from the outset.

Core Features & Use Cases

  • Red-Green-Refactor workflow: a repeatable cycle that transforms failures into passing tests and cleaner code.
  • Test file conventions: clear guidance on placing tests next to source files and using Vitest features for reliable validation.
  • Use Case: when starting a new feature or addressing a bug, follow the TDD cycle to prove behavior before implementing it.

Quick Start

Run a failing test for the target feature, then implement the minimal code to make it pass and finally refactor while preserving test success.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I start test-driven development in TypeScript using Vitest?

To start test-driven development with Vitest, run a failing test for the target feature, implement the minimal code to make it pass, and then refactor while preserving test success. This structured cycle ensures robust coverage from the outset.

What is the Red-Green-Refactor workflow in TDD?

The Red-Green-Refactor workflow is a repeatable TDD cycle that transforms failing tests into passing tests and cleaner code. You write a failing test, implement minimal code to pass it, and refactor the implementation while maintaining green test status.

How should I structure Vitest test files in a TypeScript project?

Vitest test files should be placed directly next to your source files in a TypeScript project. Following these test file layout conventions alongside Vitest features standardizes validation and improves test reliability across your codebase.

Can I use Vitest to achieve 100% test coverage when fixing bugs?

Yes, you can use Vitest to achieve 100% test coverage when fixing bugs by applying the structured TDD cycle. Prove the expected behavior with a failing test first, then implement the fix to turn it green, ensuring no coverage gaps remain.

When should I follow the TDD cycle for feature implementation?

You should follow the TDD cycle when starting a new feature, addressing a bug, expanding a test suite, or addressing coverage gaps in TypeScript projects. It proves behavior before implementation, ensuring high-quality code from the outset.

Does test-driven development with Vitest work for expanding existing test suites?

Yes, test-driven development with Vitest works for expanding existing test suites by providing templates and standardized examples. It addresses coverage gaps systematically through the repeatable RED-GREEN-REFACTOR cycle to validate new behaviors.