Skip to content

About

Agent-agnostic skill kit: one source of truth, installable into DSH, Codex, Claude Code, Cursor, Gemini CLI, GitHub Copilot. 跨 Agent 复用:一份技能源一键投递七类 Agent,可作 Claude Code / Cursor 插件安装。

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

agent-skill-kit

tests

跨 Agent 复用的技能包:技能源文件统一放在 skills/,由安装脚本投递到各个 Agent 的技能目录。一份技能同时可用于 DSH、Codex、Claude Code、Cursor、Gemini CLI、GitHub Copilot,以及遵循 .agents 约定的其他工具。

A small, agent-agnostic skill kit. One source of truth under skills/, one installer that copies or links each skill into the directory your agent already reads.

它解决什么问题

多会话、多 Agent 的长期项目里,最贵的不是写代码,是每次会话重新建立起"这个仓库发生过什么":

症状 你会听到的话 本技能的对应机制
新会话从零摸仓库 「接着上次做」——然后 agent 又去 glob 一遍目录 维度上下文:9 个维度按任务类型按需读,入口文件只做指向、不复述正文
忘了为什么这么改 「这个仓库之前怎么改的」「为什么这里这么设计」 变更锚点 + 过期检测:维度文件靠哈希自动判过期,refresh 直接告诉你哪份结论已失效
不知道做到哪、下一步做什么 「任务排一下,接下来做哪个」 任务台账 + 可执行前沿:plan.md 字段聚合成 TASKS.md,next 算出现在能做什么、被谁挡着
两个会话撞同一个任务 一个人也会并发 认领 + 租约:--claim 建 .claim 锁,未到期强抢要 --force,超时可接管
收工前"忘了跑检查" 「收工前把门跑一遍」 六道门 + hook 片段:一条命令一个退出码,能挂 pre-commit 与 Stop hook

边界同样要写清,否则它会被当成万能筐:

  • 不排优先级、不推工期——那是业务判断,脚本排了只会误导;next 只回答"卡在哪个 depends 上"。
  • 本身不持有强制力——装 hook 才有,没装就只有纪律(默认不安装,见下文)。
  • ai/ 默认不进版本库——跨机协作是".claim 随库同步 + git 冲突可见 + 租约过期兜底",不是分布式锁。
  • 文书越少越省——任务 <5 分钟、纯问答、无多会话价值时,它自称不适用,直接干活不写任何文书。

5 分钟上手

python skills/project-task-sop/sop.py init  --root <项目根>    # 建 ai/ + manifest + 维度骨架
python skills/project-task-sop/sop.py scan  --root <项目根>    # 按真实文件填维度 1/2/4/5/6/8 的事实初稿(标「待复核」)
python skills/project-task-sop/sop.py gates --root <项目根>    # 六道门一次跑完,红了给修法

scan 只写事实、不做架构判断;维度 3/7/9 这类语义判断补完,再 refresh --mark-fresh 封存。之后每次开工先 next,动手前 next --claim <id>。

目录结构

agent-skill-kit/
├─ install.ps1           # Windows / PowerShell 安装器
├─ install.sh            # macOS / Linux 安装器
├─ tests/
│  ├─ test_sop.py        # sop.py 命令行回归(42 例)
│  ├─ test_scan.py       # init 后自动推导 scan 的行为契约(12 例)
│  ├─ test_gates.py      # 六道门聚合与 hook 友好参数(9 例)
│  ├─ test_budget.py     # 上下文税预算:锚点外移/摘要封顶/软告警门(8 例)
│  ├─ test_next.py       # 可执行前沿:波次/阻塞原因/成环/缺失引用(10 例)
│  ├─ test_claim.py      # 认领:owner/租约锁/抢占/释放/告警(16 例)
│  ├─ test_tasks_archive.py # tasks --archive 归档:裁行/自洽/幂等/漂移告警(6 例)
│  ├─ test_tasks_json.py # tasks --json 全量快照:派生依赖/认领租约/只读(7 例)
│  ├─ test_migrate.py    # v3→v4 迁移:不覆盖/不落盘/摘要注入/手工区保留(13 例)
│  ├─ test_install_targets.py # ps1/sh 目标一致 + 三家新目标路径(5 例,2 例按平台跳过)
│  ├─ test_plugin_manifests.py # 两端 plugin/marketplace 清单契约(7 例)
│  └─ test_version_sync.py # 五处版本号 + frontmatter 子命令清单 + 触发面 + token 预算守卫(7 例)
│                        # 合计 142 例定义、本机实跑 140(2 例按平台跳过),标准库 unittest,无第三方依赖
├─ .claude-plugin/       # Claude Code 插件清单 + 市场目录
│  ├─ plugin.json
│  └─ marketplace.json
├─ .cursor-plugin/       # Cursor 插件清单 + 市场索引
│  ├─ plugin.json
│  └─ marketplace.json
├─ skills/               # 唯一事实源:每个技能一个目录
│  └─ project-task-sop/
│     ├─ SKILL.md
│     ├─ sop.py
│     ├─ reference/      # 9 篇按需加载的规范(入口 / 台账 / 教训 / 迁移 / 版本详述 …)
│     └─ templates/      # 4 个产物模板(plan / NOTES / 索引 / 维度)
├─ .gitattributes        # 统一 LF、UTF-8
├─ .gitignore            # 忽略各 Agent 的本地安装产物 + 项目 ai/ 上下文
└─ LICENSE               # MIT

仓库内不放 AGENTS.md。ai/ 上下文目录不进版本库,仓根入口会指向不存在的文件; 入口文件(sop.py entry 生成)放在项目目录、与 ai/ 同级,见 reference/repo-entry-file.md。

包含的技能

技能 用途 版本
project-task-sop 轻量项目任务执行规程:规模决策门(light/standard/full)、init 后自动推导维度初稿(scan)、模块化上下文索引、任务台账(完成状态 + 相互关联 + 认领/租约,支持存量补录与 tasks --archive 归档)、可执行前沿(next:现在能做什么、被谁挡着)、认领与释放(next --claim/--release)、仓库入口文件生成与落点决策、JSONL 实验去重、教训检索、决策点审计笔记、六道门一次跑完(gates,含 budget 软告警);可直接作为 Claude Code / Cursor 插件安装 4.14.0

六道门与强制力

六道门(结构校验 / 维度新鲜度 / 归属审计 / 入口校验 / 台账校验 / 上下文预算)合成一条命令:

python skills/project-task-sop/sop.py gates --root <项目根>

逐项打 ✅ / ❌ / ~(entry 未配置时是跳过,不算红),任一失败退出码 1,并打印对应修法。budget 超限只打 ⚠️(不进失败、不改退出码,避免"一红就改阈值")。--json 输出单行机器可读结果,--skip-if-missing 让未接入 SOP 的项目安静放行——正因为后两者,它才能直接挂到机制上:

  • git pre-commit:提交前拦红门;
  • Claude Code Stop hook:一轮结束前跑一次,避免"说完了才发现门是红的"。

片段在 SKILL.md 的「强制力」小节。默认不安装:hook 会改变每次提交/每轮对话的行为,装不装是使用者的选择。这个技能本身不持强制力——装了才有,没装就只有纪律。

台账驱动:next 回答"现在能做什么"

ai/TASKS.md 是一张表,next 把它变成队列——按每个任务 plan.md 里的 status + depends 算出可执行前沿:

python skills/project-task-sop/sop.py next --root <项目根>
next: 5 个任务 / 3 个未完成

第 1 波(现在可做)
  - `draft` [doing] 起草规范
  - `tests` [pending] 补回归用例
第 2 波(等前序)
  - `release` [pending] 发版 ← 等 `tests`(pending)
  • 只算约束,不排优先级:谁先做是业务判断,脚本排了只会误导;它只回答"卡在哪个 depends 上"。
  • dropped 的前置不阻塞后继,行内标「前置已放弃」;引用缺失或 depends 成环进「无法排序」,退出码仍是 0。
  • --json 给自动化用:ready / blocked / unsorted / waves。
  • tasks --json 是另一份视图:next --json 给"前沿",tasks --json 给全量快照——每个任务的 status/owner/claim{owner,claimed,lease,minutes_left},外加算好的 depends_open / depends_missing / blocked_by 与 stats。只读,不写台账,脚本不必解析 Markdown。
  • 认领:next --claim <id> 写 owner/claimed + status=doing,并在 ai/<task>/.claim 建租约锁;next --release 释放。同机靠 O_EXCL 原子创建互斥,未到期抢占要 --force,超时(默认 120 分钟)可接管;tasks --check 会报超时/缺锁/owner 不一致。跨机不是分布式锁——ai/ 进库时靠 .claim 随库同步 + git 冲突可见 + 租约过期兜底。细节见 reference/task-ledger.md。
python skills/project-task-sop/sop.py next --claim tests --as alice@pc --lease 90 --root <项目根>
python skills/project-task-sop/sop.py next --release tests --root <项目根>

它到底拦住了什么(可度量,不吹)

README 里不放没有依据的百分比。这个仓库能自证的是结构和门禁,不是"省了多少时间":

可核对的事实 怎么核对
140 个回归用例(142 定义,2 例按平台跳过)、零第三方依赖 python -m unittest discover -s tests
六道门一个退出码 sop.py gates --root .(--json 给自动化;--skip-if-missing 给未接入项目放行)
五处版本号同源、历史表升序无重复 tests/test_version_sync.py(改版本漏一处就红)
主文档 token 预算(SKILL ~5.5k / ≤6000,changelog ≤4000) tests/test_version_sync.py::test_skill_body_within_token_budget;sop.py tokens SKILL.md 复核
台账与 plan.md 不漂移 sop.py tasks --check(状态枚举 / id 唯一 / 引用存在 / 成环 / 同步 / 认领租约告警)
上下文过期可发现 sop.py refresh(逐维度列出"锚点变了还是新增了")

使用中可观测的只有事实现场,不是收益数字:next --json 的波次与阻塞原因、tasks --json 的 stats 与派生 depends_open/blocked_by、gates --json 的逐门结果、refresh 报出的过期维度数。

没实测的部分(如实标注):本机无 claude CLI、也无 Cursor,插件真实安装流程与 claude plugin validate 未跑过,只由 test_plugin_manifests.py 保证清单可解析、路径可解析、两端名称与版本同源。

回归测试

python -m unittest discover -s tests -v      # 140 用例(142 定义,2 例按平台跳过),约 70 s,全部在临时目录里跑

sop.py 是纯标准库实现的单文件 CLI,改完至少跑一遍:

python skills/project-task-sop/sop.py init --root <项目根>
python skills/project-task-sop/sop.py scan --root <项目根>          # 自动填充维度 1/2/4/5/6/8 的事实初稿
python skills/project-task-sop/sop.py check --context --root <项目根>
python skills/project-task-sop/sop.py refresh --mark-fresh --root <项目根>
python skills/project-task-sop/sop.py audit --root <项目根>
python skills/project-task-sop/sop.py entry --check --root <项目根>
python skills/project-task-sop/sop.py tasks --check --root <项目根>
python skills/project-task-sop/sop.py next --root <项目根>        # 可执行前沿(第 1 波现在可做 / 后续波次 / 阻塞原因)
python skills/project-task-sop/sop.py gates --root <项目根>       # 六道门一次跑完(收工前/CI/pre-commit 用)
# 存量项目首次接入台账(先预览,确认后再落盘)
python skills/project-task-sop/sop.py tasks --backfill --dry-run --root <项目根>

测试全部在临时目录里跑,不会碰到你自己的 ai/ 上下文目录。

CI 检查什么(.github/workflows/test.yml)

推送 main 与 PR 时,在 Ubuntu 22.04 / Windows × Python 3.9 / 3.13 上跑(3.9 钉在 ubuntu-22.04:ubuntu-latest 已是 26.04,官方不再为它构建 3.9):

  • python -m unittest discover -s tests -v —— 全部回归用例(含 test_version_sync.py);
  • python skills/project-task-sop/sop.py --help —— CLI 能起、子命令齐全;
  • 版本同步校验:五处版本号必须相同(SKILL 标题 / 历史表末行 / README 技能表 / sop.py docstring / --help),历史表必须升序无重复,frontmatter description 必须列出全部子命令。

check --context、entry --check、tasks --check 这几道门依赖项目自己的 ai/ 目录,而 ai/ 不进版本库,所以不在 CI 里跑——它们是每个项目本地的门,见上面的命令清单。

安装

git clone https://github.com/pstruggle/agent-skill-kit.git
cd agent-skill-kit
pwsh ./install.ps1 -Target all -Scope user
git clone https://github.com/pstruggle/agent-skill-kit.git
cd agent-skill-kit
./install.sh --target all --scope user

默认装到每个 Agent 的用户级技能目录(-Scope user)。只想装某一个 Agent 就换成 -Target codex。

安装到哪里

Target Scope 目标目录
dsh user $DSH_HOME/skills(默认 ~/.dsh/skills)
dsh project <project>/.dsh/skills
codex user / project $CODEX_HOME/skills(默认 ~/.codex/skills)
claude user ~/.claude/skills
claude project <project>/.claude/skills
agents user ~/.agents/skills
agents project <project>/.agents/skills
cursor user ~/.cursor/skills
cursor project <project>/.cursor/skills
gemini user ~/.gemini/skills
gemini project <project>/.gemini/skills
copilot user ~/.copilot/skills(个人 skills 目录)
copilot project <project>/.github/skills(项目级是 .github,不是 .copilot)
custom — -Dest / --dest 指定的任意目录

Codex 只从 CODEX_HOME 发现技能,所以 -Scope project 对 codex 仍写入 $CODEX_HOME/skills;-ProjectRoot 影响 DSH / Claude / agents / Cursor / Gemini / Copilot 的项目级目录(Copilot 落 .github/skills)。

参数

PowerShell shell 说明
-List --list 列出技能与将要写入的目录,不落盘
-Target --target dsh、codex、claude、agents、cursor、gemini、copilot、all,可逗号分隔多选
-Scope --scope user(默认)或 project
-Skill --skill 只装指定技能,逗号分隔;缺省为全部
-Mode --mode copy(默认,复制文件)或 link(Windows 用 junction,Unix 用符号链接,跟随 skills/ 的改动)
-ProjectRoot --project-root -Scope project 时的项目根,默认当前目录
-Dest --dest 额外安装到一个自定义目录
-Force --force 覆盖已存在的同名技能
-DryRun --dry-run 只打印将执行的动作
-Uninstall --uninstall 从目标目录移除技能

示例:

# 看清单
pwsh ./install.ps1 -List

# 装进某个项目的 DSH 项目级技能目录
pwsh ./install.ps1 -Target dsh -Scope project -ProjectRoot C:\work\my-app

# 用链接方式装到 Codex / Claude,改 skill 源文件即时生效
pwsh ./install.ps1 -Target codex,claude -Mode link

# 装到 Cursor / Gemini CLI / Copilot(用户级)
pwsh ./install.ps1 -Target cursor,gemini,copilot

# 升级已装的技能
git pull
pwsh ./install.ps1 -Target all -Force

# 卸载
pwsh ./install.ps1 -Uninstall -Target claude -Skill project-task-sop
./install.sh --list
./install.sh --target dsh --scope project --project-root ~/work/my-app
./install.sh --target codex,claude --mode link
./install.sh --uninstall --target claude --skill project-task-sop

用 Codex 自带的安装器直接装

不动本仓库,也可以让 Codex 从 GitHub 直接拉取:

python <skill-installer>/scripts/install-skill-from-github.py \
  --repo pstruggle/agent-skill-kit \
  --path skills/project-task-sop

作为插件安装(Claude Code / Cursor)

仓库根同时是插件根:skills/ 就在根上,两端默认发现规则都是在插件根找 skills/<name>/SKILL.md,所以同一份源文件既能用安装器投递,也能整仓当插件装。

Claude Code:

claude plugin marketplace add pstruggle/agent-skill-kit   # 把本仓库登记为 marketplace(名字 agent-skill-kit)
claude plugin install project-task-sop@agent-skill-kit   # 安装插件,格式:条目名@市场名

会话内等价指令是 /plugin marketplace add … 与 /plugin install …;技能调用时带插件名前缀。

Cursor:

  • 单机试用:把本仓拷到 ~/.cursor/plugins/local/project-task-sop/,重启 Cursor(或 Developer: Reload Window),在 Customize 里确认技能出现;
  • 团队/市场分发:Dashboard → Plugins & MCPs → Add Marketplace → Import from Repo 填本仓库 URL(Team / Enterprise 计划才有团队市场);上架公开市场走 cursor.com/marketplace/publish,由 Cursor 人工审核。

四份清单各管什么:

文件 作用
.claude-plugin/plugin.json Claude 插件清单:name 是唯一必填项;version 写死后就是更新缓存键,每次发版必须 bump,省略则退化为 git commit SHA
.claude-plugin/marketplace.json Claude 市场目录:name / owner / plugins 必填;条目 source: "." 表示插件就是仓库根
.cursor-plugin/plugin.json Cursor 插件清单:name 必填(小写 kebab-case);skills/ 默认发现
.cursor-plugin/marketplace.json 多插件仓库的市场索引:name / owner / plugins(≤500 条),metadata 可选

还没验证的部分:本机没有 claude CLI,也没有 Cursor,所以 claude plugin validate 与真实安装流程都没跑过。能自证的是 tests/test_plugin_manifests.py 覆盖的那些——JSON 可解析、名称合规、skills/<name>/SKILL.md 真实存在、两端 name 与 version 同源、marketplace 的 source 能解析到插件根。

新增一个技能

  1. 在 skills/ 下新建目录,目录名用 kebab-case(^[a-z0-9]+(?:-[a-z0-9]+)*$)。
  2. 目录内放 SKILL.md,frontmatter 至少包含 name 与 description,且 name 与目录名一致。
  3. 重新执行安装脚本(加 -Force / --force)即可投递到各 Agent。
  4. 在本 README 的「包含的技能」表格里补一行。

设计约定

  • skills/ 是唯一事实源;.dsh/、.codex/、.claude/、.agents/、.cursor/、.gemini/、.github/skills/ 都是 -Scope project 的安装产物,已在 .gitignore 中排除——不排除的话,项目级安装会往仓库里塞一堆不该入库的技能副本。
  • ai/ 与 .experiments.jsonl 同样在 .gitignore 里:上下文体系统一留在项目目录、不随仓库分发——这也是「仓库内不放 AGENTS.md」的原因(仓根入口会指向 clone 者看不到的 ai/context)。
  • link 模式便于边改边用;copy 模式便于固定版本、避免被测 Agent 直接改到源文件。
  • 所有文本文件按 LF 存储、UTF-8 无 BOM 编码(见 .gitattributes),中文内容在 Windows 下也不会乱码。
  • 安装脚本只操作目标根目录之下的路径,越界即报错退出。

English

agent-skill-kit keeps every skill in skills/<name>/SKILL.md and ships two installers that copy or link those folders into the skill directory your agent already reads (DSH, Codex, Claude Code, or the .agents convention).

git clone https://github.com/pstruggle/agent-skill-kit.git
cd agent-skill-kit
./install.sh --target all --scope user      # or: pwsh ./install.ps1 -Target all -Scope user

Run --list to see the skills and destinations, --mode link to symlink instead of copy, --uninstall to remove, --help for the full flag list.

Inside skills/project-task-sop, sop.py is a stdlib-only CLI that maintains the project's ai/ context (init / scan / refresh / check / audit / entry) and the task ledger (tasks, tasks --check, tasks --backfill). Its regression suite lives in tests/ (stdlib unittest, 140 cases run locally / 142 defined, 2 skipped by platform, no third-party deps).

The repo root doubles as a plugin root for both Claude Code (.claude-plugin/) and Cursor (.cursor-plugin/): register it with claude plugin marketplace add pstruggle/agent-skill-kit, then claude plugin install project-task-sop@agent-skill-kit.

许可证

MIT,见 LICENSE。

About

Agent-agnostic skill kit: one source of truth, installable into DSH, Codex, Claude Code, Cursor, Gemini CLI, GitHub Copilot. 跨 Agent 复用:一份技能源一键投递七类 Agent,可作 Claude Code / Cursor 插件安装。

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages