文档目录

Foundation 对外提供两个命令行可执行入口:来自 skill-family-engineering-kit 的 skill-family-kit,以及来自 skill-family-harness-node 的 skill-family-token-estimate。本页所有子命令、开关与退出码均严格对齐源码参数规范。

一、skill-family-kit:四大顶层命令与退出码#

skill-family-kit 固定只有四个顶层命令(scaffold、adopt-plan、projection、check),不存在第五个顶层命令;报告、依赖、监控与宿主模拟均作为这四个顶层命令下的位置子动作提供。

退出码含义与触发条件
0命令执行完成,或只读检查未发现任何违规项
1check 系列诊断发现契约违例、文件漂移、未登记文件、依赖滞后、技能遮蔽或报告硬失败(SFC3001–SFC3003)
2命令或参数被拒绝(SFC2002 / SFC2003)、请求了不存在的自动修改开关,或运行期机制前置条件不满足(SFC2004)

1. scaffold:空目录骨架与宿主构建#

只在空目录(或父目录已存在的新路径)内原子写入项目骨架,目标非空时直接拒绝且零触碰。

bash
# 生成全新技能族工程骨架
npx skill-family-kit scaffold \
  --root ./my-skill-family \
  --project-id my-skill-family \
  --project-name "My Skill Family" \
  --profile generic \
  --capability foundation.harness.atomic-write

# 将宿主适配源闭包原子构建到不存在的目标子目录
npx skill-family-kit scaffold host-build \
  --root . \
  --host claude \
  --path-category claude-project-skills \
  --input build/adapter-source.json \
  --out dist/claude-adapter
子动作与调用开关取值要求与作用说明
scaffold --root <dir>目标工程根目录(必须为空目录或尚未创建的子路径)
--project-id <id> / --project-name <name>kebab-case 项目标识与人类可读名称(省略时由目录名推导)
--profile <id>工程 Profile 标识(默认 generic)
--licensing-profile <id> / --licensing-variant <id>许可证 Profile 标识及多变体 Profile 必填的变体 ID;可选 --profiles-root <dir>
--capability <id>声明初始采用的稳定能力 ID(允许重复传入多次,自动去重排序)
--engineering <json>可选的声明式 engineering 元数据 JSON 字符串
scaffold host-build配合 --root <dir>、--host <id>、--path-category <id>、--input <relpath>、--out <relpath> 及可选 --hosts-root <dir> 物化宿主适配包

2. adopt-plan:存量规划、能力检索与受控接入#

默认无子动作的 adopt-plan 严格只读(连临时文件都不产生),向标准输出打印存量接入计划 JSON;显式跟上 apply、capability、deps 子动作时,才在 --root 收容边界内更新对应清单文件。

bash
# 只读生成存量仓库接入计划(禁用 git 子进程探测可加 --no-git-spawn)
npx skill-family-kit adopt-plan --root . --project-id my-skill --no-git-spawn

# 查询 Foundation 公共能力目录(支持单需求过滤或精确能力展开)
npx skill-family-kit adopt-plan --list-capabilities --locale zh-CN --filter "lock" --limit 5
npx skill-family-kit adopt-plan --list-capabilities --locale zh-CN --capability foundation.harness.atomic-write

# 受控补齐存量仓项目清单与骨架(不覆盖已有业务文件)
npx skill-family-kit adopt-plan apply --root . --dry-run
npx skill-family-kit adopt-plan apply --root . --update-manifest --json

# 管理项目已声明采用的公共能力
npx skill-family-kit adopt-plan capability add --root . --id foundation.harness.bound-read
npx skill-family-kit adopt-plan capability remove --root . --id foundation.harness.bound-read --dry-run

# 受控抬升内部依赖最低版本,或建立/解除本地工作区联调覆盖
npx skill-family-kit adopt-plan deps bump-min --root . --package skill-family-harness-node --to 0.39.4 --json
npx skill-family-kit adopt-plan deps --link-workspace ../local-support-repo --root . --dry-run
npx skill-family-kit adopt-plan deps --unlink-workspace --root .
子动作与调用开关取值要求与作用说明
adopt-plan(默认只读规划)支持 --root <dir>、--project-id <id>、--project-name <name>、--profile <id>、--licensing-profile <id>、--licensing-variant <id>、--profiles-root <dir>、--no-git-spawn、--engineering <json>,以及成对使用的 --engineering-baseline <rel-json> + --compare-skeleton
adopt-plan --list-capabilities必填 --locale <en|zh-CN>;支持 --all --scope <scope> [--uses <rel-json>]、[--scope <scope>] [--filter <text>] [--limit <1..10>] 或 --capability <exact-id>
adopt-plan apply复用探测结果受控写入缺失清单;支持 --root、--project-id、--project-name、--profile、--licensing-profile、--licensing-variant、--profiles-root、--capability(可重复)、--no-git-spawn、--dry-run、--update-manifest、--format <json|text>、--json
adopt-plan capability <list|add|remove>查询或增删 adoptedCapabilities;add/remove 必填 --id <cap>,支持 --root、--dry-run、--format <json|text>、--json
adopt-plan deps支持 bump-min(或 --bump)配合 --package <pkg>(可重复)、--to <ver>、--verified-ceiling <ver>、--clear-ceiling、--allow-major-upgrade;或本地联调 --link-workspace <sourceRoot> / --unlink-workspace;通用可选 --root、--workspace-root、--catalog、--session-id、--resolved-at、--receipt-out、--dry-run、--json
adopt-plan host-describe | host-probe | host-plan宿主只读探测与规划:host-describe 接受 --host <id> [--hosts-root <dir>];host-probe 额外支持 --allow-host-spawn --host-executable <abs-path>;host-plan 接受 --root、--host、--path-category、--build-manifest <rel>、--probe-facts <rel>

3. projection:受管生成物与确定性报告投影#

只向 manifest 显式授权且被登记为受管(managed)的路径写入生成物,遇到手写文件或越界路径立即中止且零写入。

bash
# 按默认 skill-family.projection.json 执行受管投影(POSIX 环境)
npx skill-family-kit projection --root . --manifest skill-family.projection.json

# 将契约校验通过的 report-model 渲染为确定性 Markdown 报告并生成三摘要绑定
npx skill-family-kit projection report \
  --root . \
  --model artifacts/report-model.json \
  --result artifacts/operation-result.json \
  --out artifacts/report.md \
  --binding artifacts/report-binding.json

4. check:九类诊断、登记重锁与运行期检查套件#

bash
# 运行全量诊断或通过 --only 指定单一诊断类
npx skill-family-kit check --root .
npx skill-family-kit check --root . --only drift --no-git-spawn

# 入口契约静态门禁(legacy 或 declared 策略)
npx skill-family-kit check entries --root . --policy declared

# 登记新增手写文件并重算受管文件锁(单次原子事务)
npx skill-family-kit check relock --root . --files "skills/demo/SKILL.md" --registration-class handwritten

# 运行期环境体检、内部依赖拓扑检查与监控快照
npx skill-family-kit check prereqs --root . --require-env OPENAI_API_KEY --format json
npx skill-family-kit check deps --topology --format text
npx skill-family-kit check monitor snapshot --root . --json
check 子动作支持的调用参数与用途说明
check(默认九类诊断)--root <dir>、--only <contracts|drift|closure|version|docs|git|identity|boundary|platform>、--policy <legacy|declared>、--profiles-root <dir>、--no-git-spawn,及成对传入的 --conclusion-root <dir> --conclusion-output <rel>
check entries检查技能入口契约与上下文词元预算;支持 --root、--policy <legacy|declared>、--conclusion-root、--conclusion-output
check relock登记新文件并刷新 skill-family.managed-file-lock.json;支持 --root <dir>、--files <relative-paths>、--registration-class <handwritten|trackedToolLocks|artifacts>
check register-existing为已有 profile.json 的非空仓库首次生成三份闭世界登记;必填 --root <dir> --handwritten <globs>,可选 --engineering <json>、--tracked-tool-locks <paths>、--artifacts <patterns>
check report对已渲染报告做硬失败(SFC3001–SFC3003)与风格分级诊断;必填 --report <rel>、--model <rel>、--result <rel>,可选 --root、--binding <rel>
check proof / check proof-createproof 只读读取证明(--proof-root <dir> --proof <rel> [--json]);proof-create 从静态审阅输入排他生成证明(--review-root <dir> --review-input <rel> --conclusion-root <dir> --conclusion-output <rel> [--json])
静态声明与绑定核验子动作check selected-artifacts、check branch-fields、check public-surface-bindings、check native-entry-bindings、check skill-surface-bindings、check native-projections 均接受 --root <dir> --selection <rel> [--json];check source-generated 接受 --root <dir> --declaration <rel> [--json]
check qualification显式宿主资格验证:接受 --root <dir>、--capability <id>、--request <rel>、--bindings <rel> 及确认启动原生进程的 --native
check host-loading只读检查项目技能容器:--root <dir>、--host <id>、--host-version <ver>、--path-category <id>,可选 --activation-rules <rel>(仅 Codex)与 --hosts-root <dir>
check deps [resolve]只读解析内部依赖兼容版本、检查支撑仓滞后或输出 0–3 层发布拓扑;支持 --root、--catalog、--session-id、--resolved-at、--receipt-out、--workspace-root、--topology、--format <json|text>、--json
check shadowing多层同名技能遮蔽排障(兼容别名 check check-shadowing);支持 --root、--project-root、--plugin-root(可重复)、--user-home、--host、--hosts-root、--layer <scope:dir>(可重复)、--format <json|markdown>、--json
check monitor <serve|ensure|register|snapshot>只读观测 state-store、token-lock 与子进程运行态或委托工作台;按子动作支持 --root、--port、--registry、--lock-warn-ms、--allowed-root(可重复)、--id、--title、--state-dir、--plan、--runs-dir、--lock-path(可重复)、--target、--no-spawn、--timeout-ms、--workbench-url、--json
check capability [list]只读列出当前已声明采用的公共能力;支持 --root <dir>、--format <json|text>、--json
check prereqs前置环境体检(兼容别名 check check-prereqs,检查环境变量存在性且绝不回显敏感值);支持 --root、--require-python、--require-env <VAR>(可重复)、--skill-file <path> --loaded-sha256 <hex>、--latest-versions <json-or-file>、--format <json|text>、--json
check host-sim <run|materialize-shims|list-hosts>十宿主本地沙箱生命周期模拟;run 支持 --root、--hosts、--output、--prompt、--hosts-root、--format、--json;materialize-shims 支持 --output-dir、--hosts、--hosts-root、--json;list-hosts 支持 --json

二、skill-family-token-estimate:确定性词元估算器#

在控制 SKILL.md 体积或审计上下文预算时,skill-family-harness-node 随包提供零写入的 skill-family-token-estimate 命令。输入源(--text、--file、--stdin)必须三选一,缺省或同时传多个输入源都会以退出码 2 拒绝。

bash
# 估算单个 SKILL.md 文件的权威词元数(默认 --estimator tokens)
npx skill-family-token-estimate --file skills/my-skill/SKILL.md

# 同时输出权威词元记录与 UTF-8 字节上界记录
npx skill-family-token-estimate --file skills/my-skill/SKILL.md --estimator both

# 从标准输入管道或字面字符串估算
cat skills/my-skill/SKILL.md | npx skill-family-token-estimate --stdin --estimator upper-bound
npx skill-family-token-estimate --text "检查技能入口词元预算"
输入与模式开关说明与输出结构
--text <string> / --file <path> / --stdin三者恰好提供一个输入源;读取 UTF-8 文本且不写入任何磁盘文件
--estimator tokens默认模式;输出携带估算器身份、版本号与词元计数的确定性 JSON 记录
--estimator upper-bound输出基于 UTF-8 字节长度计算的保守词元上界 JSON 记录
--estimator both输出 { "tokens": { ... }, "upperBound": { ... } } 组合 JSON 对象
--help / -h打印用法说明并以退出码 0 退出(成功退出 0,参数或文件读取失败退出 2)

遇到执行报错或退出码非 0 时,可对照下一页 常见报错与排障手册 快速恢复。

搜索文档

↑ ↓ 选择 · Enter 跳转Esc 关闭
Skill Family Foundation
图表预览