skills/rule-of-five-code/SKILL.md
Use when writing 50+ lines of code, implementing features, refactoring, or before claiming code work complete - apply 5 focused passes (Draft, Correctness, Clarity, Edge Cases, Excellence) to catch issues single-shot generation misses
npx skillsauth add schlenks/superpowers-bd rule-of-five-codeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Each pass has ONE job. Re-read the entire artifact through that lens. See references/pass-order-rationale.md for order rationale and convergence details.
Create native tasks for 5 passes with sequential dependencies:
TaskCreate: "Pass 1: Draft"
description: "Shape and structure. Get the outline right. Breadth over depth."
activeForm: "Drafting"
TaskCreate: "Pass 2: Correctness"
description: "Logic, bugs, regressions. Does it work? Did it break anything?"
activeForm: "Checking correctness"
addBlockedBy: [draft-task-id]
TaskCreate: "Pass 3: Clarity"
description: "Comprehension. Can someone unfamiliar understand this? Simplify."
activeForm: "Improving clarity"
addBlockedBy: [correctness-task-id]
TaskCreate: "Pass 4: Edge Cases"
description: "Failure modes. What's missing? What breaks under stress?"
activeForm: "Handling edge cases"
addBlockedBy: [clarity-task-id]
TaskCreate: "Pass 5: Excellence"
description: "Pride. Would you show this to a senior colleague? Polish rough spots."
activeForm: "Polishing"
addBlockedBy: [edge-cases-task-id]
ENFORCEMENT:
status: completedCheck availability: Look for <codex-integration> in the session context (injected by session-start hook). If absent, skip this section entirely.
If present, extract the install path from the tag. Use this as {RESOLVED_CODEX_PATH} — embed it literally in the agent prompt below. No Bash commands needed. Then dispatch:
Agent:
run_in_background: true
description: "Codex cross-model audit (code)"
prompt: |
Run a Codex adversarial review of the current changes.
```bash
node "{RESOLVED_CODEX_PATH}/scripts/codex-companion.mjs" adversarial-review --wait
```
Persist the full output to a timestamped temp file (background agent messages may be truncated):
```bash
mkdir -p temp
AUDIT_TS=$(date +%Y%m%d-%H%M%S)
tee temp/codex-audit-code-${AUDIT_TS}.md <<'CODEX_AUDIT_EOF'
[full codex review output]
CODEX_AUDIT_EOF
```
Output the full review as your final message.
This runs concurrently with all 5 passes — zero blocking. Codex uses auto-detect scope: reviews uncommitted changes if working tree is dirty, or branch diff against default branch if clean (e.g., after SDD implementer commits).
After pass 5 completes, wait for the Codex background agent to finish before presenting results. Do NOT present pass 5 results until the Codex review has either completed or timed out. This is a synchronous gate — the rule-of-five skill does not have a monitor loop or late-delivery mechanism, so all output must be collected before the skill finishes.
_Codex cross-model audit was unavailable for this run._ after pass 5 results## Cross-Model Audit (Codex)
[Full Codex adversarial review output — verdict, findings, recommendations]
For each pass: re-read the full artifact, evaluate through that lens only, make changes, then mark task complete.
Invoke when: >50 lines of code written/modified, new public API/interface/component, complex multi-file refactoring, security-sensitive changes, or about to claim code work "done".
For plans/design docs/skills, use rule-of-five-plans. For tests, use rule-of-five-tests.
Skip for: Single-line fixes, typo corrections, trivial changes under 20 lines.
Announce: "Applying rule-of-five-code to [artifact]. Starting 5-pass review."
| Pass | Focus | Exit when... | |------|-------|--------------| | Draft | Shape and structure. Don't perfect - get the outline right. Breadth over depth. | All major components exist | | Correctness | Logic, bugs, regressions. Does it work? Did it break anything? | No known errors; no regressions | | Clarity | Comprehension. Can someone unfamiliar understand this? Simplify. Cut jargon. | A newcomer could follow it | | Edge Cases | Failure modes. What's missing? What breaks under stress? | Unusual inputs handled | | Excellence | Pride. Would you show this to a senior colleague? Polish the rough spots. | You'd sign your name to it |
| Mistake | Fix | |---------|-----| | Multiple lenses in one pass | ONE lens per pass. Correctness pass ignores style. | | Skipping passes on "simple" artifacts | All 5 or none. Choose a different approach for trivial work. | | Rushing through passes | Each pass: genuinely re-read the full artifact | | Pass finds nothing to change | That's fine. Move on. Not every pass surfaces issues. | | Applying to entire codebase | Artifact = the unit you're changing. A function, component, or document--not the whole system. | | Ignoring consumers when modifying | Grep for usages. Check if callers depend on specific behavior you're changing. |
Shift Correctness pass: "Did I break anything?" matters more than "Does my addition work?"
Correctness checklist for modifications:
See references/modification-checklist.md for interface changes and consumer breakage signs.
references/example-before-after.md: Full before/after code example with findings tablereferences/pass-order-rationale.md: Order rationale, convergence theory, cross-pass issuesreferences/modification-checklist.md: Interface change checklist and consumer breakage signstools
Use when converting a Superpowers-BD implementation plan or Shortcut story into a beads epic with dependency-aware child tasks
development
Use when the user asks for /cr-style review of local changes, commits, a branch diff, or a GitHub PR outside subagent-driven development
development
Use when you have a spec or requirements for a multi-step task, before touching code
tools
Use when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions