Files
Claude-Code-Workflow/.claude/skills/review-code/templates/review-report.md
catlog22 29c8bb7a66 feat: Add orchestrator and state management for code review process
- Implemented orchestrator logic to manage code review phases, including state reading, action selection, and execution loop.
- Defined state schema for review process, including metadata, context, findings, and execution tracking.
- Created action catalog detailing actions for context collection, quick scan, deep review, report generation, and completion.
- Established error recovery strategies and termination conditions for robust review handling.
- Developed issue classification and quality standards documentation to guide review severity and categorization.
- Introduced review dimensions with detailed checklists for correctness, security, performance, readability, testing, and architecture.
- Added templates for issue reporting and review reports to standardize output and improve clarity.
2026-01-13 14:39:16 +08:00

3.8 KiB

Review Report Template

审查报告模板。

Template Structure

# Code Review Report

## 审查概览

| 项目 | 值 |
|------|------|
| 目标路径 | `{{target_path}}` |
| 文件数量 | {{file_count}} |
| 代码行数 | {{total_lines}} |
| 主要语言 | {{language}} |
| 框架 | {{framework}} |
| 审查时间 | {{review_duration}} |

## 问题统计

| 严重程度 | 数量 |
|----------|------|
| 🔴 Critical | {{critical_count}} |
| 🟠 High | {{high_count}} |
| 🟡 Medium | {{medium_count}} |
| 🔵 Low | {{low_count}} |
| ⚪ Info | {{info_count}} |
| **总计** | **{{total_issues}}** |

### 按维度统计

| 维度 | 问题数 |
|------|--------|
| Correctness (正确性) | {{correctness_count}} |
| Security (安全性) | {{security_count}} |
| Performance (性能) | {{performance_count}} |
| Readability (可读性) | {{readability_count}} |
| Testing (测试) | {{testing_count}} |
| Architecture (架构) | {{architecture_count}} |

---

## 高风险区域

{{#if risk_areas}}
| 文件 | 原因 | 优先级 |
|------|------|--------|
{{#each risk_areas}}
| `{{this.file}}` | {{this.reason}} | {{this.priority}} |
{{/each}}
{{else}}
未发现明显的高风险区域。
{{/if}}

---

## 问题详情

{{#each dimensions}}
### {{this.name}}

{{#each this.findings}}
#### {{severity_emoji this.severity}} [{{this.id}}] {{this.category}}

- **严重程度**: {{this.severity}}
- **文件**: `{{this.file}}`{{#if this.line}}:{{this.line}}{{/if}}
- **描述**: {{this.description}}

{{#if this.code_snippet}}

{{this.code_snippet}}

{{/if}}

**建议**: {{this.recommendation}}

{{#if this.fix_example}}
**修复示例**:

{{this.fix_example}}

{{/if}}

---

{{/each}}
{{/each}}

## 审查建议

### 必须修复 (Must Fix)

{{must_fix_summary}}

### 建议改进 (Should Fix)

{{should_fix_summary}}

### 可选优化 (Nice to Have)

{{nice_to_have_summary}}

---

*报告生成时间: {{generated_at}}*

Variable Definitions

Variable Type Source
{{target_path}} string state.context.target_path
{{file_count}} number state.context.file_count
{{total_lines}} number state.context.total_lines
{{language}} string state.context.language
{{framework}} string state.context.framework
{{review_duration}} string Formatted duration
{{critical_count}} number Count of critical findings
{{high_count}} number Count of high findings
{{medium_count}} number Count of medium findings
{{low_count}} number Count of low findings
{{info_count}} number Count of info findings
{{total_issues}} number Total findings
{{risk_areas}} array state.scan_summary.risk_areas
{{dimensions}} array Grouped findings by dimension
{{generated_at}} string ISO timestamp

Helper Functions

function severity_emoji(severity) {
  const emojis = {
    critical: '🔴',
    high: '🟠',
    medium: '🟡',
    low: '🔵',
    info: '⚪'
  };
  return emojis[severity] || '⚪';
}

function formatDuration(ms) {
  const minutes = Math.floor(ms / 60000);
  const seconds = Math.floor((ms % 60000) / 1000);
  return `${minutes}${seconds}秒`;
}

function generateMustFixSummary(findings) {
  const critical = findings.filter(f => f.severity === 'critical');
  const high = findings.filter(f => f.severity === 'high');
  
  if (critical.length + high.length === 0) {
    return '未发现必须立即修复的问题。';
  }
  
  return `发现 ${critical.length} 个严重问题和 ${high.length} 个高优先级问题,建议在合并前修复。`;
}

Usage Example

const report = generateReport({
  context: state.context,
  summary: state.summary,
  findings: state.findings,
  scanSummary: state.scan_summary
});

Write(`${workDir}/review-report.md`, report);