home / skills / anthonylee991 / gemini-superpowers-antigravity / superpowers-tdd
This skill enforces test-first TDD discipline for features, bugs, and refactors, adding regression tests and guiding minimal changes.
npx playbooks add skill anthonylee991/gemini-superpowers-antigravity --skill superpowers-tddReview the files below or copy the command above to add this skill to your agents.
---
name: superpowers-tdd
description: Applies tests-first discipline (red/green/refactor) and adds regression tests for bugs. Use when implementing features, fixing bugs, or refactoring.
---
# TDD Skill
## When to use this skill
- new features that can be unit tested
- bug fixes (always add a regression test if practical)
- refactors (protect behavior with tests first)
## Rules
- Prefer **red -> green -> refactor**.
- If tests are hard, still add **verification**: minimal repro script, integration test, or clear manual steps.
- Keep tests focused: one behavior per test where possible.
- Name tests by behavior, not implementation details.
## Process
1. Define the behavior change (what should be true after).
2. Write/adjust a test to capture it (make it fail first if possible).
3. Implement the minimal change to pass.
4. Refactor if needed (keep passing).
5. Run the relevant test suite + any linters.
## Output requirements
When you change code, include:
- what tests you added/changed
- how to run them
- what they prove
This skill enforces a tests-first discipline (red → green → refactor) for Python projects to reduce regressions and make change safer. I guide you to add focused unit tests or minimal verification when full tests are impractical. The goal is predictable, test-protected changes when implementing features, fixing bugs, or refactoring.
I inspect the target change and recommend a concrete test or verification that captures the desired behavior before implementing code. I prioritize small, behavior-driven tests that fail first, then show the minimal implementation to pass them, followed by refactoring while keeping tests green. When unit tests are impossible, I suggest reproducible verification scripts, integration checks, or manual reproduction steps.
What if I can’t write a unit test for the change?
Provide the smallest possible verification: a reproducible script, integration test, or clear manual steps that demonstrate the intended behavior before and after the change.
How should I name tests?
Name tests by the observable behavior or expected outcome, not by internal implementation details.
What must I include when submitting a code change?
List which tests were added or modified, how to run those tests locally, and a brief statement of what the tests prove about the change.