// Systematic code review workflow using zen mcp's codex tool. Use this skill when the user explicitly requests "use codex to check the code", "check if the recently generated code has any issues", or "check the code after each generation". The skill performs iterative review cycles - checking code quality, presenting issues to the user for approval, applying fixes, and re-checking until no issues remain or maximum iterations (5) are reached.
| name | codex-code-reviewer |
| description | Systematic code review workflow using zen mcp's codex tool. Use this skill when the user explicitly requests "use codex to check the code", "check if the recently generated code has any issues", or "check the code after each generation". The skill performs iterative review cycles - checking code quality, presenting issues to the user for approval, applying fixes, and re-checking until no issues remain or maximum iterations (5) are reached. |
This skill provides a systematic, iterative code review workflow powered by zen mcp's codex tool. It automatically checks recently modified code files against project standards (CLAUDE.md requirements), presents identified issues to users for approval, applies fixes, and re-validates until code quality standards are met or the maximum iteration limit is reached.
Operation Modes:
Trigger this skill when the user says:
Before starting the review cycle:
[AUTOMATION_MODE: true/false], true → auto-fix / false → ask user1a. Read Coverage Target from Context (coverage_target - READ FROM SSOT):
[COVERAGE_TARGET: X%], validate coverage (≥ target pass, < 70% reject)Identify Files to Review:
git status or similar to identify recently modified filesInitialize iteration counter: current_iteration = 1
Set maximum iterations: max_iterations = 5
Initialize review tool tracker: first_review_done = false
Detect Review Context:
Execute the following loop until termination conditions are met:
Tool Selection Logic:
if current_iteration == 1 and not first_review_done:
# First review: Use mcp__zen__codereview
review_tool = "mcp__zen__codereview"
first_review_done = True
else:
# Second and subsequent reviews: Use mcp__zen__clink with codex CLI
review_tool = "mcp__zen__clink"
A) First Review: Call mcp__zen__codereview
Tool: mcp__zen__codereview
Parameters:
- step: Detailed review request (e.g., "Review the following files for code quality, security, performance, and adherence to project standards...")
- step_number: current_iteration
- total_steps: Estimate based on findings (start with 2-3)
- next_step_required: true (initially)
- findings: Document all discovered issues
- relevant_files: [list of recently modified file paths - MUST be absolute full paths]
- review_type: "full" (covers quality, security, performance, architecture)
- model: "codex" (or user-specified model)
- review_validation_type: "external" (for expert validation)
- confidence: Start with "exploring", increase as understanding grows
Important: Use absolute full paths; follow zen mcp's codereview workflow (2-3 steps); reference references/quality_standards/README.md (on-demand loading)
B) Second and Subsequent Reviews: Call mcp__zen__clink with codex CLI
Tool: mcp__zen__clink
Parameters:
- prompt: "Review files for: 1) Code quality 2) Security 3) Performance 4) Architecture 5) Documentation. Categorize by severity (critical/high/medium/low), provide file:line locations and fix recommendations."
- cli_name: "codex"
- role: "code_reviewer"
- files: [absolute full paths]
- continuation_id: [optional, for context continuity]
Important: Use absolute full paths for files; use continuation_id for context continuity; supported params: prompt, cli_name, role, files, images, continuation_id
After codex returns the review results:
Summarize Issues Clearly:
Decision Making Based on automation_mode (READ FROM CONTEXT):
[AUTOMATION_MODE: false] → Interactive: Ask user approval[AUTOMATION_MODE: true] → Automated: Auto-fix Critical/High, conditional Medium, auto-fix Low style issues[Automated Decision Record] fragments for auto_log.md (collected by router, generated by simple-gemini)Interactive Mode: If user approves Automation Mode: Proceed directly based on auto-decision logic
Automation Mode Transparency:
skills/shared/auto_log_template.md[Automated Fix Record]
Fixed: 3 critical, 2 medium, 1 low | Skipped: 1 medium (business logic)
1. SQL injection (critical) → Fixed | 2. N+1 query (medium) → Fixed
3. Variable naming (low) → Fixed | 4. Logic optimization (medium) → Skipped
current_iteration = current_iteration + 1
Check termination conditions:
Standard Review Mode:
Final Validation Mode (Project Completion/Final Verification):
When the cycle terminates, provide a final report:
Code Review Completion Report:
Review rounds: X / 5
Reviewed files: [list files]
Tools used:
- Round 1: mcp__zen__codereview (codex workflow validation)
- Round 2: mcp__zen__clink (codex CLI direct analysis)
- Round 3+: mcp__zen__clink (continued)
Final status:
- All issues fixed / Max reviews reached / User cancelled
- [Final Validation Mode] Completed minimum 2 passes / Did not meet minimum 2 pass requirement
Fix summary:
- Fixed issues: X
- Remaining issues: Y (if any)
Recommendations: [next steps]
This skill enforces standards defined in:
Key quality dimensions checked:
Test Coverage Standards (G9 Compliance):
See references/quality_standards/README.md for on-demand quality standards (load specific files as needed).
mcp__zen__codereview fails, report to user and offer manual reviewQuality standards index and on-demand loading guide. Load this reference when:
Then load specific standard files as needed:
global_rules.md - G1-G8 全局规则core_principles.md - 核心开发原则p3_constraints_and_quality.md - P3执行约束commit_and_quality_gates.md - Conventional Commits规范error_handling_and_usage.md - P4错误处理Use grep patterns to search: G1|G2|core principles|ethics|reproducible
User: "Use codex to check the code"
Workflow:
[AUTOMATION_MODE: false] → Interactive modemcp__zen__codereview): Found 3 issues (1 critical, 1 medium, 1 low)mcp__zen__clink): No new issuesUser Initial Request: "Full automation, help me develop login functionality, automatically check quality after code completion"
Main Router: Detects "full automation" → Sets automation_mode = true
After code generation, Main Claude invokes codex-code-reviewer with automation_mode = true:
Assistant:
Alright, I will use codex to systematically review the just-generated code.
First, let me identify recently modified files...
[Running git status]
Found the following modified files:
- src/auth/login.py
- src/auth/session.py
- tests/test_login.py
Reading context: [AUTOMATION_MODE: true]
Mode: Full automation review (automatically select and apply fixes)
Starting round 1 review...
[Calling mcp__zen__codereview]
Review results:
Found 5 issues:
[Critical] src/auth/login.py:45 - SQL injection risk (critical)
[Critical] src/auth/session.py:23 - Plaintext password storage (critical)
[Medium] src/auth/login.py:78 - Missing exception handling (medium)
[Medium] src/auth/session.py:56 - Performance issue: N+1 query (medium)
[Low] tests/test_login.py:12 - Non-standard test naming (low)
[Full Automation Mode] Auto-decision + fixes applied:
[Automated Fix Record] Fixed: 2 critical, 2 medium, 1 low
1. SQL injection (critical) → Fixed with parameterized queries
2. Plaintext password (critical) → Fixed with bcrypt encryption
3. Exception handling (medium) → Fixed with try-except blocks
4. N+1 query (medium) → Fixed with select_related optimization
5. Test naming (low) → Fixed by renaming to standard convention
Fixes completed. Starting round 2 review...
[Calling mcp__zen__clink with codex CLI]
Review results: No new issues found
Code review complete!
Review rounds: 2 / 5
Tools used:
- Round 1: mcp__zen__codereview
- Round 2: mcp__zen__clink (codex CLI)
Full automation mode: Auto-fixed 5 issues, skipped 0 issues
All issues successfully fixed without user intervention.
Key Differences: No user approval, auto-decision by severity/safety, transparent logging with rationale, same quality standards
User: "Project is complete, please perform final quality verification"
Workflow:
mcp__zen__codereview): Found 2 issues (1 medium, 1 low)mcp__zen__clink with codex CLI): No new issuesKey Features: Mandatory 2+ passes (codereview + clink), early exit prevention, comprehensive validation before release
mcp__zen__codereview, iteration 2+ uses mcp__zen__clink with codex CLI[Automated Decision Record] fragments when automation_mode=true