Skip to content

datit309/supergraph / plugins/supergraph/skills/tdd

Strict test-driven development for behavior changes. Requires verified RED before production code, minimal GREEN, and refactor only after passing tests.

FileKindSize
SKILL.mdskill md4.8 KB
writing-good-tests.mdmarkdown1.4 KB

writing-good-tests.md

View on GitHub
# Writing Good Tests

Use this guide when designing the RED test. The test should be able to fail for the behavior it claims to protect, not merely prove that a line, mock, or fixture exists.

## Falsifiability checklist

- Name the behavior that must break if the implementation regresses.
- Use independent expected values. Do not calculate the expected answer with the same helper or algorithm as production code.
- Prefer behavior over implementation text: assert observable output, state, files, exit status, or protocol payloads when feasible.
- Choose the mock level deliberately. Mock only an external, slow, flaky, or nondeterministic boundary; keep the behavior under test real.
- Apply a mutation check: temporarily remove or alter the relevant production behavior and confirm the test turns RED.

## Strong fixture shape

Keep fixtures small and name the reason each input exists. Include at least one input that distinguishes the intended behavior from a plausible but wrong implementation. For shell workflows, assert both stdout/artifacts and failure behavior for invalid input.

## Review questions

1. What exact break does this test detect?
2. Could a hard-coded or change-detector implementation pass it?
3. Are expected values independent from production logic?
4. Does the mock hide the integration boundary that matters?
5. Which one-line mutation should make the test fail?
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall