TrueHOOHA/dsh-plugin-dev-skill

AI Skill for developing DeepSeek Harness (dsh) plugins — Cordis-based agent framework. 辅助开发 dsh 插件的 AI 技能,覆盖 tool、service、LLM adapter、event listener 等能力的创建与发布。

项目介绍Project Overview

这是辅助开发 DeepSeek Harness(dsh)插件的 AI Skill,提供创建、修改、调试、打包插件所需知识,覆盖 tool、service、LLM adapter、event listener 及 cordis.yml 配置。适用于编写或发布 dsh 插件、接入模型提供商、处理 Cordis 生命周期与依赖注入等场景。注意:仅限 dsh 相关开发,不用于其他 agent 或 LLM 集成。

This is an AI Skill for developing DeepSeek Harness (dsh) plugins. It provides knowledge for creating, modifying, debugging, and packaging plugins, covering tools, services, LLM adapters, event listeners, and cordis.yml configuration. Use it when building or publishing dsh plugins, integrating model providers, or working with Cordis lifecycle and dependency injection. Caveat: it is intended only for dsh-related development, not other agent or LLM integrations.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add github:TrueHOOHA/dsh-plugin-dev-skill

TrueHOOHA/dsh-plugin-dev-skill 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-plugin-dev-skill

一个用于辅助开发 DeepSeek Harness(dsh)插件的 AI Skill。

DeepSeek Harness 是基于 Cordis 的 agent 框架,插件是导出 apply(ctx: Context) 的 TypeScript 模块,通过 cordis.yml 组合装配。本 skill 为 AI 助手提供创建、修改、调试、打包 dsh 插件所需的知识,覆盖工具(tool)、服务(service)、LLM 适配器(adapter)、事件监听(event listener)等能力。

使用方式

dsh-plugin-dev/ 目录放入你的 skill 目录(如 .claude/skills/.config/opencode/skills/),并开启插件开发模式。当用户提到以下内容时,本 skill 会被自动触发:

  • 创建 / 修改 / 调试 / 打包 dsh 插件
  • 编写 tool、service、LLM adapter、event listener
  • 配置 cordis.yml 补丁
  • 打包插件用于分发
  • 提到 Cordis 生命周期、Fiber 状态、injectctx.effectdefineToolService 子类、LlmAdapter、Schemastery 配置、dsh.bundle

仅限 dsh 相关开发,不用于其他 agent / LLM 集成场景。

目录结构

dsh-plugin-dev/
├── SKILL.md            # Skill 主文件:核心概念速查 + 参考文档索引
├── agents/
│   └── openai.yaml     # Agent 元数据(显示名、默认提示词)
└── references/         # 离线文档库
    ├── basic/          # 入门教程:第一个插件、工具、配置、发布
    │   ├── index.md    # 第一个插件:编写 apply(ctx) 并通过 --patch 加载
    │   ├── tool.md     # 注册 tool:defineTool + ctx.tools.register
    │   ├── config.md   # 插件配置:Config interface + Schemastery schema
    │   └── publish.md  # 发布:dsh.bundle 清单、profile、dsh plugin add
    ├── cordis-tutorial/  # Cordis 框架分步教程(7 章,无需 API Key 即可运行)
    │   ├── 01-first-plugin.md        # 最小插件 hello.ts
    │   ├── 02-lifecycle-and-effects.md # 生命周期与 ctx.effect 清理
    │   ├── 03-services.md            # 服务:提供与注入(inject)
    │   ├── 04-events.md              # 事件:ctx.on / ctx.emit
    │   ├── 05-config.md              # 配置校验与加载失败
    │   ├── 06-composition-and-hmr.md # 插件树、group、isolate、HMR
    │   ├── 07-into-the-harness.md    # 注册模型可调用的工具
    │   └── index.md                  # 教程总览与环境准备
    ├── framework/      # 框架概念速查
    │   ├── index.md    # 插件模型与 Fiber 状态机
    │   ├── events.md   # 事件机制与 Harness 事件
    │   └── service.md  # 服务注入、提供与隔离
    └── practice/       # 进阶设计模式与集成
        ├── index.md    # 三层能力设计:定义 → 提供 → 消费
        └── llm-adapter.md  # 接入新模型提供商:LlmAdapter.stream()

内容概览

SKILL.md 核心速查

主题 要点
插件结构 三种形式:函数 / 对象 { name, inject, apply } / 类(继承 Service
依赖注入 export const inject = ['tools', 'llm'],依赖未就绪时插件处于 PENDING
自动清理 所有经 ctx 注册的内容都是 effect,卸载自动回收;自定义资源用 ctx.effect() 包裹
Fiber 状态 PENDING → LOADING → ACTIVE → UNLOADING → DISPOSED(可 FAILED
工具 defineTool 自动生成 JSON Schema、校验参数、卸载时注销
配置 需同时导出 interface Configconst Config: Schema<Config>
服务 提供方继承 Service,消费方声明 injectgroup: true + isolate 实现隔离
事件 emit / parallel / serial / bail / waterfall 五种模式
LLM 适配器 继承 LlmAdapter 实现 stream(),按块顺序产出 StreamChunk
发布 本地用 --patch,分发用 npm 包 + dsh.bundledsh plugin add 安装
HMR 加载 cordis-plugin-hmr + logger + timer 实现保存即重载

核心代码示例

// 最小插件
import type { Context } from '@deepseek-ai/cordis'
export const name = 'my-plugin'
export function apply(ctx: Context) { /* register capabilities */ }

// 注册一个工具
import { defineTool } from '@deepseek-ai/dsh-tools'
export const inject = ['tools']
export function apply(ctx: Context) {
  ctx.tools.register(defineTool({
    name: 'greet', description: '...',
    parameters: { name: { type: 'string', required: true } },
    output: { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: value }] },
    async execute(args) { return `Hello, ${args.name}!` },
  }))
}

许可证

Apache License 2.0

上一个 Prev dsh-result-only-view 下一个 Next dsh-filexplore