test-driven-development

Enforces red-green-refactor test-first workflow for features and bugfixes.

1|Updated Jul 18, 2025
One-click install
npx skills add https://github.com/gusgad/service-agent-by-sap --skill test-driven-development-gusgad
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/gusgad/service-agent-by-sap/tree/main/.agents/skills/superpowers/test-driven-development
Command: npx skills add https://github.com/gusgad/service-agent-by-sap --skill test-driven-development-gusgad

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code written before tests often ships untested or with tests that never actually verified the behavior. This Skill enforces a strict test-first discipline so every feature and bugfix is backed by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing one minimal failing test, verifying it fails for the right reason, then writing the simplest passing code. - Rationalization Detection: Lists common excuses for skipping TDD and red flags that signal the workflow has been violated. - Framework Examples: Provides concrete Jest examples for TypeScript packages and notes the equivalent cycle for Angular with Jasmine/Karma. - Use Case: When fixing a bug in an existing service, write a failing regression test that reproduces the bug first, then apply the fix and confirm the full suite passes. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then the minimal code to make it pass.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development step by step?▼

Follow the red-green-refactor cycle: write one minimal failing test, run it to confirm it fails for the expected reason, write the simplest code that passes, then refactor while keeping tests green. Repeat for each new behavior.

How do I write a failing test before implementation in Jest?▼

Write a test asserting the desired behavior against code that does not exist yet, then run it with npm test to confirm it fails. The failure must be due to the missing feature, not a typo or setup error, before you implement.

When is it acceptable to skip test-driven development?▼

Exceptions include throwaway prototypes, generated code, and pure configuration files, and these should be confirmed with the user first. New features, bug fixes, refactoring, and behavior changes should always follow the test-first cycle.

Does test-driven development work with Angular and Jasmine?▼

Yes, the same red-green-refactor cycle applies to Angular projects using Jasmine and Karma. Run tests with ng test or the CI test script instead of npm test, keeping the same verify-fail-then-implement discipline.

Why did my new test pass on the first run?▼

A test passing immediately means it is testing existing behavior or is not exercising the new code path. Fix the test so it fails for the right reason before writing any implementation code.

What should I do if I already wrote code before the test?▼

Delete the implementation and start over from a failing test rather than adapting the existing code. Writing tests around finished code proves nothing because you never watched them catch the missing behavior.