.github/skills/workflows-review/SKILL.md
Perform exhaustive code reviews grounded in the user story. Filters technical findings through WHY context to protect purpose while improving quality.
npx skillsauth add the-rabak/compound-engineering-plugin workflows-reviewInstall 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.
[branch name, file path, or empty for current branch]
<command_purpose> Perform exhaustive code reviews using multi-agent analysis, ultra-thinking, and Git worktrees for deep local inspection. Ground every finding in the plan's WHY context (problem narrative, user story, success criteria) so technical improvements never drift from user purpose. </command_purpose>
<role>Senior Code Review Architect and WHY Guardian. Your dual mandate: (1) surface every technical issue that matters, and (2) protect the user story from well-meaning technical drift. You will be bombarded with findings from technically-minded subagents — your job is to distill them through the lens of "does this serve the user's actual need?" A technically superior suggestion that doesn't deliver the user story is a regression, not an improvement.</role>
<review_target> #$ARGUMENTS </review_target>
<thinking> First, I need to determine the review target type and set up the code for analysis. </thinking><task_list>
default_branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
[ -z "$default_branch" ] && default_branch=$(git rev-parse --verify origin/main >/dev/null 2>&1 && echo "main" || echo "master")
git checkout [branch]git diff --name-only ${default_branch}...HEAD
git diff ${default_branch}...HEAD
git log --oneline ${default_branch}..HEAD
Ensure that the code is ready for analysis (either in worktree or on current branch). ONLY then proceed to the next step.
</task_list>
Step 1: Find the plan file. Check these locations in order:
# Check commit messages for plan references
git log --oneline ${default_branch}..HEAD | grep -i "plan\|docs/plans"
# Check for execution session that references a plan
ls docs/execution-sessions/work-*/state.md 2>/dev/null
#check for recent plan files
ls -t docs/plans/*-plan*.md 2>/dev/null | head -5
# Check for architecture files
ls -t docs/architecture/*.md 2>/dev/null | head -5
# Check for readme files
ls -t README.md 2>/dev/null | head -5
If a plan file is found, read it and extract:
ALWAYS READ ARCHITECTURE AND README FILES FOR CONTEXT — they often contain critical information about architectural intent, constraints, and domain knowledge that is not in the plan.
If a STATE.md execution session exists, also read its WHY Context section.
Step 2: If no plan exists, construct minimal WHY from available signals:
Step 3: Summarize the WHY context that will be passed to every agent:
WHY CONTEXT FOR REVIEWERS:
- Problem: [problem narrative]
- User Story: [user story]
- Success Criteria: [list]
- Architectural Intent: [arch context summary]
This context is passed to EVERY review agent below. It is not optional.
<protected_artifacts> The following paths are compound-engineering pipeline artifacts and must never be flagged for deletion, removal, or gitignore by any review agent:
docs/plans/*.md — Plan files created by /workflows-plan. These are living documents that track implementation progress (checkboxes are checked off by /workflows-work).docs/solutions/*.md — Solution documents created during the pipeline.If a review agent flags any file in these directories for cleanup or removal, discard that finding during synthesis. Do not create a todo for it. </protected_artifacts>
Read compound-engineering.local.md in the project root. If found, use review_agents from YAML frontmatter. If the markdown body contains review context, pass it to each agent as additional instructions.
If no settings file exists, invoke the setup skill to create one. Then read the newly created file and continue.
<parallel_tasks>
Run all configured review agents in parallel using Task tool. For each agent in the review_agents list:
Task {agent-name}(branch diff content + review context from settings body + WHY context block)
Every agent prompt MUST include the WHY context block from the step above. This ensures agents evaluate fitness-for-purpose, not just technical quality. Example:
Task security-sentinel: "Review this branch diff for security issues.
WHY CONTEXT FOR REVIEWERS:
- Problem: [problem narrative]
- User Story: [user story]
- Success Criteria: [criteria list]
- Architectural Intent: [arch context]
When reporting findings, note whether each finding:
(a) THREATENS the user story or success criteria (highest priority)
(b) Is a general security concern independent of the user story
(c) Would require changes that ALTER the user's intended outcome (flag as DRIFT RISK)
Branch diff:
[diff content]"
Additionally, always run these regardless of settings:
</parallel_tasks>
<conditional_agents>
These agents are run ONLY when the branch changes match specific criteria. Check the changed files list to determine if they apply. Pass the WHY context block to all conditional agents as well.
MIGRATIONS: If PR contains database migrations or data backfills:
When to run:
database/migrations/*.phpWhat these agents check:
data-integrity-guardian: Reviews migration safety, project conventions (separate files for table/indexes/FKs, constraint naming with unq_/fk_/idx_ prefixes)data-migration-expert: Verifies hard-coded mappings match production reality (prevents swapped IDs), checks for orphaned associations, validates dual-write patternsdeployment-verification-agent: Produces executable pre/post-deploy checklists with SQL queries, rollback procedures, Horizon monitoring plans</conditional_agents>
<ultrathink_instruction> For each phase below, spend maximum cognitive effort. Think step by step. Consider all angles. Question assumptions. And bring all reviews in a synthesis to the user.</ultrathink_instruction>
<deliverable> Complete system context map with component interactions </deliverable><thinking_prompt> ULTRA-THINK: Put yourself in each stakeholder's shoes. Use the WHY context to ground each perspective in the ACTUAL problem being solved, not generic questions. </thinking_prompt>
<stakeholder_perspectives>
The User from the User Story <questions>
Using the actual user story extracted above:
Developer Perspective <questions>
Operations Perspective <questions>
Security Team Perspective <questions>
Business Perspective <questions>
<thinking_prompt> ULTRA-THINK: Explore edge cases and failure scenarios. What could go wrong? How does the system behave under stress? </thinking_prompt>
<scenario_checklist>
Run the Task code-simplicity-reviewer() to see if we can simplify the code.
<critical_requirement> ALL findings MUST be stored in the todos/ directory using the file-todos skill. Create todo files immediately after synthesis - do NOT present findings for user approval first. Use the skill for structured todo management. </critical_requirement>
<synthesis_tasks>
docs/plans/ or docs/solutions/ (see Protected Artifacts above)WHY-grounded classification (apply to EVERY finding before severity):
For each finding, ask: "If we act on this finding, what happens to the user story?"
🎯 PROTECTS USER STORY — Finding addresses something that could prevent the user from achieving the stated outcome. (e.g., security hole in the auth flow when the user story is about secure login). These get elevated priority.
⚠️ DRIFT RISK — Finding suggests a change that is technically valid but would ALTER the user's intended outcome or expand scope beyond the user story. (e.g., "refactor to microservices" when the plan says monolith, or "add OAuth support" when the story only mentions password login). These must be flagged prominently and NEVER auto-applied. Present to user with: "This suggestion is technically sound but would change what the feature delivers."
🔧 QUALITY IMPROVEMENT — Finding improves code quality without affecting the user story positively or negatively. Standard review finding. Keep severity as-is.
📦 SCOPE EXPANSION — Finding suggests adding functionality not in the user story or success criteria. Automatically downgrade to P3 regardless of agent-assigned severity, and tag as "Beyond current scope."
[ ] Categorize by type: security, performance, architecture, quality, etc.
[ ] Assign severity levels: 🔴 CRITICAL (P1), 🟡 IMPORTANT (P2), 🔵 NICE-TO-HAVE (P3)
[ ] Remove duplicate or overlapping findings
[ ] Estimate effort for each finding (Small/Medium/Large)
[ ] User Story Delivery Assessment: After classifying all findings, state:
</synthesis_tasks>
<critical_instruction> Use the file-todos skill to create todo files for ALL findings immediately. Do NOT present findings one-by-one asking for user approval. Create all todo files in parallel using the skill, then summarize results to user. </critical_instruction>
Implementation Options:
Option A: Direct File Creation (Fast)
.github/skills/file-todos/assets/todo-template.md{issue_id}-pending-{priority}-{description}.mdOption B: Sub-Agents in Parallel (Recommended for Scale) For large PRs with 15+ findings, use sub-agents to create finding files in parallel:
# Launch multiple finding-creator agents in parallel
Task() - Create todos for first finding
Task() - Create todos for second finding
Task() - Create todos for third finding
etc. for each finding.
Sub-agents can:
Execution Strategy:
Process (Using file-todos Skill):
For each finding:
Use file-todos skill for structured todo management:
skill: file-todos
The skill provides:
.github/skills/file-todos/assets/todo-template.md{issue_id}-{status}-{priority}-{description}.mdCreate todo files in parallel:
{next_id}-pending-{priority}-{description}.md
Examples:
001-pending-p1-path-traversal-vulnerability.md
002-pending-p1-api-response-validation.md
003-pending-p2-concurrency-limit.md
004-pending-p3-unused-parameter.md
Follow template structure from file-todos skill: .github/skills/file-todos/assets/todo-template.md
Todo File Structure (from template):
Each todo must include:
File naming convention:
{issue_id}-{status}-{priority}-{description}.md
Examples:
- 001-pending-p1-security-vulnerability.md
- 002-pending-p2-performance-optimization.md
- 003-pending-p3-code-cleanup.md
Status values:
pending - New findings, needs triage/decisionready - Approved by manager, ready to workcomplete - Work finishedPriority values:
p1 - Critical (blocks merge, security/data issues)p2 - Important (should fix, architectural/performance)p3 - Nice-to-have (enhancements, cleanup)Tagging: Always add code-review tag, plus: security, performance, architecture, laravel, vue, quality, etc.
After creating all todo files, present comprehensive summary:
## ✅ Code Review Complete
**Review Target:** Branch `[branch-name]` (vs `[default-branch]`)
### User Story Delivery Assessment
**User Story:** [user story from plan]
**Delivery Status:** ✅ DELIVERS / ⚠️ PARTIALLY DELIVERS / ❌ DOES NOT DELIVER
[If PARTIALLY or NO:]
**Gaps:**
- [Success criterion X]: not met because [reason]
- [Success criterion Y]: partially met — [what's missing]
### WHY-Grounded Findings Summary:
- **Total Findings:** [X]
- **🎯 Protects User Story:** [count] — findings that address threats to the user's outcome
- **⚠️ Drift Risk:** [count] — suggestions that would ALTER what the feature delivers (review carefully)
- **🔧 Quality Improvements:** [count] — standard technical improvements
- **📦 Scope Expansion:** [count] — suggestions beyond current user story (consider for future work)
### Severity Breakdown:
- **🔴 CRITICAL (P1):** [count] - BLOCKS MERGE
- **🟡 IMPORTANT (P2):** [count] - Should Fix
- **🔵 NICE-TO-HAVE (P3):** [count] - Enhancements
### Created Todo Files:
**P1 - Critical (BLOCKS MERGE):**
- `001-pending-p1-{finding}.md` - {description}
- `002-pending-p1-{finding}.md` - {description}
**P2 - Important:**
- `003-pending-p2-{finding}.md` - {description}
- `004-pending-p2-{finding}.md` - {description}
**P3 - Nice-to-Have:**
- `005-pending-p3-{finding}.md` - {description}
### Review Agents Used:
- rabak-laravel-reviewer
- rabak-vue-reviewer
- security-sentinel
- performance-oracle
- architecture-strategist
- agent-native-reviewer
- [other agents]
### Next Steps:
1. **Address P1 Findings**: CRITICAL - must be fixed before merge
- Review each P1 todo in detail
- Implement fixes or request exemption
- Verify fixes before merging PR
2. **Review Drift Risk Findings**: These require your decision — they suggest changes that would alter what the feature delivers. Accept, reject, or modify each one.
3. **Triage All Todos**:
```bash
ls todos/*-pending-*.md # View all pending todos
/triage # Use slash command for interactive triage
```
Work on Approved Todos:
/resolve_todo_parallel # Fix all approved items efficiently
Track Progress:
git add todos/ && git commit -m "refactor: add code review findings"
### 7. End-to-End Testing (Optional)
<offer_testing>
After presenting the Summary Report, offer browser testing:
```markdown
**"Want to run browser tests on the affected pages?"**
1. Yes - run `/test-browser`
2. No - skip
</offer_testing>
Spawn a subagent to run browser tests (preserves main context):
Use the general-purpose skill to: "Run /test-browser for the current branch. Test all affected pages, check for console errors, handle failures by creating todos and fixing."
The subagent will:
Standalone: /test-browser
Any 🔴 P1 (CRITICAL) findings must be addressed before merging. Additionally, if the User Story Delivery Assessment is ❌ DOES NOT DELIVER, the branch should not be merged regardless of P1 count — the code doesn't solve the stated problem.
Any ⚠️ DRIFT RISK findings must be explicitly reviewed by the user before acting on them. Never auto-resolve drift risk findings — they require a human decision about whether the user story should change.
tools
Package one plan execution packet into a compact ticket-local execution packet with parent refs, scope fences, feature-home ownership, and evidence commands. Use when converting plans into local tickets or when execution needs one ticket-sized context pack without the full plan.
tools
Package one plan execution packet into a compact ticket-local execution packet with parent refs, scope fences, feature-home ownership, and evidence commands. Use when converting plans into local tickets or when execution needs one ticket-sized context pack without the full plan.
testing
Run a deep adversarial review of plans and architecture before implementation. Use when validating strategy docs, contracts, roadmaps, and competitive positioning with scored findings and prioritized recommendations.
testing
Run a deep adversarial review of plans and architecture before implementation. Use when validating strategy docs, contracts, roadmaps, and competitive positioning with scored findings and prioritized recommendations.