用途
shell-review 用于审查 shell 脚本,检查其正确性、安全性和可移植性。它适用于审查 shell 脚本或在提交 shell 改动之前使用。
主要能力
该技能提供了一套结构化的审查工作流,要求完成以下 TodoWrite 检查项:
- shell-review:context-mapped
- shell-review:exit-codes-checked
- shell-review:portability-checked
- shell-review:safety-patterns-verified
- shell-review:structure-checked
- shell-review:evidence-logged
- shell-review:findings-verified
工作流分为多个步骤:
- 梳理上下文(shell-review:context-mapped):识别 shell 脚本,检查 shebang,记录脚本用途、触发上下文、集成点(make、pre-commit、CI)以及预期的输入输出。
- 退出码审计(shell-review:exit-codes-checked)。
- 可移植性检查(shell-review:portability-checked)。
- 安全模式验证(shell-review:safety-patterns-verified)。
- 结构模式检查(shell-review:structure-checked)。
- 证据记录(shell-review:evidence-logged):使用 imbue:proof-of-work 记录带有 file:line 引用的发现,并汇总为关键问题、重大问题和小问题。
输出格式包含摘要、已审查脚本列表、退出码问题、可移植性问题、安全问题以及建议(Approve / Approve with actions / Block)。
验证发现依据时,将发现写入 .review/findings.json,运行引用验证器(Skill(imbue:review-core) Step 5),对验证器拒绝的发现予以丢弃或标注为 UNVERIFIED。
退出标准包括:验证退出码传播、记录可移植性问题、验证安全模式、验证结构模式、通过 imbue:proof-of-work 记录带有 file:line 引用的证据,以及每条上报的发现都带有经 citation_verifier.py 确认(退出码 0)的 Location 与逐字 Anchor,否则丢弃或标注为 UNVERIFIED。
使用方式
快速开始命令:
/shell-review path/to/script.sh
审查后,运行以下命令验证修复是否解决了已识别的问题:
shellcheck <script>
测试:
pytest plugins/pensive/tests/skills/test_shell_review.py -v
适用场景
- CI/CD 流水线脚本
- Git 钩子脚本
- 包装脚本(run-*.sh)
- 构建自动化脚本
- 预提交钩子实现
限制
不适用于以下情况:
- 非 shell 脚本(Python、JS 等)
- 无需审查的单行命令
其他限制暂未提供。