How to use dsh-plugin-dev-skills
A minimal lifecycle example from the DSH plugin development skill pack, demonstrating plugin loading and the standard approach for ctx.effect automatic cleanup.
This article is auto-derived from indexed fields (wiki / faq / compatibility_json), not freshly AI-generated.
This article is derived from the plugin's already-indexed fields (wiki / faq / compatibility_json / readme), not freshly generated by AI. Source field is noted at the end of each section.
Quick start
dsh-plugin-dev-skills / examples/hello-plugin
— source: plugin_wiki.wiki_content
Install & verify
dsh plugin --profile web add dsh-hello-plugin
Run the command above in your DSH Web Profile. Then enable the plugin in the plugin list.
— source: plugins.install
Key points
examples/hello-plugin—— 最小插件(bundle 格式):dsh plugin --profile demo add ./examples/hello-plugin后dsh --profile demo启动,应看到加载日志和每 5 秒一次的心跳,卸载时自动清理。examples/greet-tool—— 最小模型工具:安装后对 agent 说 "Use the greet tool to greet Ada.",应收到 "Hello, Ada!"。- 更新任何 references 前,先核对官方文档对应页面(文档站或源码生成区块),并在 PR 中注明来源。
- 遵守 Agent Skills 约束:name 为 kebab-case 且与目录一致;description ≤ 1024 字符(DSH 目录注入提醒默认 500);正文渐进式披露。
- 欢迎 PR:修正、更多示例、扩充评测集、其它语言版本。
— source: plugin_wiki.readme_en (fallback readme_raw)
FAQ
What practical functionality does this plugin have after installation?
It has no actual business functionality. It only prints a log line when loaded, then prints a heartbeat every 5 seconds to observe whether the plugin layer is correctly loaded and whether ctx.effect cleanup is triggered.
Does this plugin require a build step?
No. index.js is pure ESM JavaScript, directly loaded by the host as a Node module; the package.json files field also only publishes index.js and cordis.patch.yml two files.
How long after seeing [hello-plugin] plugin loaded! will I see the heartbeat?
5 seconds. The setInterval interval is hardcoded to 5000 milliseconds in index.js:11, printing [hello-plugin] heartbeat every 5 seconds from the moment the plugin finishes loading.
Does the heartbeat stop immediately after unloading the plugin?
Yes. The cleanup function returned by ctx.effect is automatically called when the plugin is unloaded, clearInterval will clear this timer and stop continuing to output the heartbeat.
What is the difference between this example and the greet-tool example in the same repository?
hello-plugin is a minimal lifecycle example, demonstrating plugin loading and ctx.effect automatic cleanup; greet-tool is a model-callable tool example, demonstrating the three-part写法 of defineTool. They focus on different aspects.
Why is the id written as hello instead of hello-plugin in cordis.patch.yml?
This is a naming choice for the Cordis layer id, with no mandatory correspondence to the name field exported in index.js. The id is the layer identifier in the configuration map, while name is the logical name of the plugin at runtime, and they can be different.
Where does the plugin name dsh-hello-plugin come from?
It comes from the name field in package.json (dsh-hello-plugin), and the name field in the insert line in cordis.patch.yml is also declared as dsh-hello-plugin to ensure Node module resolution can find the installed code.
What are the key concepts that can be learned from looking at the hello-plugin source code?
Three: the dsh.bundle.patch in package.json must point to cordis.patch.yml; index.js only needs to export name and apply(ctx); any side effects registered through ctx (here setInterval) must be placed in ctx.effect so they won't leak when unloaded.
— source: plugin_wiki.faq_json
Compatibility
- DSH: 未声明
- Node: 未声明
- Platforms: 跨平台
— source: plugin_wiki.compatibility_json
Pitfalls
Review the upstream repo before installing. This guide is auto-derived from indexed fields and may lag the latest release. If anything contradicts the official docs, treat the upstream source as authoritative.
— source: general rule