home / skills / greyhaven-ai / claude-code-config / tdd-typescript
This skill helps you implement TypeScript features with strict red-green-refactor TDD using Vitest for React components and comprehensive coverage.
npx playbooks add skill greyhaven-ai/claude-code-config --skill tdd-typescriptReview the files below or copy the command above to add this skill to your agents.
---
name: grey-haven-tdd-typescript
description: "TypeScript/JavaScript Test-Driven Development with Vitest, strict red-green-refactor methodology, React component testing, and comprehensive coverage patterns. Use when implementing TypeScript features with TDD, writing Vitest tests, testing React components, developing with test-first approach, or when user mentions 'TypeScript TDD', 'Vitest', 'React testing', 'JavaScript TDD', 'red-green-refactor', 'TypeScript unit tests', or 'test-driven TypeScript'."
# v2.0.43: Skills to auto-load for subagents spawned from this skill
skills:
- grey-haven-code-style
- grey-haven-test-generation
# v2.0.74: Restrict tools available when this skill is active
allowed-tools:
- Read
- Write
- MultiEdit
- Bash
- Grep
- Glob
- TodoWrite
---
# TDD TypeScript Skill
Expert TypeScript/JavaScript TDD implementation using strict red-green-refactor methodology with Vitest testing framework.
## Description
Implement features by writing failing tests first, minimal code to pass, then refactoring. Comprehensive TypeScript/React TDD patterns.
## What's Included
- **Examples**: TDD cycles, React component TDD, utility function TDD
- **Reference**: Red-green-refactor patterns, Vitest best practices
- **Templates**: Test templates, implementation workflows
## Use When
- Implementing TypeScript features with TDD
- React component development
- Ensuring high test coverage
## Related Agents
- `tdd-typescript-implementer`
**Skill Version**: 1.0
This skill teaches strict Test-Driven Development for TypeScript and JavaScript using Vitest and a red-green-refactor workflow. It covers unit testing for utilities and React component testing with patterns and templates that encourage minimal passing implementations and safe refactors. The goal is repeatable TDD cycles that produce robust, well-typed code and high coverage.
I guide you to write failing tests first, implement the smallest change to make tests pass, then refactor while keeping tests green. The skill includes concrete test templates, example cycles, and patterns for TypeScript typing, mocking, and DOM testing for React. It emphasizes Vitest configuration, assertion styles, and coverage instrumentation so tests stay fast and meaningful.
Do I need a specific Vitest version or config?
No strict requirement; use a recent Vitest release and enable TypeScript support and coverage in config. I provide recommended settings and examples.
Can I use this approach for legacy code?
Yes. Start by adding tests around critical behavior, make minimal safe changes, and progressively refactor while keeping tests green.