tdd-workflow

Enforces test-driven development with Jest and 80% coverage for features, bugs, and refactors.

Updated May 2, 2024
One-click install
npx skills add https://github.com/cman131/EatSomethingSourWhenYoureTired --skill tdd-workflow-cman131
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdd-workflow
Source: https://github.com/cman131/EatSomethingSourWhenYoureTired/tree/main/.claude/skills/tdd-workflow
Command: npx skills add https://github.com/cman131/EatSomethingSourWhenYoureTired --skill tdd-workflow-cman131

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write code first and tests later (or never), leading to regressions, untested edge cases, and low confidence when refactoring. This Skill enforces a strict test-first workflow so every feature, bug fix, or refactor ships with meaningful Jest tests and at least 80% line coverage on changed code. ## Core Features & Use Cases - Structured TDD Workflow: Guides you through acceptance criteria, failing tests, minimal implementation, refactoring, coverage verification, and a clean build. - Test Quality Rules: Prevents common anti-patterns like self-testing tests, trivial assertions, wildcard mock matchers, and duplicate tests that should be parameterized. - Testability Guidance: Shows how to structure services, repositories, and controllers so business logic is directly testable without heavy framework plumbing. - Use Case: When adding a new API endpoint to the mahjong game service, the Skill walks you through writing failing Jest tests for the service method first, implementing the minimal code, verifying mock interactions, and confirming 80%+ coverage before building. ## Quick Start Ask the AI to implement a new feature or fix a bug using the tdd-workflow skill so tests are written before any production code.

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 with Jest?▼

Write failing Jest tests for each acceptance criterion first, then implement the minimal code to make them pass, refactor while keeping tests green, and verify 80%+ line coverage. Finish with a clean build that has zero warnings.

What test coverage should I aim for in a Node.js project?▼

Aim for at least 80% line coverage on changed code, with all edge cases, error scenarios, and boundary conditions tested. Guard clauses, simple accessors, DTOs, and bootstrap files can be excluded from strict coverage analysis.

How do I test private business logic without mocking HTTP pipelines?▼

Give business-logic methods the narrowest visibility that tests can still reach, such as exported helpers or an internal barrel export in TypeScript. Test those methods directly and keep controller or handler tests minimal, covering only their own concerns like error mapping.

When should I use parameterized tests in Jest?▼

Use parameterized tests like it.each whenever multiple tests share the same structure and differ only by input values. This consolidates duplicate tests, such as checking null, empty, and whitespace strings, into a single data-driven test.

Why do my tests pass but fail to catch real bugs?▼

Tests may re-implement production logic instead of calling it, use wildcard mock matchers that hide wrong arguments, or assert only mock calls without checking return values. Mutation testing can empirically measure whether your tests would catch real defects.