SuperAPI AI 工具集

dym-arex-skill-xuat-skill-sang-agent-khac

智能体与模型

查看项目

更新于 10-18 01:23

技能介绍

用途

该技能解决的是「不想整体切换到 DisCo,只想借用几个 repo skill 给当前 agent 用」的问题。它把 DisCo 中的 repo skill 导出到 Claude Code、Codex 或其他 agent,例如只借用 vllm、sglang 这类 repo skill。

主要能力

导出后会在目标 agent 的 skills root 下生成 <target-skills-root>/repositories/{repo-skills,repo-skills-router}/,并重新生成 repository-index.jsonl 和 router,使其只对应被选中的 skill 集合。

支持两种使用路径:

  1. 快捷路径——让 Creator 执行:
# Claude Code(skills root 为用户级)
disco --creator -p "/skill:import-repo-skills-to-agent import vllm and sglang to ~/.claude"

# Codex(当前用户的 agent root——不是旧的 ~/.codex)
disco --creator -p "/skill:import-repo-skills-to-agent import vllm and sglang to ~/.agents"

导入后需重启目标 agent。

  1. 精确路径——直接调用 helper 脚本:
cli/packages/coding-agent/src/disco/skills/import-repo-skills-to-agent/scripts/export_repo_skills_to_agent.mjs

选择性导出到 Codex:

node <技能路径>/scripts/export_repo_skills_to_agent.mjs \
  --source-agent-dir ~/.disco/agent \
  --target-agent-dir ~/.agents \
  --target-agent codex \
  --include-skill vllm \
  --include-skill sglang

全量、agent-neutral 导出到单一 skills root:

node <技能路径>/scripts/export_repo_skills_to_agent.mjs \
  --source-agent-dir ~/.disco/agent \
  --target-skills-root ~/.claude/skills \
  --target-agent agent-neutral

使用方式与参数

脚本参数(依据 export_repo_skills_to_agent.mjs 中的 parser):

  • --source-agent-dir <dir>:源 agent root。默认 $DISCO_CODING_AGENT_DIR,没有则 ~/.disco/agent。
  • --target-skills-root <dir>:目标本身已是 skills root(如 ~/.agents/skills、~/.claude/skills)。
  • --target-agent-dir <dir>:目标是 agent root,helper 会自动拼接 skills/repositories。
  • --target <dir> --target-kind skills-root|agent-root:当目录名无法自说明时的通用形式。
  • --target-agent codex|agent-neutral:codex 会额外插入 agents/openai.yaml,其中 policy.allow_implicit_invocation: false。
  • --include-skill <id>:可重复,或传逗号分隔列表。完全省略该参数即全量导出。
  • --overwrite-skill <id>:批准覆盖指定 skill。没有该参数时 helper 遇到冲突会拒绝。
  • --router-visibility enabled|disabled:仅在用户明确要求变更时使用;默认保持目标 router 原有 visibility。
  • --resume <transaction-dir>:中断后重跑已保存的同一 transaction。
  • -h, --help:打印帮助后以 0 退出。

退出码:0 表示提交成功;2 表示所有错误(若已进入 mutation 阶段则附带回滚)。没有其他退出码。未知参数会报 ExportError: unknown argument: <x> 并以 2 退出。

helper 的执行流程(9 步,带事务)

  1. 校验源/目标、symlink 安全、skill 标识、repo-routing-metadata.json v2、assignment taxonomy,以及源与目标不重叠。
  2. 生成按所选集合过滤的 router——不改动源 collection。
  3. 按 skill_id + owner/repository 把所选记录与目标中不相关的记录混合。
  4. 暂存最终的 repo-skills/ 目录树。
  5. 对 Codex 目标:在每个根级和子级 SKILL.md 旁添加/更新 agents/openai.yaml,repo-skills-router 除外。
  6. 从混合后的记录重新生成 repository-index.jsonl 和 router(不复制旧 index,不拼接 Markdown)。
  7. 重新校验 taxonomy、链接、index、router visibility、选中/未选中边界、Codex policy。
  8. 仅通过已持久化的事务替换目标下的 repositories/repo-skills/ 和 repositories/repo-skills-router/。
  9. 校验已安装版本后提交——若 mutation 之后的步骤失败,则恢复目标原有状态。

可验证约束:原始 repository-index.jsonl 必须与 repo-skills-router/references/index/repositories.jsonl 逐字节一致。子集导出不得把未选中的 skill 泄漏进任何 index 或 area/family 页面。目标中已有的不相关 repository skill 必须保持原样。

中断恢复

helper 会打印 transaction 目录。中断后重跑同一 transaction:

node <技能路径>/scripts/export_repo_skills_to_agent.mjs --resume /path/to/transaction-dir

不要手工修补未完成的目录树。无需重新输入参数;但重新输入的参数必须与 manifest 一致,不一致时 resume 会在 mutation 前停止。若回滚无法恢复正确快照,保留它报告的 staging/backup 路径并停下人工检查。

在目标 agent 中的使用

repo-skills-router 保持 model-visible 状态;各 repo skill 仍对隐式选择隐藏(通过 portable frontmatter,Codex 则额外通过仅作用于目标的 OpenAI policy)。也就是说在 Claude Code 中需要调用 router 或直接调用 skill,它不会自动进入每段对话。

注意:如果 ~/.claude/skills 或 ~/.agents/skills 已有大量 skill,helper 只触碰 repositories/ 子目录,其余部分不受影响。

注意:每个 repo skill 在 SKILL.md 中带有各自的 license。复制到其他 agent 属于 redistribute 行为,需先检查该字段。

适用场景

  • 只想借用个别 repo skill(如 vllm、sglang)给当前使用的 agent。
  • 需要把 skill 导出到 Claude Code、Codex 或其他 agent。
  • 需要选择性导出或全量导出,并保持目标已有 skill 不受影响。

限制

  • 导入后需重启目标 agent。
  • 覆盖已有 skill 需显式 --overwrite-skill,否则 helper 拒绝冲突。
  • 复制 repo skill 涉及 license 与 redistribute,需自行检查。
  • 关于收费、价格、平台支持范围等事实,资料未提供。