/fw:tddfrom fw
Enforce red-green-refactor for feature work, bug fixes, refactors, and behavior changes.
Ships in fw. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
$fw:tdd is Flywheel's strict helper for behavior-bearing implementation. It
is normally loaded by $fw:work or $fw:debug, not used as a separate visible
lifecycle stage.
Use it to prove one behavior at a time: write a failing test, watch it fail for the expected reason, write the smallest implementation that makes it pass, then refactor while the test stays green.
Do not preload every reference. Load only what the current cycle needs:
references/tests.md when choosing the test shape or repairing tests
that are coupled to implementation details.references/mocking.md when deciding whether a mock is valid or where
the system boundary belongs.references/interface-design.md when the public interface is hard to
test without changing production design.references/deep-modules.md when the current cycle exposes shallow
modules or too much implementation detail in the interface.references/refactoring.md after green when cleanup is warranted.Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; behavior-focused tests should survive that change.
Good tests are integration-style: they exercise real code paths through public APIs. They describe what the system does, not how it does it. A good test reads like a specification: "user can checkout with valid cart" names the capability that exists.
Bad tests are coupled to implementation. They mock internal collaborators, test private methods, assert call counts, or verify behavior by bypassing the public interface. The warning sign is a test that fails after a refactor even though observable behavior did not change.
Do not write all tests first, then all implementation. That is horizontal slicing: treating RED as "write all tests" and GREEN as "write all code."
Horizontal slicing produces weak tests:
Use vertical tracer bullets instead: one test -> one implementation -> repeat. Each test responds to what the previous cycle taught.
WRONG (horizontal):
RED: test1, test2, test3, test4, test5
GREEN: impl1, impl2, impl3, impl4, impl5
RIGHT (vertical):
RED -> GREEN: test1 -> impl1
RED -> GREEN: test2 -> impl2
RED -> GREEN: test3 -> impl3
...
Use this skill before implementation when any of these are true:
Test posture: tddUse a different posture only when the exception is explicit:
Record the exception and the remaining verification path. Do not silently skip TDD for behavior-bearing work.
If implementation code for the current unit was written before the red signal:
Do not use destructive git commands such as git reset --hard or broad
checkout/revert commands for TDD cleanup.
Name the behavior, public contract, bug, or preservation claim under test. Find the nearest existing test idiom before creating a new pattern.
When exploring the codebase, use the project's domain glossary so test names and interface vocabulary match the project's language. Respect ADRs and decision records in the area being changed.
Before RED, make or update a compact behavior/test list:
If the plan already provides Red signal and Green signal, use them unless
repo truth proves a better target. If the plan is silent, choose the narrowest
test or reproducer that can fail before the change and pass after it.
Write one failing test or equivalent executable reproducer.
Run the narrowest useful command and confirm:
If the test passes, the test is not proving the new behavior. Fix the test. If it errors for the wrong reason, fix the test or setup and rerun until it is a valid red signal.
Write the smallest implementation that makes the red signal pass.
Run the same target command until it passes. Do not add adjacent features, cleanup, or abstractions while the target is still red.
Do not anticipate future tests. Future behavior gets its own red signal after the current tracer bullet is green.
Only after GREEN, clean the implementation if cleanup is useful.
Prefer refactors that remove duplication, improve names, simplify the public interface, deepen a module behind a small interface, or move external-system complexity behind an explicit boundary. Never refactor while red.
Rerun the target command after each meaningful refactor step. Run broader relevant checks when the unit is complete or the changed surface warrants it.
After the current tracer bullet is green and refactored:
End the unit with a compact evidence block:
TDD evidence
- Red: <command> -> <expected failure>
- Green: <command> -> pass
- Refactor: <command> -> pass, or no refactor
- Broader checks: <commands/results or n/a>
- Output summary: <optional 1-6 lines of sanitized failure/pass/coverage output>
Use Output summary when the raw command output helps later review or commit
understand the proof. Keep it condensed: include the failing assertion or error
shape for RED, the pass count for GREEN, and coverage or report deltas only
when they are material. Do not paste full logs, stack traces, secrets, tokens,
cookies, PII, or unrelated warnings.
If an exception was used, report:
TDD exception
- Reason: <generated/config/docs/mechanical/prototype/etc.>
- Verification: <how completion was still proven>
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub mopeyjellyfish/flywheel --plugin flywheel32 skills in this plugin
/architecture-strategyAssess repo-grounded architecture choices and improvements. Use for boundaries, service splits, dependency direction, or distributed posture./brainstormExplore requirements and approaches. Use for a fuzzy idea, open scope, or one direction that needs sharper behavior before planning./browser-testRun browser acceptance checks with playwright-cli. Use when browser-visible behavior needs fresh proof before review or commit./commitFinish a branch cleanly. Use to verify readiness, make logical commits, push, and create or refresh a PR with evidence.