skill-host-compat
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Host Compatibility
Skill 宿主兼容性
Run the same host-compat gate CI uses on before opening a skill PR.
The check is for Codex and Cursor copies, not Claude-only runtime quality.
skills/在提交 Skill PR 前,对 运行与 CI 相同的宿主兼容性门禁。该检查针对 Codex 和 Cursor 副本,而非 Claude 专属的运行时质量。
skills/When to Activate
激活时机
- Adding or editing a skill under
skills/ - Copying a skill into or
.agents/skills/.cursor/skills/ - A review asks whether a skill is safe to install into Codex or Cursor
- CI reports findings
validate-skill-host-compat.js
- 在 下添加或编辑 Skill
skills/ - 将 Skill 复制到 或
.agents/skills/.cursor/skills/ - 审查中有人询问某个 Skill 是否可安全安装到 Codex 或 Cursor
- CI 报告 检查结果
validate-skill-host-compat.js
Core Concepts
核心概念
Canonical skills live in . Codex loads . Cursor loads a
smaller subset. CONTRIBUTING documents that sync as manual.
skills/.agents/skills/.cursor/skills/validate-skills.jsSKILL.mdnamedescriptiontests/ci/codex-skill-surface.test.js.agents/skills/- Claude-only substitutions in executable /
bash/shfences in Codex/Cursor projections (zsh,${CLAUDE_SESSION_ID},${CLAUDE_SKILL_DIR},${CLAUDE_PLUGIN_ROOT},${CLAUDE_PROJECT_DIR}) fail. Codex leaves those tokens as literal text. In a Codex copy, rewrite$ARGUMENTSto${CLAUDE_PROJECT_DIR}or an explicit path.$(pwd) - A Codex copy may only use ,
name,description,metadata, andlicense.allowed-toolsmay stay on the canonicalorigin: ECCcopy and must be stripped on the Codex copy.skills/ - A skill listed in that has a
agents/openai.yamldirectory must haveskills/. Cursor copies are optional; when present,.agents/skills/<name>/must match the directory.name: - CONTRIBUTING checklist items (When to Activate, Anti-Patterns, name
matches directory, 500/800 line caps) warn. They fail only with
.
--strict-checklist
validate-skills.js权威 Skill 位于 。Codex 加载 ,Cursor 仅加载规模较小的 子集。CONTRIBUTING 文档说明这些副本需要手动同步。
skills/.agents/skills/.cursor/skills/validate-skills.jsSKILL.mdnamedescriptiontests/ci/codex-skill-surface.test.js.agents/skills/- 在 Codex/Cursor 投影的可执行 /
bash/sh代码围栏中,仅限 Claude 使用的替换项(zsh、${CLAUDE_SESSION_ID}、${CLAUDE_SKILL_DIR}、${CLAUDE_PLUGIN_ROOT}、${CLAUDE_PROJECT_DIR})会导致失败。Codex 会将这些标记保留为字面文本。在 Codex 副本中,将$ARGUMENTS改写为${CLAUDE_PROJECT_DIR}或显式路径。$(pwd) - Codex 副本只能使用 、
name、description、metadata和license。权威allowed-tools副本可以保留skills/,但 Codex 副本必须将其移除。origin: ECC - 如果 中列出的某个 Skill 存在
agents/openai.yaml目录,则必须同时存在skills/。Cursor 副本是可选的;存在时,其.agents/skills/<name>/必须与目录名一致。name: - CONTRIBUTING 检查清单项目(激活时机、反模式、name 与目录名一致、500/800 行上限)会产生警告。仅在使用 时才会判定失败。
--strict-checklist
validate-skills.jsCode Examples
代码示例
From the repo root:
bash
node scripts/ci/validate-skill-host-compat.jsPrint counts without failing:
bash
node scripts/ci/validate-skill-host-compat.js --inventoryPromote checklist warnings:
bash
node scripts/ci/validate-skill-host-compat.js --strict-checklistSlash command:
/skill-host-compat
/skill-host-compat --inventory从仓库根目录运行:
bash
node scripts/ci/validate-skill-host-compat.js仅打印计数且不使检查失败:
bash
node scripts/ci/validate-skill-host-compat.js --inventory将检查清单警告升级为失败:
bash
node scripts/ci/validate-skill-host-compat.js --strict-checklist斜杠命令:
/skill-host-compat
/skill-host-compat --inventoryAnti-Patterns
反模式
Codex and Cursor projections must resolve Claude-only substitutions in executable blocks. Canonical Claude-scoped examples remain valid. POSIX and parameters are ambiguous and require review rather than failing this gate. This fence is the
forbidden pattern:
$1${1}bash
echo "${CLAUDE_SESSION_ID}"
ls "${CLAUDE_SKILL_DIR}"
node "${CLAUDE_PLUGIN_ROOT}/scripts/setup.js" $ARGUMENTS
cd "${CLAUDE_PROJECT_DIR}"Do not add or to a Codex copy under .
Do not treat a passing run as Codex-safe. Do not require
every entry to have a Cursor copy.
version:origin:.agents/skills/validate-skills.jsskills/Codex 和 Cursor 投影必须在可执行代码块中解析仅限 Claude 使用的替换项。限定于 Claude 范围的权威示例仍然有效。POSIX 和 参数含义不明确,需要人工审查,而不是由此门禁判定失败。以下代码围栏属于禁止模式:
$1${1}bash
echo "${CLAUDE_SESSION_ID}"
ls "${CLAUDE_SKILL_DIR}"
node "${CLAUDE_PLUGIN_ROOT}/scripts/setup.js" $ARGUMENTS
cd "${CLAUDE_PROJECT_DIR}"不要在 下的 Codex 副本中添加 或 。
不要将 运行成功视为 Codex-safe。
不要要求每个 条目都存在对应的 Cursor 副本。
.agents/skills/version:origin:validate-skills.jsskills/Best Practices
最佳实践
- Keep canonical if the CONTRIBUTING template calls for it.
origin: ECC - Drop ,
origin, andversionon the Codex copy.argument-hint - Show host-portable commands in bash fences (,
npx, or a resolved root). Rewriteeccin Codex copies to${CLAUDE_PROJECT_DIR}or an explicit path. Keep valid Claude-scoped forms in canonical instructions; resolve host variables in the target projection.$(pwd) - Run this script before when the change is a new skill.
npm test - Use to see checklist warning volume without failing the tree.
--inventory
- 如果 CONTRIBUTING 模板要求使用,则在权威副本中保留 。
origin: ECC - 从 Codex 副本中移除 、
origin和version。argument-hint - 在 bash 代码围栏中展示跨宿主可移植的命令(、
npx或已解析的根路径)。在 Codex 副本中,将ecc改写为${CLAUDE_PROJECT_DIR}或显式路径。在权威说明中保留有效的 Claude 专属形式;在目标投影中解析宿主变量。$(pwd) - 新增 Skill 时,在运行 前先运行此脚本。
npm test - 使用 查看检查清单警告数量,且不会使整个目录树判定失败。
--inventory
Related Skills
相关 Skill
- — runtime behavioral traces, not host-portability
skill-comply - — holistic audit of installed
skill-stocktake~/.claude/skills - — search existing skills before creating a new one
skill-scout
- ——运行时行为跟踪,而非宿主可移植性
skill-comply - ——对已安装的
skill-stocktake进行全面审计~/.claude/skills - ——创建新 Skill 前搜索现有 Skill
skill-scout