test-driven-development

Enforces test-first development using the red-green-refactor cycle for features and bugfixes.

2|Updated Mar 7, 2025
One-click install
npx skills add https://github.com/AbdelrhmanUZaki/KnowledgeNuggets --skill test-driven-development-abdelrhmanuzaki
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/AbdelrhmanUZaki/KnowledgeNuggets/tree/main/2-setup/shared/gemini/config/skills/test-driven-development
Command: npx skills add https://github.com/AbdelrhmanUZaki/KnowledgeNuggets --skill test-driven-development-abdelrhmanuzaki

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It prevents untested production code by requiring a failing test before any implementation, eliminating the false confidence of tests written after the fact. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Guides writing a failing test, verifying the failure, writing minimal passing code, and refactoring safely. - Rationalization Detection: Lists common excuses for skipping TDD and explains why each one undermines code quality. - Use Case: When fixing a bug where an empty email is accepted, write a failing test asserting the rejection message, watch it fail, then implement the minimal validation to make it pass. ## Quick Start Use test-driven development to implement this feature by writing a failing test first, then the minimal code to pass it.

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 on a new feature?▼

Write one minimal failing test describing the desired behavior, run it to confirm it fails for the right reason, then write the simplest code to pass. Refactor only after all tests are green, then repeat for the next behavior.

How do I fix a bug using TDD?▼

Write a failing test that reproduces the bug first, then implement the minimal fix until the test passes. This proves the fix works and creates a regression test preventing the bug from returning.

Why must the test fail before writing implementation code?▼

A test that passes immediately proves nothing—it may test the wrong thing or existing behavior. Watching it fail confirms the test actually exercises the missing feature and would catch regressions.

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

Exceptions include throwaway prototypes, generated code, and configuration files, and only with explicit approval. Exploratory code is fine, but it should be discarded and rewritten test-first.

What should I do if a test is too complicated to write?▼

A hard-to-write test signals a complicated design. Simplify the interface, use dependency injection to reduce mocking, and extract helpers for large setup code rather than abandoning the test.