Ported from oh-my-codex code-review. OMX runtime conventions ($macro invocation, omx CLI, .omx/ state directory) are replaced with WorkBuddy idioms (Skill tool, Agent tool, task list, .workbuddy/memory).
Code Review Skill
Conduct a thorough code review for quality, security, and maintainability with severity-rated feedback.
When to Use
- User requests "review this code", "code review".
- Before merging a pull request.
- After implementing a major feature.
- User wants a quality assessment.
Behavior
- Default to outcome-first reporting: state the target result, evidence, validation status, and stop condition before adding process detail.
- If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the review is grounded; stop once enough evidence exists.
- Continue through clear, low-risk, reversible next steps automatically; ask the user only when the next step is materially branching, destructive, credentialed, external-production, or preference-dependent.
Workflow — Two Parallel Lanes
Delegate to two independent agents via the Agent tool, run in parallel, for a two-lane review:
Identify Changes
- Run
git diff to find changed files.
- Determine scope of review (specific files or entire PR).
Launch Parallel Review Lanes (use the Agent tool, two calls in one message)
- Code-reviewer lane — owns spec compliance, security, code quality, performance, and maintainability findings. Prompt it to act as a senior code reviewer.
- Architect lane — owns the devil's-advocate / design-tradeoff perspective. Prompt it to act as a skeptical architect.
- Both lanes run on a clean context with explicit scope and artifacts, and produce distinct outputs before final synthesis.
- If either lane cannot be launched or does not return evidence, report
independent review unavailable; do not substitute your own authoring lane, and do not approve or mark the review merge-ready.
Review Categories
- Security — hardcoded secrets, injection risks, XSS, CSRF.
- Code Quality — function size, complexity, nesting depth.
- Performance — algorithm efficiency, N+1 queries, caching.
- Best Practices — naming, documentation, error handling.
- Maintainability — duplication, coupling, testability.
Severity Rating
- CRITICAL — security vulnerability (must fix before merge).
- HIGH — bug or major code smell (should fix before merge).
- MEDIUM — minor issue (fix when possible).
- LOW — style/suggestion (consider fixing).
Architectural Status Contract
- CLEAR — no unresolved architectural blocker was found.
- WATCH — non-blocking design/tradeoff concern that must appear in the final synthesis.
- BLOCK — unresolved design concern that prevents a merge-ready verdict.
Specific Recommendations
- File:line locations for each issue.
- Concrete fix suggestions.
- Code examples where applicable.
Final Synthesis
- Combine the code-reviewer recommendation and the architect status into one final verdict.
- Approval requires explicit evidence from both independent lanes; missing or failed delegation is a blocking unavailable-review state, not an approval fallback.
- Deterministic merge gating rules:
- If architect status is BLOCK, final recommendation is REQUEST CHANGES.
- Else if code-reviewer recommendation is REQUEST CHANGES, final recommendation is REQUEST CHANGES.
- Else if architect status is WATCH, final recommendation is COMMENT.
- Else final recommendation follows the code-reviewer lane.
- The final report must make architect blockers impossible to miss.
Agent Delegation
Do not self-review as a fallback. If a lane is missing, unavailable, skipped, or fails, emit a clear unavailable-review result and block approval until independent lane evidence exists.
Spawn the two lanes like this (parallel Agent tool calls):
Agent(code-reviewer lane):
"Act as a senior code reviewer. Review the changes in <git diff / specific files> for
quality, security, and maintainability.
Checklist: OWASP Top 10 security, complexity/duplication, N+1/efficiency, naming/docs/
error handling, coupling/testability.
Output: files reviewed count, issues by severity (CRITICAL/HIGH/MEDIUM/LOW), specific
file:line locations, fix recommendations, and an approval recommendation
(APPROVE / REQUEST CHANGES / COMMENT)."
Agent(architect lane):
"Act as a skeptical architect reviewing the same changes from the architecture/tradeoff
perspective. Focus on system boundaries/interfaces, hidden coupling, long-term
maintainability risks, and the strongest counterargument against approving as-is.
Output: Architectural Status (CLEAR / WATCH / BLOCK), file:line evidence, and a concrete
tradeoff/design recommendation."
Run both lanes in parallel, then synthesize with the deterministic rules above.
Output Format
CODE REVIEW REPORT
==================
Files Reviewed: 8
Total Issues: 12
Architectural Status: WATCH
CRITICAL (0)
-----------
(none)
HIGH (0)
--------
MEDIUM (7)
----------
1. src/api/auth.ts:42
Issue: Email normalization logic is duplicated instead of reusing the shared helper
Risk: Validation rules can drift between authentication paths
Fix: Route both paths through the shared normalization helper
...
LOW (5)
-------
ARCHITECTURE WATCHLIST
----------------------
- src/review/orchestrator.ts:88
Concern: Review result synthesis relies on implicit ordering rather than an explicit blocker contract
Status: WATCH
Recommendation: Define deterministic merge gating before expanding reviewers
SYNTHESIS
---------
- code-reviewer recommendation: COMMENT
- architect status: WATCH
- final recommendation: COMMENT
RECOMMENDATION: COMMENT
Address any WATCH concerns before treating the change as merge-ready.
Review Checklists
Code-reviewer lane:
- Security: no hardcoded secrets; inputs sanitized; SQL/NoSQL injection prevented; XSS escaped; CSRF on state-changing ops; authz enforced.
- Code Quality: functions < 50 lines (guideline); cyclomatic complexity < 10; no nesting > 4 levels; DRY; clear naming.
- Performance: no N+1; appropriate caching; efficient algorithms; no unnecessary re-renders.
- Best Practices: error handling; logging; public-API docs; tests for critical paths; no commented-out code.
Architect lane:
- Boundary/interface changes are explicit.
- New coupling/tradeoff risks are surfaced.
- Long-horizon maintainability concerns are evidence-backed.
- Architectural status is CLEAR / WATCH / BLOCK.
- Any BLOCK cites why merge-ready status should be withheld.
Approval Criteria
- APPROVE — code-reviewer returns APPROVE, architect status is CLEAR, and both independent lanes returned evidence.
- REQUEST CHANGES — code-reviewer returns REQUEST CHANGES, architect status is BLOCK, or required independent review delegation is unavailable/skipped/failed.
- COMMENT — code-reviewer returns COMMENT with architect status CLEAR, architect status is WATCH, or only LOW/MEDIUM improvements remain.
Best Practices
- Review early and often; small frequent reviews beat huge ones.
- Address CRITICAL/HIGH first.
- Consider context — some "issues" may be intentional trade-offs.
- Learn from reviews to improve coding practices.
Note: code-review itself is read-only and does not auto-fix. To fix findings, hand off to execution via the Agent tool or a team skill.
1---2name: code-review3description: Run a comprehensive, severity-rated code review for quality, security, and maintainability, with a deterministic merge-readiness verdict4---56> Ported from oh-my-codex `code-review`. OMX runtime conventions (`$macro` invocation, `omx` CLI, `.omx/` state directory) are replaced with WorkBuddy idioms (Skill tool, Agent tool, task list, `.workbuddy/memory`).78# Code Review Skill910Conduct a thorough code review for quality, security, and maintainability with severity-rated feedback.1112## When to Use1314- User requests "review this code", "code review".15- Before merging a pull request.16- After implementing a major feature.17- User wants a quality assessment.1819## Behavior2021- Default to outcome-first reporting: state the target result, evidence, validation status, and stop condition before adding process detail.22- If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the review is grounded; stop once enough evidence exists.23- Continue through clear, low-risk, reversible next steps automatically; ask the user only when the next step is materially branching, destructive, credentialed, external-production, or preference-dependent.2425## Workflow — Two Parallel Lanes2627Delegate to two independent agents via the **Agent tool**, run in parallel, for a two-lane review:28291. **Identify Changes**30 - Run `git diff` to find changed files.31 - Determine scope of review (specific files or entire PR).32332. **Launch Parallel Review Lanes** (use the Agent tool, two calls in one message)34 - **Code-reviewer lane** — owns spec compliance, security, code quality, performance, and maintainability findings. Prompt it to act as a senior code reviewer.35 - **Architect lane** — owns the devil's-advocate / design-tradeoff perspective. Prompt it to act as a skeptical architect.36 - Both lanes run on a clean context with explicit scope and artifacts, and produce distinct outputs before final synthesis.37 - If either lane cannot be launched or does not return evidence, report `independent review unavailable`; do **not** substitute your own authoring lane, and do **not** approve or mark the review merge-ready.38393. **Review Categories**40 - **Security** — hardcoded secrets, injection risks, XSS, CSRF.41 - **Code Quality** — function size, complexity, nesting depth.42 - **Performance** — algorithm efficiency, N+1 queries, caching.43 - **Best Practices** — naming, documentation, error handling.44 - **Maintainability** — duplication, coupling, testability.45464. **Severity Rating**47 - **CRITICAL** — security vulnerability (must fix before merge).48 - **HIGH** — bug or major code smell (should fix before merge).49 - **MEDIUM** — minor issue (fix when possible).50 - **LOW** — style/suggestion (consider fixing).51525. **Architectural Status Contract**53 - **CLEAR** — no unresolved architectural blocker was found.54 - **WATCH** — non-blocking design/tradeoff concern that must appear in the final synthesis.55 - **BLOCK** — unresolved design concern that prevents a merge-ready verdict.56576. **Specific Recommendations**58 - File:line locations for each issue.59 - Concrete fix suggestions.60 - Code examples where applicable.61627. **Final Synthesis**63 - Combine the code-reviewer recommendation and the architect status into one final verdict.64 - Approval requires explicit evidence from both independent lanes; missing or failed delegation is a blocking unavailable-review state, not an approval fallback.65 - Deterministic merge gating rules:66 - If architect status is **BLOCK**, final recommendation is **REQUEST CHANGES**.67 - Else if code-reviewer recommendation is **REQUEST CHANGES**, final recommendation is **REQUEST CHANGES**.68 - Else if architect status is **WATCH**, final recommendation is **COMMENT**.69 - Else final recommendation follows the code-reviewer lane.70 - The final report must make architect blockers impossible to miss.7172## Agent Delegation7374Do not self-review as a fallback. If a lane is missing, unavailable, skipped, or fails, emit a clear unavailable-review result and block approval until independent lane evidence exists.7576Spawn the two lanes like this (parallel Agent tool calls):7778```79Agent(code-reviewer lane):80 "Act as a senior code reviewer. Review the changes in <git diff / specific files> for81 quality, security, and maintainability.82 Checklist: OWASP Top 10 security, complexity/duplication, N+1/efficiency, naming/docs/83 error handling, coupling/testability.84 Output: files reviewed count, issues by severity (CRITICAL/HIGH/MEDIUM/LOW), specific85 file:line locations, fix recommendations, and an approval recommendation86 (APPROVE / REQUEST CHANGES / COMMENT)."8788Agent(architect lane):89 "Act as a skeptical architect reviewing the same changes from the architecture/tradeoff90 perspective. Focus on system boundaries/interfaces, hidden coupling, long-term91 maintainability risks, and the strongest counterargument against approving as-is.92 Output: Architectural Status (CLEAR / WATCH / BLOCK), file:line evidence, and a concrete93 tradeoff/design recommendation."94```9596Run both lanes in parallel, then synthesize with the deterministic rules above.9798## Output Format99100```101CODE REVIEW REPORT102==================103104Files Reviewed: 8105Total Issues: 12106Architectural Status: WATCH107108CRITICAL (0)109-----------110(none)111112HIGH (0)113--------114115MEDIUM (7)116----------1171. src/api/auth.ts:42118 Issue: Email normalization logic is duplicated instead of reusing the shared helper119 Risk: Validation rules can drift between authentication paths120 Fix: Route both paths through the shared normalization helper121...122123LOW (5)124-------125126ARCHITECTURE WATCHLIST127----------------------128- src/review/orchestrator.ts:88129 Concern: Review result synthesis relies on implicit ordering rather than an explicit blocker contract130 Status: WATCH131 Recommendation: Define deterministic merge gating before expanding reviewers132133SYNTHESIS134---------135- code-reviewer recommendation: COMMENT136- architect status: WATCH137- final recommendation: COMMENT138139RECOMMENDATION: COMMENT140141Address any WATCH concerns before treating the change as merge-ready.142```143144## Review Checklists145146**Code-reviewer lane:**147- Security: no hardcoded secrets; inputs sanitized; SQL/NoSQL injection prevented; XSS escaped; CSRF on state-changing ops; authz enforced.148- Code Quality: functions < 50 lines (guideline); cyclomatic complexity < 10; no nesting > 4 levels; DRY; clear naming.149- Performance: no N+1; appropriate caching; efficient algorithms; no unnecessary re-renders.150- Best Practices: error handling; logging; public-API docs; tests for critical paths; no commented-out code.151152**Architect lane:**153- Boundary/interface changes are explicit.154- New coupling/tradeoff risks are surfaced.155- Long-horizon maintainability concerns are evidence-backed.156- Architectural status is CLEAR / WATCH / BLOCK.157- Any BLOCK cites why merge-ready status should be withheld.158159## Approval Criteria160161- **APPROVE** — code-reviewer returns APPROVE, architect status is CLEAR, and both independent lanes returned evidence.162- **REQUEST CHANGES** — code-reviewer returns REQUEST CHANGES, architect status is BLOCK, or required independent review delegation is unavailable/skipped/failed.163- **COMMENT** — code-reviewer returns COMMENT with architect status CLEAR, architect status is WATCH, or only LOW/MEDIUM improvements remain.164165## Best Practices166167- Review early and often; small frequent reviews beat huge ones.168- Address CRITICAL/HIGH first.169- Consider context — some "issues" may be intentional trade-offs.170- Learn from reviews to improve coding practices.171172> Note: `code-review` itself is read-only and does **not** auto-fix. To fix findings, hand off to execution via the Agent tool or a `team` skill.