codereview-orchestrator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode Review Orchestrator Skill
Code Review Orchestrator Skill
The coordinator for code reviews. This skill only triages and routes - it does NOT perform detailed code review. All actual review work is delegated to specialist skills.
代码评审的协调器。本Skill仅负责分类与任务分配——不执行详细的代码评审。所有实际评审工作均委托给专业Skill完成。
Quick Start: Full Pipeline
快速开始:完整工作流
Trigger a complete review by saying:
Review PR 123
Review PR owner/repo#123
Review PR https://github.com/owner/repo/pull/123This will:
- Retrieve the PR diff via GitHub API
- Triage and assess risk
- Route to appropriate specialist skills
- Review the code
- Submit the review to GitHub
输入以下命令即可触发完整评审:
Review PR 123
Review PR owner/repo#123
Review PR https://github.com/owner/repo/pull/123该命令将执行以下操作:
- 获取:通过GitHub API获取PR的代码差异
- 分类:评估风险等级
- 分配:将任务派发给合适的专业Skill
- 评审:执行代码评审(由专业Skill完成)
- 提交:将评审结果提交至GitHub
Role
职责
- Triage: Classify the PR and assess risk level
- Route: Select appropriate specialist skills
- Summarize: Generate high-level PR summary
- Delegate: Hand off to specialists for actual review
- Orchestrate: Manage the full review pipeline (input → review → output)
- 分类:对PR进行分类并评估风险等级
- 分配:选择合适的专业Skill
- 总结:生成PR的高层级摘要
- 委托:将实际评审工作交给专业Skill
- 编排:管理完整的评审工作流(输入 → 评审 → 输出)
What This Skill Does NOT Do
本Skill不负责的工作
❌ Find bugs
❌ Check security
❌ Review performance
❌ Validate tests
❌ Check style
❌ Check security
❌ Review performance
❌ Validate tests
❌ Check style
All of the above are delegated to specialist skills.
❌ 查找代码缺陷
❌ 安全检查
❌ 性能评审
❌ 测试验证
❌ 代码风格检查
❌ 安全检查
❌ 性能评审
❌ 测试验证
❌ 代码风格检查
以上所有工作均委托给专业Skill完成。
Full Pipeline Architecture
完整工作流架构
┌─────────────────────────────────────────────────────────────────┐
│ INPUT SKILLS │
├─────────────────────────────────────────────────────────────────┤
│ retrieve-diff-from-github-pr │ retrieve-diff-from-commit │
│ (GitHub PRs via API) │ (Local git commits) │
└────────────────────────────────┴────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ codereview-orchestrator │
│ (Triage & Route - this skill) │
└─────────────────────────────────────────────────────────────────┘
│
┌───────┬───────┬───────────┴───────────┬───────┬───────┐
▼ ▼ ▼ ▼ ▼ ▼
┌─────────┐ ┌─────┐ ┌─────┐ ┌─────────┐ ┌─────┐ ┌─────┐
│security │ │ api │ │data │ ... │ perf │ │test │ │style│
└─────────┘ └─────┘ └─────┘ └─────────┘ └─────┘ └─────┘
│ │ │ │ │ │
└───────┴───────┴───────────┬───────────┴───────┴───────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ OUTPUT SKILLS │
├─────────────────────────────────────────────────────────────────┤
│ submit-github-review │
│ (Post review to GitHub API) │
└─────────────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────────────┐
│ INPUT SKILLS │
├─────────────────────────────────────────────────────────────────┤
│ retrieve-diff-from-github-pr │ retrieve-diff-from-commit │
│ (GitHub PRs via API) │ (Local git commits) │
└────────────────────────────────┴────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ codereview-orchestrator │
│ (Triage & Route - this skill) │
└─────────────────────────────────────────────────────────────────┘
│
┌───────┬───────┬───────────┴───────────┬───────┬───────┐
▼ ▼ ▼ ▼ ▼ ▼
┌─────────┐ ┌─────┐ ┌─────┐ ┌─────────┐ ┌─────┐ ┌─────┐
│security │ │ api │ │data │ ... │ perf │ │test │ │style│
└─────────┘ └─────┘ └─────┘ └─────────┘ └─────┘ └─────┘
│ │ │ │ │ │
└───────┴───────┴───────────┬───────────┴───────┴───────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ OUTPUT SKILLS │
├─────────────────────────────────────────────────────────────────┤
│ submit-github-review │
│ (Post review to GitHub API) │
└─────────────────────────────────────────────────────────────────┘Inputs
输入参数
| Input | Description |
|---|---|
| PR number, short ref (owner/repo#123), or full URL |
| The code changes to review (or retrieved automatically) |
| Language, framework, architecture patterns |
| Optional: security, performance, correctness, etc. |
| Whether to automatically submit review to GitHub (default: false) |
| 输入参数 | 描述 |
|---|---|
| PR编号、短引用(owner/repo#123)或完整URL |
| 需要评审的代码变更(可自动获取) |
| 项目使用的语言、框架、架构模式 |
| 可选:重点关注领域,如安全、性能、正确性等 |
| 是否自动将评审结果提交至GitHub(默认:false) |
Outputs
输出结果
| Output | Description |
|---|---|
| Plain-English description of changes |
| What parts of the system are affected |
| Overall risk level with justification |
| Which specialists to invoke and why |
| Clarifying questions for the author (if any) |
| 输出结果 | 描述 |
|---|---|
| 用通俗易懂的语言描述代码变更 |
| 系统中受影响的模块 |
| 整体风险等级及理由 |
| 需要调用的专业Skill及原因 |
| 向PR作者提出的澄清问题(如有) |
Step 1: Understand Intent
步骤1:理解PR意图
Ask these questions (do NOT review the code):
- What behavior change is intended?
- Does the PR description explain the purpose?
- Is this a feature, bugfix, refactor, or infrastructure change?
询问以下问题(请勿评审代码):
- 该PR想要实现什么样的行为变更?
- PR描述是否说明了变更目的?
- 这是功能新增、缺陷修复、代码重构还是基础设施变更?
Step 2: Identify Touched Surfaces
步骤2:识别受影响模块
Categorize modified files into surfaces:
| Surface | File Patterns | Risk Indicator |
|---|---|---|
| Auth | | 🔴 High |
| API | | 🟡 Medium |
| Database | | 🔴 High |
| Business Logic | | 🟡 Medium |
| Infrastructure | | 🟡 Medium |
| Configuration | | 🟡 Medium |
| Tests | | 🟢 Low |
| Documentation | | 🟢 Low |
| Dependencies | | 🟡 Medium |
将修改的文件归类到以下模块:
| 模块 | 文件匹配规则 | 风险标识 |
|---|---|---|
| Auth | | 🔴 高 |
| API | | 🟡 中 |
| Database | | 🔴 高 |
| Business Logic | | 🟡 中 |
| Infrastructure | | 🟡 中 |
| Configuration | | 🟡 中 |
| Tests | | 🟢 低 |
| Documentation | | 🟢 低 |
| Dependencies | | 🟡 中 |
Step 3: Assess Risk
步骤3:评估风险
Rate overall risk based on:
| Factor | High Risk | Low Risk |
|---|---|---|
| Surfaces | Auth, DB, payments | Docs, tests |
| Scope | Many files, cross-cutting | Single file, isolated |
| Complexity | New algorithms, state machines | Simple CRUD |
| Reversibility | DB migrations, API changes | Internal refactors |
根据以下因素评估整体风险:
| 评估因素 | 高风险场景 | 低风险场景 |
|---|---|---|
| 模块 | Auth、数据库、支付相关 | 文档、测试 |
| 范围 | 修改大量文件、跨模块变更 | 仅修改单个文件、独立模块 |
| 复杂度 | 新增算法、状态机 | 简单CRUD操作 |
| 可回滚性 | 数据库迁移、API变更 | 内部代码重构 |
Step 4: Generate Review Plan
步骤4:生成评审计划
Select specialists based on touched surfaces:
yaml
review_plan:
# Always run
always:
- codereview-correctness # Logic bugs
- codereview-style # Readability
# Conditional based on surfaces
conditional:
- skill: codereview-security
trigger: auth, input handling, secrets, external APIs
- skill: codereview-api
trigger: routes, endpoints, schemas, contracts
- skill: codereview-data
trigger: migrations, models, queries
- skill: codereview-concurrency
trigger: async, workers, queues, locks
- skill: codereview-performance
trigger: loops, queries, caching, I/O
- skill: codereview-observability
trigger: logging, metrics, tracing
- skill: codereview-testing
trigger: test files modified or missing
- skill: codereview-config
trigger: config files, env vars, feature flags
- skill: codereview-architect
trigger: core utilities, shared libraries, breaking changes根据受影响的模块选择对应的专业Skill:
yaml
review_plan:
# Always run
always:
- codereview-correctness # Logic bugs
- codereview-style # Readability
# Conditional based on surfaces
conditional:
- skill: codereview-security
trigger: auth, input handling, secrets, external APIs
- skill: codereview-api
trigger: routes, endpoints, schemas, contracts
- skill: codereview-data
trigger: migrations, models, queries
- skill: codereview-concurrency
trigger: async, workers, queues, locks
- skill: codereview-performance
trigger: loops, queries, caching, I/O
- skill: codereview-observability
trigger: logging, metrics, tracing
- skill: codereview-testing
trigger: test files modified or missing
- skill: codereview-config
trigger: config files, env vars, feature flags
- skill: codereview-architect
trigger: core utilities, shared libraries, breaking changesOutput Format
输出格式
markdown
undefinedmarkdown
undefinedPR Summary
PR摘要
[2-3 sentence description of what this PR does]
[用2-3句话描述该PR的作用]
Touched Surfaces
受影响模块
| Surface | Files | Risk |
|---|---|---|
| Auth | | 🔴 High |
| API | | 🟡 Medium |
| Tests | | 🟢 Low |
| 模块 | 文件 | 风险等级 |
|---|---|---|
| Auth | | 🔴 高 |
| API | | 🟡 中 |
| Tests | | 🟢 低 |
Risk Assessment
风险评估
Overall Risk: 🟡 MEDIUM
- 🔴 Touches authentication flow
- 🟡 Modifies public API
- 🟢 Has test coverage
整体风险:🟡 中等
- 🔴 涉及认证流程变更
- 🟡 修改了公开API
- 🟢 包含测试用例
Review Plan
评审计划
| Priority | Skill | Files | Reason |
|---|---|---|---|
| 1 | | | Auth changes require security review |
| 2 | | | API contract changes |
| 3 | | All | Standard logic check |
| 4 | | | Verify coverage |
| 5 | | All | Final readability pass |
| 优先级 | Skill | 文件 | 原因 |
|---|---|---|---|
| 1 | | | 认证变更需要安全评审 |
| 2 | | | API契约变更 |
| 3 | | 全部文件 | 标准逻辑检查 |
| 4 | | | 验证测试覆盖率 |
| 5 | | 全部文件 | 最终可读性检查 |
Questions for Author
向作者提出的问题
- [Only if something is genuinely unclear about intent]
undefined- [仅当PR意图确实不明确时填写]
undefinedSpecialist Skills Reference
专业Skill参考
| Skill | Invoke When |
|---|---|
| Auth, input parsing, secrets, external APIs |
| All PRs - logic bugs, error handling |
| API routes, schemas, contracts |
| Database migrations, models, queries |
| Async code, workers, distributed systems |
| Loops, queries, caching, memory |
| Logging, metrics, tracing |
| Test files or code needing tests |
| Config, env vars, feature flags |
| Core libs, shared code, breaking changes |
| All PRs - final readability pass |
| Skill | 调用场景 |
|---|---|
| 认证、输入解析、密钥管理、外部API |
| 所有PR - 逻辑缺陷、错误处理 |
| API路由、数据模型、契约 |
| 数据库迁移、数据模型、查询语句 |
| 异步代码、工作线程、分布式系统 |
| 循环、查询、缓存、内存管理 |
| 日志、指标、链路追踪 |
| 修改测试文件或代码需要补充测试 |
| 配置文件、环境变量、功能开关 |
| 核心库、共享代码、破坏性变更 |
| 所有PR - 最终可读性检查 |
Quick Reference
快速参考
□ Understand Intent
□ What does this PR do?
□ Feature / bugfix / refactor / infra?
□ Identify Surfaces
□ Which areas are touched?
□ What's the risk level of each?
□ Assess Risk
□ Overall risk rating?
□ Key risk factors?
□ Generate Plan
□ Which specialists needed?
□ In what priority order?
□ Why each specialist?□ 理解PR意图
□ 该PR的作用是什么?
□ 属于功能新增/缺陷修复/代码重构/基础设施变更?
□ 识别受影响模块
□ 涉及哪些模块?
□ 每个模块的风险等级是什么?
□ 评估风险
□ 整体风险等级?
□ 关键风险因素?
□ 生成评审计划
□ 需要哪些专业Skill?
□ 优先级顺序是什么?
□ 每个Skill的调用原因?Important
重要提示
This skill is only for triage and routing. Once the review plan is generated, invoke the specialist skills to perform the actual review.
本Skill仅用于分类与任务分配。生成评审计划后,需调用专业Skill执行实际评审工作。
Full Pipeline Execution
完整工作流执行
When triggered with "Review PR <number>", execute the full pipeline:
当通过「Review PR <编号>」命令触发时,将执行完整工作流:
Phase 1: Input (Retrieve Diff)
阶段1:输入(获取代码差异)
yaml
undefinedyaml
undefinedFor GitHub PRs
For GitHub PRs
skill: retrieve-diff-from-github-pr
inputs:
owner: <from PR reference>
repo: <from PR reference>
pull_number: <from PR reference>
outputs:
- pr_info
- files
- diff
- commit_id # Needed for submit phase
undefinedskill: retrieve-diff-from-github-pr
inputs:
owner: <from PR reference>
repo: <from PR reference>
pull_number: <from PR reference>
outputs:
- pr_info
- files
- diff
- commit_id # Needed for submit phase
undefinedPhase 2: Triage (This Skill)
阶段2:分类(本Skill)
Execute Steps 1-4 above to generate the review plan.
执行上述步骤1-4生成评审计划。
Phase 3: Review (Specialist Skills)
阶段3:评审(专业Skill)
Execute each specialist skill in the review plan:
yaml
for each skill in review_plan:
invoke: <skill>
inputs:
diff: <from phase 1>
files: <relevant files for this skill>
collect: findings[]执行评审计划中的每个专业Skill:
yaml
for each skill in review_plan:
invoke: <skill>
inputs:
diff: <from phase 1>
files: <relevant files for this skill>
collect: findings[]Phase 4: Output (Submit Review)
阶段4:输出(提交评审结果)
yaml
skill: submit-github-review
inputs:
owner: <from phase 1>
repo: <from phase 1>
pull_number: <from phase 1>
commit_id: <from phase 1>
findings: <aggregated from phase 3>
review_event: <determined by findings severity>
outputs:
- review_urlyaml
skill: submit-github-review
inputs:
owner: <from phase 1>
repo: <from phase 1>
pull_number: <from phase 1>
commit_id: <from phase 1>
findings: <aggregated from phase 3>
review_event: <determined by findings severity>
outputs:
- review_urlPipeline Output
工作流输出
markdown
undefinedmarkdown
undefinedReview Complete
评审完成
PR: owner/repo#123
Review URL: https://github.com/owner/repo/pull/123#pullrequestreview-12345
PR: owner/repo#123
评审URL: https://github.com/owner/repo/pull/123#pullrequestreview-12345
Summary
摘要
| Severity | Count |
|---|---|
| 🔴 Blocker | 1 |
| 🟡 Major | 2 |
| 🔵 Minor | 3 |
| ⚪ Nit | 2 |
Action: REQUEST_CHANGES
View the full review on GitHub: PR #123
undefinedInput/Output Skills Reference
输入/输出Skill参考
| Skill | Type | Purpose |
|---|---|---|
| Input | Get diff from local git commits |
| Input | Get diff from GitHub PR via API |
| Output | Post review to GitHub PR |
| Skill | 类型 | 用途 |
|---|---|---|
| 输入 | 从本地Git提交获取代码差异 |
| 输入 | 通过GitHub API获取PR的代码差异 |
| 输出 | 将评审结果提交至GitHub PR |