dsh-plugin-dev-skill
Skill11 starsChanged 15 days agoMITView on GitHub
指导任何 Agent 正确、高效、符合规范地开发 DeepSeek Harness(DSH)插件。涵盖 Tool(defineTool)、LLM 适配器、服务与依赖、事件系统、配置、打包发布,以及 Cordis 框架的心智模型、代码模板与验证清单。
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
Files
DeepSeek Harness Plugin Dev Skill
本文件是索引与铁律,不是手册。 操作手册正文在
References/(每篇都在 8,192 字符以内,可安全整篇读取)。 SDK 基线:@deepseek-ai/*0.2.3-alpha.2(cordis 4.2.0-alpha.1)。所有 API 陈述以此为准。 ⚠️ 载入后先执行 §1,再开始干活。
0. 与 DSH 内置 dsh-doc 的分工(两者并存,不是替代关系)
DSH 自带内置 skill dsh-doc(随 @deepseek-ai/dsh-agent-preset 发行;standard / ptc / cordis 三个 preset 都挂了它,不是创作模式专属)。分流:
| 场景 | 用哪个 |
查正在运行的 DSH 里某 Service / UI Slot 的现役签名;用现成工具管理运行中 profile 里的 bundle(install_bundle、启用停用、看 application/warnings);连 MCP;写 agent preset | dsh-doc(创作模式下另有 cordis_inspect 活体探针;0.2.2-rc.4 起原 cordis_inspect_list / cordis_inspect_query 合并为它) |
自己写/打包 bundle 与 dsh plugin 的安装语义、配置层顺序;离线 API 手册;可直接照抄的 TS 模板;跨版本「改了什么」累积清单;非 DSH 宿主(Claude Code / Codex / Cursor) | 本技能(打包见 07-publish.md / 07b-publish-advanced.md) |
理由、dsh-doc 的设计取舍与完整分流表见 References/13-upgrade-guides.md §3。
1. 载入后第一件事:检查本技能是否最新(强制)
本技能随 DSH 演进。用过期版本会写出编译不过或语义不对的插件。完整流程见 References/15-self-update.md,压缩版:
- 读本目录
VERSION;没有此文件(残缺拷贝)视为旧版,直接执行第 3 步。 - 取远端版本(一次几字节 GET,用 tag-pinned URL 绕开 raw.githubusercontent 的 CDN 滞后):
TAG=$(git ls-remote --tags --sort=-v:refname https://github.com/green-dalii/dsh-plugin-dev-skill.git | awk -F/ '/refs\/tags\/v/ {print $3; exit}') curl -fsSL --max-time 8 "https://raw.githubusercontent.com/green-dalii/dsh-plugin-dev-skill/${TAG}/VERSION" | tr -d '[:space:]' - 远端更高 → 更新(git 检出
git pull --ff-only;纯拷贝git clone --depth 1后rsync -a --delete --exclude .git),更新后重新读 SKILL.md 与要用的 References;相同或本地更高 → 直接用(不降级);无法联网 → 明说「未能检查更新(原因)」后继续,别卡住。 - 同一会话内远端未变则不必重查;每次载入技能都要查一次。
2. 铁律(违反其一即为缺陷)
- 所有注册走
ctx(ctx.on/ctx.tools.register/ctx.effect/ctx.plugin/ctx.provide)——卸载自动清理,绝不手写removeListener/clearInterval。 - 不经
ctx管理的资源(连接、定时器、句柄、watcher)必须包进ctx.effect(() => () => cleanup)。 - 依赖必须声明(
inject):不用ctx.get()探测必需依赖;加载顺序由依赖决定,不由cordis.yml行序决定。 - 配置必须可配置:任何不同部署可能取值不同的参数都进
Config,绝无硬编码。检验标准——能否只改cordis.yml就改这个值? - 配置错误要响亮:Schemastery schema 在加载时校验,非法配置直接失败,不带病运行。
- 展示回调必须是纯函数:
output.render/presentCall/presentResult会在实时流与会话回放中运行,不做 I/O、不读会话状态。 - 工具返回规范值:
execute返回output.schema声明的 JSON 值,人读文本归output.render;不要返回内容块。 - waterfall 观察者必须
next();不调next()是「有意短路」,只属于拥有该决策的监听器。 - 工具声明只能用
when条件:0.2.1-rc.2 起system-prompt/assemble不再携带工具数组,读assembly.tools会拿到undefined。 - 补丁整行替换
config(不是深合并):覆盖别层某行时,重述该行需要的每一个键。
3. 版本演进(细节见 12b-migration-errors.md 与 13-upgrade-guides.md)
| 版本 | 一句话 |
| 0.2.0 | 无特权内核定型;ctx.codeRuntime→ctx.ptcRuntime;删 agent/session-start 与 profile patchReload;去 E2B 改 SSH |
| 0.2.1-alpha.1~4 | 基本无公共 API 破坏;engines.dsh 优先于 peer、peers→requirements;plugin_market 加入 |
| 0.2.1-rc.1 ~ 0.2.2-alpha.2 | 大重构:executor 拆成独立插件、工具声明改 when 准入、agent/request 不再公开、session 投影改异步 handle、purpose 改声明式 |
| 0.2.2-alpha.3 ~ rc.3 | cordis 4.1.0;错误契约重构(dsh-error、LLM_FAILURE_CODES、ToolGuardDenial、ApprovalError);Session.append 批量重载;子代理全面具名;ctx.officeKit |
| 0.2.2-rc.4 ~ 0.2.3-alpha.2(基线) | cordis 4.2.0-alpha.1;cordis_inspect 合并双探针;PTC 默认 scoped REPL、协议 5;ctx.deepseekAuth 统一凭据;系统消息改增量 section;working_directory / create_worktree 工具移除;list_agents 结果改形;Node 要求 ^24.22.3 |
4. 索引:任务 → 读哪篇
下表路径均在 References/ 下。
| 要做的事 | 读 |
| 建立 DSH / Cordis 心智模型 | 01-dsh-architecture.md + 09-cordis-primer.md |
| 写第一个插件(形态、inject、effect、生命周期、HMR) | 02-plugin-basics.md |
写 Tool:defineTool、schema、后台任务、UI 卡片 | 03-tools.md → 03b-tools-advanced.md |
| 工具步骤准入 / executor 插件 | 03c-tools-pipeline.md |
| PTC 运行时细节(程序格式、scoped REPL、截断、检查、图片值) | 03d-ptc-runtime.md |
| 插件配置(Schemastery、设置页) | 04-config.md |
| 写 LLM 适配器(StreamChunk、模型元数据) | 05-llm-adapter.md |
LLM 错误码、LLM_FAILURE_CODES、fromFailure | 05b-llm-errors.md |
服务与依赖、inject、服务隔离 | 06-services.md |
| 事件系统、分发模式、常用事件 | 06b-events.md |
| 打包、安装进 profile、配置层顺序 | 07-publish.md |
| git 安装坑、组合包作者六件事、重装与展示元数据 | 07b-publish-advanced.md |
| 能力分层设计(Definition / Provider / Consumer) | 08-capability-layering.md |
查某个 ctx.* seam 是什么角色 | 08b-seams-core.md / 08c-seams-platform.md |
ctx 上到底有哪些 API | 09b-cordis-ctx-api.md |
| 扩展模式与「功能 → 机制」映射 | 11-cookbook.md |
| 通用错误对照自查 | 12-mistakes.md |
| 版本破坏性变更对照(至 rc.3) | 12b-migration-errors.md |
| 版本破坏性变更对照(rc.4 ~ 0.2.3-alpha.2) | 12c-migration-errors.md |
升级指南原文索引、官方链接、与 dsh-doc 的分工 | 13-upgrade-guides.md |
| 开发流程四阶段、覆盖范围边界(UI / Schedule / 子代理 / Web 搜索) | 14-workflow-and-scope.md |
| 本技能自我更新流程(完整版) | 15-self-update.md |
| 论文《A Programming Paradigm for Spatiotemporal Composability》解读 | 10-spatiotemporal.md |
文件总览与术语对照表(上游重命名备忘,如 Code Mode → PTC mode、CallId → ToolCallId)见 00-INDEX.md。
5. 交付前自查
- 每个可调参数都在
Config里,且 schema 能拒掉非法值 - 所有注册都在
ctx上或包在ctx.effect()里;卸载后无残留监听 - 工具:
output.schema有规范值、output.render是纯函数、exec.signal被遵守 - 事件:选对事件域,waterfall 观察者都调了
next() - 依赖写进
inject;去掉提供方后插件PENDING而非崩溃 - 怀疑与官方不一致 → 在仓库根跑
bash scripts/verify.sh(版本三处一致 + frontmatter 合法 + 官方链接 200;CI 也跑)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

