review-cycle
1
总安装量
1
周安装量
#47891
全站排名
安装命令
npx skills add https://github.com/catlog22/claude-code-workflow --skill review-cycle
Agent 安装分布
amp
1
opencode
1
kimi-cli
1
codex
1
github-copilot
1
claude-code
1
Skill 文档
Review Cycle
Unified multi-dimensional code review orchestrator with dual-mode (session/module) file discovery, 7-dimension parallel analysis, iterative deep-dive on critical findings, and optional automated fix pipeline with intelligent batching and parallel planning.
Architecture Overview
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Review Cycle Orchestrator (SKILL.md) â
â â Pure coordinator: mode detection, phase dispatch, state tracking â
âââââââââââââââââââââââââââââââââ¬âââââââââââââââââââââââââââââââââââââââ
â
âââââââââââââââââââââââââââââââ¼ââââââââââââââââââââââââââââââââââ
â Review Pipeline (Phase 1-5) â
â â
â âââââââââââ âââââââââââ âââââââââââ âââââââââââ âââââââââââ
â â Phase 1 ââ â Phase 2 ââ â Phase 3 ââ â Phase 4 ââ â Phase 5 â
â âDiscoveryâ âParallel â âAggregateâ âDeep-Diveâ âComplete â
â â Init â â Review â â â â(cond.) â â â
â âââââââââââ âââââââââââ âââââââââââ âââââââââââ âââââââââââ
â session| 7 agents severity N agents finalize
â module Ãcli-explore calc Ãcli-explore state
â â loop
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
(optional --fix)
â
âââââââââââââââââââââââââââââââ¼ââââââââââââââââââââââââââââââââââ
â Fix Pipeline (Phase 6-9) â
â â
â âââââââââââ âââââââââââ âââââââââââ âââââââââââ
â â Phase 6 ââ â Phase 7 ââ â Phase 8 ââ â Phase 9 â
â âDiscoveryâ âParallel â âExecutionâ âComplete â
â âBatching â âPlanning â âOrchestr.â â â
â âââââââââââ âââââââââââ âââââââââââ âââââââââââ
â grouping N agents M agents aggregate
â + batch Ãcli-plan Ãcli-exec + summary
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Key Design Principles
- Dual-Mode Review: Session-based (git changes) and module-based (path patterns) share the same review pipeline (Phase 2-5), differing only in file discovery (Phase 1)
- Pure Orchestrator: Execute phases in sequence, parse outputs, pass context between them
- Progressive Phase Loading: Phase docs are read on-demand when that phase executes, not all at once
- Auto-Continue: All phases run autonomously without user intervention between phases
- Task Attachment Model: Sub-tasks attached/collapsed dynamically in TaskCreate/TaskUpdate
- Optional Fix Pipeline: Phase 6-9 triggered only by explicit
--fixflag or user confirmation after Phase 5 - Content Preservation: All agent prompts, code, schemas preserved verbatim from source commands
Usage
# Review Pipeline (Phase 1-5)
Skill(skill="review-cycle", args="<path-pattern>") # Module mode
Skill(skill="review-cycle", args="[session-id]") # Session mode
Skill(skill="review-cycle", args="[session-id|path-pattern] [FLAGS]") # With flags
# Fix Pipeline (Phase 6-9)
Skill(skill="review-cycle", args="--fix <review-dir|export-file>") # Fix mode
Skill(skill="review-cycle", args="--fix <review-dir> [FLAGS]") # Fix with flags
# Flags
--dimensions=dim1,dim2,... Custom dimensions (default: all 7)
--max-iterations=N Max deep-dive iterations (default: 3)
--fix Enter fix pipeline after review or standalone
--resume Resume interrupted fix session
--batch-size=N Findings per planning batch (default: 5, fix mode only)
# Examples
Skill(skill="review-cycle", args="src/auth/**") # Module: review auth
Skill(skill="review-cycle", args="src/auth/**,src/payment/**") # Module: multiple paths
Skill(skill="review-cycle", args="src/auth/** --dimensions=security,architecture") # Module: custom dims
Skill(skill="review-cycle", args="WFS-payment-integration") # Session: specific
Skill(skill="review-cycle", args="") # Session: auto-detect
Skill(skill="review-cycle", args="--fix .workflow/active/WFS-123/.review/") # Fix: from review dir
Skill(skill="review-cycle", args="--fix --resume") # Fix: resume session
Mode Detection
// Input parsing logic (orchestrator responsibility)
function detectMode(args) {
if (args.includes('--fix')) return 'fix';
if (args.match(/\*|\.ts|\.js|\.py|src\/|lib\//)) return 'module'; // glob/path patterns
if (args.match(/^WFS-/) || args.trim() === '') return 'session'; // session ID or empty
return 'session'; // default
}
| Input Pattern | Detected Mode | Phase Entry |
|---|---|---|
src/auth/** |
module |
Phase 1 (module branch) |
WFS-payment-integration |
session |
Phase 1 (session branch) |
| (empty) | session |
Phase 1 (session branch, auto-detect) |
--fix .review/ |
fix |
Phase 6 |
--fix --resume |
fix |
Phase 6 (resume) |
Execution Flow
Input Parsing:
ââ Detect mode (session|module|fix) â route to appropriate phase entry
Review Pipeline (session or module mode):
Phase 1: Discovery & Initialization
ââ Ref: phases/01-discovery-initialization.md
ââ Session mode: session discovery â git changed files â resolve
ââ Module mode: path patterns â glob expand â resolve
ââ Common: create session, output dirs, review-state.json, review-progress.json
Phase 2: Parallel Review Coordination
ââ Ref: phases/02-parallel-review.md
ââ Launch 7 cli-explore-agent instances (Deep Scan mode)
ââ Each produces dimensions/{dimension}.json + reports/{dimension}-analysis.md
ââ CLI fallback: Gemini â Qwen â Codex
Phase 3: Aggregation
ââ Ref: phases/03-aggregation.md
ââ Load dimension JSONs, calculate severity distribution
ââ Identify cross-cutting concerns (files in 3+ dimensions)
ââ Decision: critical > 0 OR high > 5 OR critical files â Phase 4
Else â Phase 5
Phase 4: Iterative Deep-Dive (conditional)
ââ Ref: phases/04-iterative-deep-dive.md
ââ Select critical findings (max 5 per iteration)
ââ Launch deep-dive agents for root cause analysis
ââ Re-assess severity â loop back to Phase 3 aggregation
ââ Exit when: no critical findings OR max iterations reached
Phase 5: Review Completion
ââ Ref: phases/05-review-completion.md
ââ Finalize review-state.json + review-progress.json
ââ Prompt user: "Run automated fixes? [Y/n]"
ââ If yes â Continue to Phase 6
Fix Pipeline (--fix mode or after Phase 5):
Phase 6: Fix Discovery & Batching
ââ Ref: phases/06-fix-discovery-batching.md
ââ Validate export file, create fix session
ââ Intelligent grouping by file+dimension similarity â batches
Phase 7: Fix Parallel Planning
ââ Ref: phases/07-fix-parallel-planning.md
ââ Launch N cli-planning-agent instances (â¤10 parallel)
ââ Each outputs partial-plan-{batch-id}.json
ââ Orchestrator aggregates â fix-plan.json
Phase 8: Fix Execution
ââ Ref: phases/08-fix-execution.md
ââ Stage-based execution per aggregated timeline
ââ Each group: analyze â fix â test â commit/rollback
ââ 100% test pass rate required
Phase 9: Fix Completion
ââ Ref: phases/09-fix-completion.md
ââ Aggregate results â fix-summary.md
ââ Optional: complete workflow session if all fixes successful
Complete: Review reports + optional fix results
Phase Reference Documents (read on-demand when phase executes):
| Phase | Document | Load When | Source |
|---|---|---|---|
| 1 | phases/01-discovery-initialization.md | Review/Fix start | review-session-cycle + review-module-cycle Phase 1 (fused) |
| 2 | phases/02-parallel-review.md | Phase 1 complete | Shared from both review commands Phase 2 |
| 3 | phases/03-aggregation.md | Phase 2 complete | Shared from both review commands Phase 3 |
| 4 | phases/04-iterative-deep-dive.md | Aggregation triggers iteration | Shared from both review commands Phase 4 |
| 5 | phases/05-review-completion.md | No more iterations needed | Shared from both review commands Phase 5 |
| 6 | phases/06-fix-discovery-batching.md | Fix mode entry | review-cycle-fix Phase 1 + 1.5 |
| 7 | phases/07-fix-parallel-planning.md | Phase 6 complete | review-cycle-fix Phase 2 |
| 8 | phases/08-fix-execution.md | Phase 7 complete | review-cycle-fix Phase 3 |
| 9 | phases/09-fix-completion.md | Phase 8 complete | review-cycle-fix Phase 4 + 5 |
Core Rules
- Start Immediately: First action is TaskCreate initialization, second action is Phase 1 execution
- Mode Detection First: Parse input to determine session/module/fix mode before Phase 1
- Parse Every Output: Extract required data from each phase for next phase
- Auto-Continue: Check TaskList status to execute next pending phase automatically
- Progressive Phase Loading: Read phase docs ONLY when that phase is about to execute
- DO NOT STOP: Continuous multi-phase workflow until all applicable phases complete
- Conditional Phase 4: Only execute if aggregation triggers iteration (critical > 0 OR high > 5 OR critical files)
- Fix Pipeline Optional: Phase 6-9 only execute with explicit –fix flag or user confirmation
Data Flow
User Input (path-pattern | session-id | --fix export-file)
â
[Mode Detection: session | module | fix]
â
Phase 1: Discovery & Initialization
â Output: sessionId, reviewId, resolvedFiles, reviewMode, outputDir
â review-state.json, review-progress.json
Phase 2: Parallel Review Coordination
â Output: dimensions/*.json, reports/*-analysis.md
Phase 3: Aggregation
â Output: severityDistribution, criticalFiles, deepDiveFindings
â Decision: iterate? â Phase 4 : Phase 5
Phase 4: Iterative Deep-Dive (conditional, loops with Phase 3)
â Output: iterations/*.json, reports/deep-dive-*.md
â Loop: re-aggregate â check criteria â iterate or exit
Phase 5: Review Completion
â Output: final review-state.json, review-progress.json
â Decision: fix? â Phase 6 : END
Phase 6: Fix Discovery & Batching
â Output: finding batches (in-memory)
Phase 7: Fix Parallel Planning
â Output: partial-plan-*.json â fix-plan.json (aggregated)
Phase 8: Fix Execution
â Output: fix-progress-*.json, git commits
Phase 9: Fix Completion
â Output: fix-summary.md, fix-history.json
TaskCreate/TaskUpdate Pattern
Review Pipeline Initialization:
TaskCreate({ subject: "Phase 1: Discovery & Initialization", activeForm: "Initializing review" });
TaskCreate({ subject: "Phase 2: Parallel Reviews (7 dimensions)", activeForm: "Reviewing" });
TaskCreate({ subject: "Phase 3: Aggregation", activeForm: "Aggregating findings" });
TaskCreate({ subject: "Phase 4: Deep-dive (conditional)", activeForm: "Deep-diving" });
TaskCreate({ subject: "Phase 5: Review Completion", activeForm: "Completing review" });
During Phase 2 (sub-tasks for each dimension):
// Attach dimension sub-tasks
TaskCreate({ subject: " â Security review", activeForm: "Analyzing security" });
TaskCreate({ subject: " â Architecture review", activeForm: "Analyzing architecture" });
TaskCreate({ subject: " â Quality review", activeForm: "Analyzing quality" });
// ... other dimensions
// Collapse: Mark all dimension tasks completed when Phase 2 finishes
Fix Pipeline (added after Phase 5 if triggered):
TaskCreate({ subject: "Phase 6: Fix Discovery & Batching", activeForm: "Batching findings" });
TaskCreate({ subject: "Phase 7: Parallel Planning", activeForm: "Planning fixes" });
TaskCreate({ subject: "Phase 8: Execution", activeForm: "Executing fixes" });
TaskCreate({ subject: "Phase 9: Fix Completion", activeForm: "Completing fixes" });
Error Handling
Review Pipeline Errors
| Phase | Error | Blocking? | Action |
|---|---|---|---|
| Phase 1 | Session not found (session mode) | Yes | Error and exit |
| Phase 1 | No changed files (session mode) | Yes | Error and exit |
| Phase 1 | Invalid path pattern (module mode) | Yes | Error and exit |
| Phase 1 | No files matched (module mode) | Yes | Error and exit |
| Phase 2 | Single dimension fails | No | Log warning, continue other dimensions |
| Phase 2 | All dimensions fail | Yes | Error and exit |
| Phase 3 | Missing dimension JSON | No | Skip in aggregation, log warning |
| Phase 4 | Deep-dive agent fails | No | Skip finding, continue others |
| Phase 4 | Max iterations reached | No | Generate partial report |
Fix Pipeline Errors
| Phase | Error | Blocking? | Action |
|---|---|---|---|
| Phase 6 | Invalid export file | Yes | Abort with error |
| Phase 6 | Empty batches | No | Warn and skip empty |
| Phase 7 | Planning agent timeout | No | Mark batch failed, continue others |
| Phase 7 | All agents fail | Yes | Abort fix session |
| Phase 8 | Test failure after fix | No | Rollback, retry up to max_iterations |
| Phase 8 | Git operations fail | Yes | Abort, preserve state |
| Phase 9 | Aggregation error | No | Generate partial summary |
CLI Fallback Chain
Gemini â Qwen â Codex â degraded mode
Fallback Triggers: HTTP 429/5xx, connection timeout, invalid JSON output, low confidence < 0.4, analysis too brief (< 100 words)
Output File Structure
.workflow/active/WFS-{session-id}/.review/
âââ review-state.json # Orchestrator state machine
âââ review-progress.json # Real-time progress
âââ dimensions/ # Per-dimension results (Phase 2)
â âââ security.json
â âââ architecture.json
â âââ quality.json
â âââ action-items.json
â âââ performance.json
â âââ maintainability.json
â âââ best-practices.json
âââ iterations/ # Deep-dive results (Phase 4)
â âââ iteration-1-finding-{uuid}.json
â âââ iteration-2-finding-{uuid}.json
âââ reports/ # Human-readable reports
â âââ security-analysis.md
â âââ security-cli-output.txt
â âââ deep-dive-1-{uuid}.md
â âââ ...
âââ fixes/{fix-session-id}/ # Fix results (Phase 6-9)
âââ partial-plan-*.json
âââ fix-plan.json
âââ fix-progress-*.json
âââ fix-summary.md
âââ active-fix-session.json
âââ fix-history.json
Related Commands
View Progress
ccw view
Workflow Pipeline
# Step 1: Review (this skill)
Skill(skill="review-cycle", args="src/auth/**")
# Step 2: Fix (continue or standalone)
Skill(skill="review-cycle", args="--fix .workflow/active/WFS-{session-id}/.review/")