tdd-workflow

Enforces test-driven development with RED-GREEN-REFACTOR cycles and 80% coverage thresholds.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill tdd-workflow-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd-workflow
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/tdd-workflow
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill tdd-workflow-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams often skip writing tests or write them after implementation, leading to fragile code, regressions, and low confidence during refactoring. This Skill enforces a disciplined test-first workflow so every feature, bug fix, or refactor is backed by unit, integration, and E2E tests before production code changes. ## Core Features & Use Cases - RED-GREEN-REFACTOR Gates: Requires a verified failing test (runtime or compile-time RED) before any production code is modified, then validates GREEN before refactoring. - Git Checkpoint Commits: Creates stage-specific commits on the active branch for failing tests, fixes, and refactors, with reachability verification from HEAD. - Multi-Level Test Patterns: Provides ready-to-use Jest/Vitest unit test, API integration test, and Playwright E2E patterns, plus mocking templates for Supabase, Redis, and OpenAI. - Use Case: When adding a new API endpoint, the Skill guides you to write user journeys, generate failing test cases, commit the RED checkpoint, implement the minimal fix, confirm GREEN, refactor, and verify 80%+ coverage. ## Quick Start Ask the AI to implement a new feature or fix a bug using the tdd-workflow skill so tests are written first and coverage is verified.

Frequently Asked Questions about tdd-workflow

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

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

Write user journeys first, generate test cases with Jest or Vitest, run them to confirm they fail, then implement minimal code to make them pass. After tests pass, refactor while keeping them green and verify at least 80% coverage.

What test types should I write for a new feature?▼

Write unit tests for individual functions and component logic, integration tests for API endpoints and database operations, and Playwright E2E tests for critical user flows. All three levels together should reach the 80% coverage threshold.

How do I mock Supabase, Redis, or OpenAI in Jest tests?▼

Use jest.mock to replace the service module with stubbed functions returning resolved promises. For example, mock generateEmbedding to return a fixed 1536-dimension array and mock Redis vector search to return predefined similarity scores.

Does a written but unexecuted test count as the RED phase?▼

No. A valid RED state requires the test to compile and execute with a failure caused by the intended bug or missing implementation. Compile-time failures count only when the new test exercises the buggy code path directly.

Why do my E2E tests break after UI changes?▼

Tests break when they rely on brittle CSS class selectors instead of semantic locators. Use role-based selectors, text matchers like button:has-text, or data-testid attributes, which remain stable across styling changes.

When should Git checkpoint commits be created in TDD?▼

Create one commit after the failing test is validated as RED, one after the fix passes as GREEN, and an optional one after refactoring. Each commit must be reachable from the current HEAD on the active branch for the current task.