# Step Gate

把任意现有 skill 改造成受 step-gate 步骤门控的治理版（meta-skill：改造别的 skill 的 skill）

- Repository: https://github.com/daixudk96-max/agent-skill-gate (739 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-09-05
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add daixudk96-max/agent-skill-gate --skill step-gate -g -a claude-code -y`
Codex: `npx skills add daixudk96-max/agent-skill-gate --skill step-gate -g -a codex -y`
Cursor: `npx skills add daixudk96-max/agent-skill-gate --skill step-gate -g -a cursor -y`
Gemini CLI: `npx skills add daixudk96-max/agent-skill-gate --skill step-gate -g -a gemini-cli -y`

## Description

把任意现有 skill 改造成受 step-gate 步骤门控的治理版（meta-skill：改造别的 skill 的 skill）

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# step-gate

用途：当用户希望"保证 Agent 不能跳步骤"时，用本 skill 把任意未治理 skill
改造为带 step-gate 运行时门控的版本。门控由程序（step-gate 二进制）而非模型保证。

## 工作流程（必须按序执行）

1. 定位目标 skill 目录（含 SKILL.md 的目录，如 ~/.claude/skills/foo）。
2. 阅读 SKILL.md，确定步骤边界：优先人工确认，或取二级标题为候选。
3. 转换：运行本目录 tools/skill-converter.py <目标目录> <skill名> [--steps "id1|标题1|描述1,id2|标题2|描述2"]
   产物为母包（flow.yaml + guides/ + scripts/run.cmd|.sh + bin/ 全平台二进制）。
4. 编辑母包 flow.yaml：为每步填 validators 与 guides/<id>.md 必达内容（不能含 TODO: REQUIRED-GUIDE
   占位，否则 skill-pack 拒绝）。validator 四型：
   - type: file + path, , 产物存在（path 相对 Agent 调用启动器时的工作目录，下同）
   - type: non-empty + path, , 产物存在且非空白
   - type: contains + path + pattern, , 产物文本含指定子串（字段校验）
   - type: heading + path + pattern [+ level], , 产物含指定级别 Markdown 井号标题且标题文本含 pattern；level 缺省任意 1..=6
   条件流程用 branches（when: 条件 + then: 步骤，else 省略 when）：
   条件 type 同 file/non-empty/contains，由程序判定，未走备选自动标 skipped。
5. 改写母包 SKILL.md：在开头注入下节完整前导。
6. 验收（从工作目录调用 scripts/run.cmd|.sh 绝对路径，必须全部通过）：
   - status   -> 显示当前步与每步 delivery 状态（required/pending/delivered）
   - next     -> 两阶段交付当前步契约并提交回执（必须先 next 才能 complete）
   - complete -> 无产物/字段缺失/无回执/契约被改时必须失败退出(exit 1)
   - 修复产物后 complete -> 恢复推进
   - status --json -> 验证 admission_status/admission_valid 与 proofs
7. 分发：运行 tools/skill-pack.py <名> --zip（严格校验，失败 exit 2 不产出），得到 6 份 agent 分发包。

## 硬约束（不可违背）

The rest: https://github.com/daixudk96-max/agent-skill-gate/blob/HEAD/skills/step-gate/SKILL.md
