{"enrichment":{"faq":[{"a":"Test-Driven Development's red-green-refactor cycle is the core workflow: first, write a failing test (red phase); second, implement just enough code to pass that test (green phase); third, refactor your code while keeping tests green. This cycle repeats for each feature or change, ensuring tests drive design and catch bugs early.","q":"What is the red-green-refactor cycle in Test-Driven Development?"},{"a":"Test-Driven Development begins by writing a failing test before any implementation. Define what your code should do, write a test that verifies that behavior, watch it fail, then write minimal code to make it pass. This test-first approach forces you to think about requirements upfront and creates a safety net for refactoring.","q":"How do I start with TDD and write tests first?"},{"a":"Test-Driven Development's test-first approach catches design issues early, prevents over-engineering, and ensures every line of code has a test. Writing tests after implementation often leads to incomplete coverage and tests that merely validate existing code rather than driving better design. TDD makes refactoring safer and reduces debugging time.","q":"Why write tests first instead of testing after implementation?"},{"a":"Yes. Test-Driven Development applies directly to bug fixes: write a failing test that reproduces the bug, fix the code to pass it, then refactor. For code changes, write tests for the new behavior first, implement it, and refactor. This workflow ensures bugs stay fixed and changes don't break existing functionality.","q":"Can I apply TDD to bug fixes and code changes?"},{"a":"Test-Driven Development's green phase requires writing only enough code to make the test pass\u2014no extra features, no premature optimization. This constraint forces you to stay focused, prevents scope creep, and makes refactoring the next step. Once tests pass, you improve the code's design without changing its behavior.","q":"What does Test-Driven Development mean by minimal code to pass tests?"},{"a":"Test-Driven Development improves quality by building a comprehensive test suite as you code, catching regressions immediately, and forcing you to think through edge cases. Tests serve as executable documentation and a safety net for refactoring, reducing bugs in production and making code easier to maintain and extend.","q":"How does Test-Driven Development help catch bugs and improve code quality?"}],"shadow_tags":["test-first-methodology","red-green-refactor","behavior-driven-design","quality-assurance-process","automated-verification","code-confidence","regression-prevention","edge-case-discovery","minimal-implementation"],"summary_rewrite":"This skill walks you through the test-first workflow: write a failing test, verify it fails correctly, implement just enough code to pass, then refactor while keeping tests green. You'll learn why test order matters, how to recognize when you're rationalizing shortcuts, and how to apply TDD to features, bug fixes, and refactoring across any language."},"files":[{"bytes":9712,"path":"skills/testing/test-driven-development/SKILL.md","sha256":"228add153b3217dbe851689dc24b6e2ab5459ad0ba152b8a539a03632ccb69cc","url":"https://skillfed.io/files/obra/superpowers-skills/test-driven-development/ac7922a7/SKILL.md"}],"id":"obra/superpowers-skills/test-driven-development","links":{"html":"https://skillfed.io/obra/superpowers-skills/test-driven-development","md":"https://skillfed.io/obra/superpowers-skills/test-driven-development.md","repo":"https://github.com/obra/superpowers-skills"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":163,"language":"TypeScript","last_updated":"2025-10-14","license":"MIT","name":"Test-Driven Development (TDD)","publisher":"obra","stars":733},"relations":{"similar":[{"id":"family3253/skill/superpowers-test-driven-development"},{"id":"jamditis/claude-skills-journalism/test-driven-development"},{"id":"Wide-Moat/open-computer-use/test-driven-development"},{"id":"getcrew44/crew44/test-driven-development"},{"id":"rpamis/comet/test-driven-development"},{"id":"beita6969/ScienceClaw/test-driven-development"},{"id":"bartstc/vite-ts-react-template/test-driven-development"},{"id":"Ibrahim-3d/orchestrator-supaconductor/test-driven-development"},{"id":"ryan-yuuu/crypto-trading-arena/test-driven-development"},{"id":"zernie/vigiles/test-driven-development"}]},"slug":{"owner":"obra","repo":"superpowers-skills","skill":"test-driven-development"},"version":"ac7922a7"}
