Xpersona
I

Iterative Code Review

CLAWHUB · Unverified

Iterative code review using multiple independent subagent reviews. Use when user asks to review PR, code, or mentions "review", "审查", "检查代码", "代码质量". Assists... Skill: Iterative Code Review Owner: luciuscao Summary: Iterative code review using multiple independent subagent reviews. Use when user asks to review PR, code, or mentions "review", "审查", "检查代码", "代码质量". Assists... Tags: latest:1.2.1 Version history: v1.2.1 | 2026-03-28T13:58:30.459Z | auto Version 1.2.1 - Added compatibility information, listing required and optional tools in SKILL.md. - Updated version number to 1

62
Rank
84
Safety
1.7k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.7K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s174xpbqz7bpc7mkc8mz4j186983gggt:iterative-code-review
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-luciuscao-iterative-code-review/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

149,817 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: iterative-code-review
displayName: Iterative Code Review
description: |
  Iterative code review using multiple independent subagent reviews. Use when user asks to review PR, code, or mentions "review", "审查", "检查代码", "代码质量". Assists with code review through parallel subagent analysis and optional automated fixes.
license: MIT
version: 1.2.0
metadata:
  {"openclaw":{"emoji":"🔍","category":"code-quality"}}
compatibility: |
  Required tools: git, gh (GitHub CLI), jq, node/npm
  Optional: openclaw CLI
---

# Code Review Skill

Iterative code review through **parallel independent subagent reviews** with user confirmation at each step.

## ⚠️ 用户控制 vs 自动化

**默认行为(安全模式)**:
- ✅ 每一步都需要用户确认
- ❌ 不会自动修改代码

**可选:自动化模式(需手动启用)**:

用户可通过配置文件启用 `autoFix` 和 `autoContinue`。详见 [references/automation.md](references/automation.md)。

```
┌─────────────────────────────────────────────────────────┐
│  默认:安全模式                                          │
│  - 每步都需要用户确认                                    │
│  - 适合:重要项目、首次使用                               │
│                                                          │
│  可选:自动化模式(需要手动配置启用)                      │
│  - autoFix=true: 发现问题后自动修复                       │
│  - autoContinue=true: 修复后自动继续下一轮                │
│  ⚠️ 警告:会自动修改代码!                                │
└─────────────────────────────────────────────────────────┘
```

---

## Pre-flight Checks

开始 Review 前,必须执行以下检查:

| Check | 说明 |
|-------|------|
| **Model Selection** | 用户选择或确认使用的模型 |
| **maxSpawnDepth** | `≥1` 才能继续 |
| **变更规模检测** | 根据文件数调整超时时间 |
| **新增代码识别** | 审查新增代码的安全性 |
| **PR 历史检查** | 避免重复发现已修复的问题 |
| **Review 模式** | Full Review 或 Delta Review |

详见 [references/preflight.md](references/preflight.md)。

---

## Workflow

### Round Structure

```
┌─────────────────────────────────────────────────────────┐
│  Review Round N                                          │
│                                                          │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐                  │
│  │Reviewer1│  │Reviewer2│  │Reviewer3│  ← 并行 3 个      │
│  └────┬────┘  └────┬────┘  └────┬────┘                  │
│       └────────────┼────────────┘                        │
│                    ▼                                     │
│            ┌──────────────┐                              │
│            │ 汇总问题列表  │                              │
│            └──────┬───────┘                              │
│                   ▼                                      │
│            ┌──────────────┐                              │
│            │  用户确认    │  ← 是否继续修复?            │
│            └──────┬───────┘                              │
│                   ▼                                      │
│            ┌──────────────┐                              │
│            │   Fixer      │  ← 用户同意后才执行          │
│            └──────────────┘                              │
└─────────────────────────────────────────────────────────┘
```

### Reviewer 关注点

| Reviewer | 关注点 |

_meta.json

{
  "ownerId": "kn78thrk2cqah3hfm1793t6a7d81tmbb",
  "slug": "iterative-code-review",
  "version": "1.2.1",
  "publishedAt": 1774706310459
}

references/automation.md

# Automation Preferences

用户可以设置自动化偏好,避免每次都询问确认。

## 配置位置

```
~/.openclaw/workspace/.iterative-code-review/preferences.json
```

## 配置项

```json
{
  "autoFix": true,
  "autoContinue": true,
  "maxRounds": 5,
  "severityThreshold": "P2"
}
```

| 配置项 | 类型 | 默认值 | 说明 |
|--------|------|--------|------|
| `autoFix` | boolean | `false` | 发现问题后自动修复(不询问) |
| `autoContinue` | boolean | `false` | 修复后自动继续下一轮 review |
| `maxRounds` | number | `10` | 最多自动进行几轮 |
| `severityThreshold` | string | `"P0"` | 修复的问题严重级别阈值 (P0/P1/P2/P3) |

## 行为矩阵

| autoFix | autoContinue | 发现问题后 | 修复后 |
|---------|--------------|-----------|--------|
| `false` | `false` | 询问是否修复 | 询问是否继续 review |
| `true` | `false` | 自动修复 | 询问是否继续 review |
| `false` | `true` | 询问是否修复 | 自动继续 review |
| `true` | `true` | 自动修复 | 自动继续 review |

## severityThreshold 示例

- `"P0"` - 只自动修复 P0 问题
- `"P1"` - 自动修复 P0 和 P1 问题
- `"P2"` - 自动修复 P0、P1、P2 问题
- `"P3"` - 自动修复所有问题

## ⚠️ 安全警告

启用 `autoFix=true` 或 `autoContinue=true` 后:

- 技能会**自动修改代码**而无需确认
- 可能引入不符合预期的变更
- 建议在非关键项目或测试环境中先验证
- 重要项目建议保持默认配置(交互式确认)

## 读取配置脚本

```bash
#!/bin/bash
PREF_FILE="$HOME/.openclaw/workspace/.iterative-code-review/preferences.json"

if [[ -f "$PREF_FILE" ]]; then
  CONFIG=$(cat "$PREF_FILE")
else
  CONFIG="{}"
fi

AUTO_FIX=$(echo "$CONFIG" | jq -r '.autoFix // false')
AUTO_CONTINUE=$(echo "$CONFIG" | jq -r '.autoContinue // false')
MAX_ROUNDS=$(echo "$CONFIG" | jq -r '.maxRounds // 10')
SEVERITY_THRESHOLD=$(echo "$CONFIG" | jq -r '.severityThreshold // "P0"')

echo "autoFix=$AUTO_FIX"
echo "autoContinue=$AUTO_CONTINUE"
echo "maxRounds=$MAX_ROUNDS"
echo "severityThreshold=$SEVERITY_THRESHOLD"
```

references/checklist.md

# Code Review Checklist

## 0. ⚠️ 新增代码审查(必须检查!)

> **历史教训**:PR #64 经过 7 轮 review 后,重新审查仍发现 22 个新问题。
> 原因:只关注"修复了什么",忽略"新增了什么"。

### 新增代码识别
- [ ] 识别本次 PR 新增的代码范围(`git diff --stat`)
- [ ] 识别新增的文件(`git diff --name-only --diff-filter=A`)

### 新增代码安全性
- [ ] 加密算法使用正确(使用 HMAC 而非 Hash)
- [ ] 密钥管理安全(零填充、安全存储)
- [ ] 输入验证完整
- [ ] 权限检查到位
- [ ] 无注入漏洞

### 新增代码测试覆盖
- [ ] 新增函数有对应单元测试
- [ ] 边界条件测试覆盖
- [ ] 错误路径测试覆盖
- [ ] 测试资源正确清理

### 新增代码边界条件
- [ ] 空值/undefined 检查
- [ ] 极端情况处理
- [ ] 错误处理完整
- [ ] 异步操作正确(Promise/async-await)

### 新增代码资源清理
- [ ] 定时器正确清理
- [ ] 内存正确释放
- [ ] 连接正确关闭
- [ ] 事件监听器移除

---

## 1. Code Quality

### Logic Correctness
- [ ] Business logic correct
- [ ] Condition checks complete
- [ ] Loop termination correct
- [ ] Boundary values handled

### Error Handling
- [ ] All error paths handled
- [ ] Error messages clear
- [ ] Appropriate retry mechanisms
- [ ] Errors propagated/logged correctly

### Edge Cases
- [ ] Null/undefined checks
- [ ] Array bounds checks
- [ ] Number overflow checks
- [ ] String length limits

### Readability
- [ ] Variable names clear
- [ ] Functions not too long (<50 lines)
- [ ] No duplicate code
- [ ] Adequate comments

## 2. Concurrency & Race Conditions

### Race Conditions
- [ ] Shared resources lock-protected
- [ ] File operations atomic
- [ ] Database operations in transactions
- [ ] No TOCTOU issues

### Idempotency
- [ ] Repeated calls safe
- [ ] State changes idempotent
- [ ] External calls deduplicated
- [ ] Retries don't cause duplication

### Thread Safety
- [ ] No deadlock risk
- [ ] Lock granularity appropriate
- [ ] No resource leaks
- [ ] Async operations awaited correctly

## 3. Security

### Input Validation
- [ ] All external input validated
- [ ] Parameter types checked
- [ ] Parameter ranges validated
- [ ] No injection vulnerabilities (SQL/XSS/command)

### Permission Checks
- [ ] Permission verification present
- [ ] Permission checks complete
- [ ] No unauthorized access
- [ ] Sensitive operations require confirmation

### Data Handling
- [ ] Sensitive data encrypted
- [ ] Keys stored securely
- [ ] Logs don't leak sensitive info
- [ ] Config not tamperable

## 4. Test Coverage

### Testing Principles
- [ ] Tests verify actual behavior, not mock behavior
- [ ] Business boundaries covered
- [ ] Error paths tested
- [ ] Concurrent scenarios tested

### Boundary Testing
- [ ] Normal value boundaries
- [ ] Extreme values (max/min)
- [ ] Null/empty tests
- [ ] Type error tests

### Business Logic Testing
- [ ] Main business flows
- [ ] Exception business flows
- [ ] Business rule validation
- [ ] Business boundary conditions

### Avoid Meaningless Mocks
- [ ] Mock return values match real behavior
- [ ] Tests verify function calls and parameters
- [ ] Don't just test that mock was called
- [ ] Integration tests use real dependencies

## 5. Performance

### Performance Issues
- [ ] No obvious bottlenecks
- [ ] No unnecessary operations in loops
- [ ] No N+1 query issues
- [ ] Large data handling optimize

references/exit-criteria.md

# 退出标准详解

## 核心规则

**用户决定何时结束 Review。**

建议的退出条件:
1. 连续两轮 Review 都未发现任何 P0/P1/P2 问题
2. 用户对代码质量满意

## 流程控制

```javascript
let currentRound = 0;
const MAX_ROUNDS = 10;

function checkCompletion(currentRoundIssues) {
  currentRound++;
  
  // 最大轮次检查
  if (currentRound >= MAX_ROUNDS) {
    console.log(`已达到最大轮次 ${MAX_ROUNDS},请用户决定是否继续。`);
    return { status: "USER_DECISION" };
  }
  
  // 汇总问题
  const mustFixIssues = currentRoundIssues.filter(i => 
    ['P0', 'P1', 'P2'].includes(i.level)
  );
  
  if (mustFixIssues.length === 0) {
    console.log("本轮未发现 P0/P1/P2 问题。是否继续下一轮确认?(y/n)");
    return { status: "USER_DECISION" };
  }
  
  console.log(`发现 ${mustFixIssues.length} 个问题。是否修复?(y/n)`);
  return { status: "USER_DECISION" };
}
```

## 流程图示

### 用户控制的流程

```
Round 1: 发现问题 → 向用户报告 → 用户决定是否修复
    ↓
用户同意 → Fixer → 用户审核修改
    ↓
Round 2: 发现问题 → 向用户报告 → 用户决定是否修复
    ↓
用户同意 → Fixer → 用户审核修改
    ↓
Round 3: 无问题 → 向用户报告 → 用户决定是否结束
    ↓
用户同意结束 → ✅ END
```

### 用户可以随时干预

```
任何阶段:
- 用户可以停止 Review
- 用户可以跳过某个问题的修复
- 用户可以要求更多轮次
- 用户可以手动修改代码
```

## 关键规则

- **用户控制** - 每一步都需要用户确认
- **MAX_ROUNDS = 10** - 建议的最大轮次,但用户可以决定继续
- **P3 不强制** - 可选修复,用户决定
- **透明报告** - 向用户清晰报告每轮发现的问题

Sponsored

Ads related to Iterative Code Review and adjacent AI workflows.