# Domain Invariant Check

> 审计代码是否真正保护了领域不变量。扫描 service 方法，对照 docs/service/{module}_service.md §7 业务规则 / 隐式约束 / 业务状态机，校验伪码 [INVARIANT-CHECK: I-N] 标记与代码实现的一致性。命中标 🔴 严重（结构性问题）或 🟡 待复核。

- **Type:** Skill
- **Install:** `agentstack add skill-zuoyebang-aiweave-domain-invariant-check`
- **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/domain-invariant-check

## Install

```sh
agentstack add skill-zuoyebang-aiweave-domain-invariant-check
```

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

## About

审计代码 ↔ 领域不变量一致性。范围：`$ARGUMENTS`。

> 公共步骤模板见 [skills-spec/01_skill_authoring_guide.md](path) §A-§E。本 Skill 不生成代码。

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

1. 读 `BUILD_STATUS.md` §0 —— 命中 🚫 模块跳过
2. 读 `INDEX.md` §0 —— 如 `docs-spec/09 §7 领域不变量` 未启用 → 跳过本 Skill

## 第 1 步：读约束源

按顺序读：

1. `docs/service/{module}_service.md` §7 —— §7.1 业务规则 / §7.2 隐式约束 / §7.3 业务状态机
2. `docs/architecture/ai_dev_guide.md` §8.3 —— 领域不变量约束总清单
3. `docs/BUILD_STATUS.md` §11.3 —— 领域不变量启用状态（已设计 / 已启用条目数）

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

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

- 空：`git diff main..HEAD --name-only` 取新增/修改的 service / controller / models 文件
- `{module}`：`service/{module}/**/*.go`
- `{module}/{Method}`：聚焦该方法实现及其测试

## 第 3 步：4 项审计

### 审计 1：[INVARIANT-CHECK: I-N] 标记 ↔ 代码实现匹配率

```
对每个含 [INVARIANT-CHECK: I-N] 标记的方法：
  1. 查 §7.1 业务规则表中 I-N 对应的"不变量"条目
  2. 在该方法的代码实现中搜索对应的校验语句（如 if {amount-field}  🧩 **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-domain-invariant-check
- 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%.
