Tdd enforcement
Enforces TDD via mechanical hooks with escalating friction. Blocks code writes without failing tests. Detects frontend files and mandates playwright-cli browser tests. Triggered automatically when executing-plans or subagent-driven-development is active.From its SKILL.md
npx -y skills add Mohammed-Rasoul/superpowers-3 --skill tdd-enforcementAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.8 KB, as published. Nobody here has run it
TDD Enforcement
Overview
superpowers-3 enforces TDD mechanically through a PreToolUse hook. The social-pressure approach of upstream superpowers is replaced with escalating friction that cannot be rationalized away.
How It Works
The Hook
A PreToolUse hook fires on every Edit or Write tool call during an active plan. It:
- Checks if the file is source code (not config/markdown)
- Checks if there's an active plan
- Checks if the task has a
NO-TDD:marker - If all pass: enforces the TDD cycle
Escalation
1st code-edit without failing test: Warning emitted. Agent must acknowledge and run the test to see it fail.
2nd code-edit without failing test: 5-item checklist required. Agent must confirm all items before the write proceeds.
The 5-Item Checklist
- Failing test exists in a test file
- Test targets the exact function/component being modified
- Test was run and failed before any implementation code was written
- For browser-testable changes: Browser test was flagged (or override with justification)
- All referenced files/modules have corresponding tests
Browser Testing
When It Applies
Automatic detection fires on frontend/UI file patterns:
**/components/**,**/ui/**,**/*.tsx**/app/**(Next.js App Router)**/pages/**(Next.js Pages Router)**/*.css,**/*.scss
Flagging a Browser Test
In the plan, mark tasks with:
### Task 3: Button component
BROWSER-TEST: playwright-cli open → snapshot → write test → verify RED
Playwright Test Generation
# 1. Open the page
playwright-cli open http://localhost:3000/button-demo
# 2. Take a snapshot to see elements
playwright-cli snapshot
# 3. Interact and collect generated code
playwright-cli click e5
playwright-cli fill e3 "submit"
# 4. Write the test file
# → tests/browser/button.spec.ts
Override with Justification
Same 5-item checklist applies. Item 4 becomes:
- Browser test not applicable (reason: ___)
TDD Exceptions
Category Exemptions
No hook fires for these files:
*.json,*.md,*.yml,*.yaml.gitignore,.env*
NO-TDD Marker
In the plan, add NO-TDD: <reason> after a task. The hook will skip enforcement for that task.
Example:
### Task 5: Update config
NO-TDD: Configuration change, no testable behavior
Integration
- Hook state:
~/.superpowers-3/state.json - Plan files:
~/.superpowers-3/plans/ - State cleared when
finishing-a-development-branchcompletes