关于 review-cycle
面向开发者的代码审查 Skill,可按输入路由到会话、模块或修复流程,并仅加载对应阶段文档。
主要功能
- 01自动路由会话、模块和修复模式
- 02七维并行审查分析
- 03分批执行自动修复
- 04使用 -y 或 --yes 跳过确认
适用场景
- 01审查工作流会话中的变更
- 02分析指定源代码路径
- 03根据审查结果应用修复
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ catlog22/ claude-code-workflow --skill review-cycle安装后在 Claude Code 中输入/review-cycle确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
phases/review-fix.mdreview-module.mdreview-session.md详细介绍
Review Cycle
基于模式路由的统一代码审查协调器。检测输入类型并分派到相应的执行阶段。
Architecture Overview
┌──────────────────────────────────────────────────────────┐
│ Review Cycle Orchestrator (SKILL.md) │
│ → Parse input → Detect mode → Read phase doc → Execute │
└───────────────────────────┬──────────────────────────────┘
│
┌─────────────────┼─────────────────┐
↓ ↓ ↓
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ session │ │ module │ │ fix │
│ (git changes│ │(path pattern│ │(export file │
│ review) │ │ review) │ │ auto-fix) │
└─────────────┘ └─────────────┘ └─────────────┘
phases/ phases/ phases/
review-session.md review-module.md review-fix.md
Auto Mode Detection
// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播
const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS)
当 autoYes 为 true 时,跳过所有交互式确认,并在整个审查周期的各阶段中使用默认值。
Mode Detection
function detectMode(args) {
if (args.includes('--fix')) return 'fix';
if (args.match(/\*|\.ts|\.js|\.py|\.vue|\.jsx|\.tsx|src\/|lib\//)) return 'module';
if (args.match(/^WFS-/) || args.trim() === '') return 'session';
return 'session'; // default
}
| 输入模式 | 检测到的模式 | 阶段文档 |
|---|---|---|
src/auth/** | module | phases/review-module.md |
src/auth/**,src/payment/** | module | phases/review-module.md |
WFS-payment-integration | session | phases/review-session.md |
| (empty) | session | phases/review-session.md |
--fix .review/ | fix | phases/review-fix.md |
--fix --resume | fix | phases/review-fix.md |
Usage
Skill(skill="review-cycle", args="src/auth/**") # Module mode
Skill(skill="review-cycle", args="src/auth/** --dimensions=security,architecture") # Module + custom dims
Skill(skill="review-cycle", args="WFS-payment-integration") # Session mode
Skill(skill="review-cycle", args="") # Session: auto-detect
Skill(skill="review-cycle", args="--fix .workflow/active/WFS-123/.review/") # Fix mode
Skill(skill="review-cycle", args="--fix --resume") # Fix: resume
Skill(skill="review-cycle", args="-y src/auth/**") # Auto mode (skip confirmations)
# Common flags (all modes):
--dimensions=dim1,dim2,... Custom dimensions (default: all 7)
--max-iterations=N Max deep-dive iterations (default: 3)
# Fix-only flags:
--fix Enter fix pipeline
--resume Resume interrupted fix session
--batch-size=N Findings per planning batch (default: 5)
--max-iterations=N Max retry per finding (default: 3)
Execution Flow
1. Parse $ARGUMENTS → extract mode + flags
2. Detect mode (session | module | fix)
3. Read corresponding phase doc:
- session → Read phases/review-session.md → execute
- module → Read phases/review-module.md → execute
- fix → Read phases/review-fix.md → execute
4. Phase doc contains full execution detail (5 phases for review, 4+1 phases for fix)
阶段参考文档(根据检测到的模式按需读取):
| 模式 | 文档 | 来源 | 描述 |
|---|---|---|---|
| session | phases/review-session.md | review-session-cycle.md | 基于会话的审查:git 更改 → 7 维度并行分析 → 汇总 → 深入审查 → 完成 |
| module | phases/review-module.md | review-module-cycle.md | 基于模块的审查:路径模式 → 7 维度并行分析 → 汇总 → 深入审查 → 完成 |
| fix | phases/review-fix.md | review-cycle-fix.md | 自动修复:导出文件 → 智能分批 → 并行规划 → 执行 → 完成 |
Project Context
运行 ccw spec load --category review,以获取审查标准、检查清单和审批关卡。
Core Rules
- 先检测模式:首先解析输入,确定 session/module/fix 模式
- 渐进式加载:只读取检测到的模式对应的阶段文档,不要读取全部三个文档
- 完全委派:检测到模式后,由阶段文档负责整个执行流程
- 自动继续:阶段文档包含自身的多阶段执行流程(阶段 1-5 或阶段 1-4+5)
- 不要停止:持续执行,直到阶段文档中的所有内部阶段完成
Error Handling
| 错误 | 操作 |
|---|---|
| 无法根据输入确定模式 | 使用 AskUserQuestion 澄清意图 |
| 未找到阶段文档 | 报错并退出,同时提供文件路径 |
| 模式的标志无效 | 发出警告,并使用默认值继续 |
Related Commands
# View review/fix progress dashboard
ccw view
# Workflow pipeline
# Step 1: Review
Skill(skill="review-cycle", args="src/auth/**")
# Step 2: Fix (after review complete)
Skill(skill="review-cycle", args="--fix .workflow/active/WFS-{session-id}/.review/")
评论
支持 Markdown