# Io Review

> 审计代码的 IO 铁律。扫描新增/修改的代码，对照 docs/architecture/io_contract.md §2 三条 IO 铁律（批量优先 / 禁止 N+1 / 禁止独立串行编排）与 §3-§5 聚合并行约束，结合 docs/architecture/ai_dev_guide.md §10.2 grep 锚 rule-id 索引（R-IO-*）机械执行。命中标 🟡 待复核（信号级），最终判定权在人工 reviewer。

- **Type:** Skill
- **Install:** `agentstack add skill-zuoyebang-aiweave-io-review`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [zuoyebang](https://agentstack.voostack.com/s/zuoyebang)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [zuoyebang](https://github.com/zuoyebang)
- **Source:** https://github.com/zuoyebang/aiweave/tree/main/templates/skills/io-review

## Install

```sh
agentstack add skill-zuoyebang-aiweave-io-review
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

审计代码的 IO 铁律与聚合并行约束。范围：`$ARGUMENTS`（空则审计 git diff main..HEAD）。

> 公共步骤模板见 [skills-spec/01_skill_authoring_guide.md](path) §A-§E。本 Skill 不生成代码，故第 5 步测试同步不适用。
>
> **本 Skill 是审计类 Skill（审计类第 6 个）**。"代码 ↔ IO 铁律"一致性审计。

## 第 0 步：🚫 模块 + 启用状态检查

1. 读 `BUILD_STATUS.md` §0 —— 命中 🚫 模块的文件**跳过**审计
2. 读 `INDEX.md` §0 AIWeave 采纳进度 —— 如 `docs-spec/25_io_aggregation` 标 ⬜ 未启用 → **跳过本 Skill**，提示"本工程未启用 25，跳过 io-review"

## 第 1 步：读取约束源

读以下文件（按顺序）：

1. `docs/architecture/io_contract.md` —— §1 IO 往返预算 + §2 三条铁律 + §2.1/§2.2 豁免登记 + §3 聚合器模式 + §4 并行原语 + §5 聚合约束
2. `docs/architecture/ai_dev_guide.md` §10.7 —— grep 锚 rule-id 索引（R-IO-*）
3. `docs/architecture/performance_contract.md` §4 —— 单次延迟预算（避免与 25 双源真相）
4. `docs/BUILD_STATUS.md` §11 —— 约束清单状态轨道

## 第 2 步：扫描代码范围

按 `$ARGUMENTS` 确定扫描范围：

- 空 / 当前 PR：`git diff main..HEAD --name-only` 取新增/修改的 .go 文件
- `loop-only`：仅取含 `for` / `range` 的文件
- 文件路径：直接以该路径为范围

## 第 3 步：依赖链分析（铁律二的关键）

对每段"连续多次读"的代码，判定查询间是否存在**真实数据依赖**：

- 后一次查询的入参取自前一次查询的结果（外键 / 返回字段）→ **真实依赖**，串行合法
- 后一次查询入参与前一次结果**无关** → **伪串行**，命中铁律二

依赖链是 io-review 区分"违规"与"必要串行"的核心，不可机械只看"连续 await"。

## 第 4 步：grep 锚检查

> grep 锚定位为"信号级"非"判定级"。所有命中标 🟡 待复核；最终判定由人工 reviewer 决定。
> 已在 io_contract.md §2.1 / §2.2 豁免登记表登记的位置 → 跳过；命中但未登记 → 标记。

### 检查 R-IO-N-PLUS-1：循环内单条查询（铁律一 / N+1）

```
范围：所有路径
grep 模式：'for [^{]*\{[\s\S]{0,300}?\.(Find|First|Take|Get|Query|Load|HGet|MGet?|Call)\('
误报排除：
  - 调用的已是批量 API（FindByIDs / In(...) / Pluck / Scan / 批量 MGET）
  - 循环次数硬编码 ≤ {Loop-safe-N}（如  🧩 **AIWeave 骨架 · 作者 XuRuibo**  · Apache-2.0 · 模板文件，复制到工程后按业务语义填充

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [zuoyebang](https://github.com/zuoyebang)
- **Source:** [zuoyebang/aiweave](https://github.com/zuoyebang/aiweave)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-zuoyebang-aiweave-io-review
- Seller: https://agentstack.voostack.com/s/zuoyebang
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
