Use this skill when adding or modifying a plugin (@deepseek-ai/dsh-* package) in this repository. It compresses the repo's extension-point map, package checklist, and testing policy into one ordered procedure. Each step names the authoritative file; the full grounded detail with per-step sources lives in references/plugin-dev-sop.md.
Triggers
Activate when the user asks to add a plugin, package, capability seam, tool, hook, or model provider to this repo.
- "Add a plugin to this project" / "Add a capability" / "Add a model tool" / "Wrap a skill"
- "create a dsh plugin", "add a package", "scaffold a tool", "add an llm adapter"
Do not activate when the task only runs a skill, reviews code, or fixes a bug in an existing package without adding a contribution.
Mental model
- Everything is a plugin; there is no privileged core (
docs/architecture.md). Extending dsh means mounting a plugin beside the others. - Two plugin forms (
packages/AGENTS.md"Plugin exports"): a function plugin exportingname/inject/Config/applywith no default export, or aServicesubclass with a default export. Never mix the forms. - Every contribution is an effect:
ctx.effect()/ctx.on()/ctx.waterfall(). A registry'sregister()returns the disposer, so teardown and hot-reload unwind automatically.
Workflow
1. Decide the mechanism and home
- Read
docs/architecture.md"Where new behavior goes" and pick the mechanism: register actx.toolstool, listen on anagent/*/tools/*event, or define a new capability seam. - Check
docs/cookbook/extension-cookbook.md"feature → mechanism map" for an existing mechanism before inventing one. - A swappable capability needs all three seam roles — Service Definition, Service Provider, Consumer — never one role alone (
docs/glossary.mdcapability-seam). - Pick an existing group under
packages/<group>/; a new group is a pure container.
2. Scaffold the package
Create packages/<group>/<pkg>/ with package.json, tsconfig.json, src/index.ts, src/types.ts (types only), src/invariant.ts, and a bilingual README.md + README.zh.md. Follow the package.json invariants (private, version aligned to root, type: module, cordis in both peer and dev deps, exact files list) and register the package in exactly one aggregate — tsconfig.host.json or tsconfig.client.json. Full checklist: docs/cookbook/adding-a-package.md.
3. Implement the plugin
- Waterfall listeners must call
next()to delegate; returning without it short-circuits (docs/cordis-primer.md). - Typed events use declaration merging and carry an
@modetag. - Name the current role from the role table (
Controller/Store/Registry/Provider/Backend/…), not the first implementation. - Deployment-varying choices are
Configfields, notDEFAULT_*constants; explicitresolve(request): Spec, no hidden?? defaultinrun(). - Optional services use
ctx.get(name); cross-boundary ids useBranded<B>. - For a tool, follow the
execute()contract indocs/cookbook/adding-a-tool.md: typed args, one canonical JSON value, honorexec.signal,output.renderowns prose, presenters stay pure.
4. Add the invariant
Every package owns src/invariant.ts registering its manifest name and checking one event or data relation, or stating No runtime invariant: with a reason (packages/AGENTS.md).
5. Test
Follow docs/testing.md: an HMR-safety test for every registry, per-file 100% coverage on packages/*/*/src, a non-unit REAL-composition test for any product-visible plugin, and a keyless snapshot in the same PR for any model- or user-visible change.
6. Document
Write the package README.md with service API, config, events, and extension points first, then the canonical ## Model Experience and ## Known Limitations and Deferred Work sequence. Pair it with README.zh.md, and add an Agent Note in the same PR for any non-trivial change.
7. Verify
pnpm install
pnpm run doc-sync
pnpm run constraints && pnpm run typecheck && pnpm run lint
pnpm run build && pnpm run hygiene
Then run only the checks the changed surface reaches — do not default to the full suite.
8. Commit
Split independent changes; label kind/* plus every material area/*; keep the Agent Note in the same PR.
References
references/plugin-dev-sop.md— the full grounded SOP with per-step sources.references/skill-composition.md— how this skill hands off to thedsh-*skill family.
General feedback loop
When a user raises revision feedback during a Skill-driven task, before continuing with the current artifact you must do the following:
- First determine whether the feedback is
task-specific(this time only) orreusable(reusable across tasks). task-specificOnly modify the current task; do not change the Skill.reusableFirst determine the scope: for domain rules, update the corresponding canonical Skill first; for rules that apply to all Skills, update the shared specification first.- After completing the rule update, versioning, lint, and distribution verification, then apply the changes to the current task.
reusableThe modification invalidates previous "confirm," "continue," and "send it" responses; after completing the modification of the current artifact and reading it back, you must stop and wait for the user's next instruction, and must not automatically proceed to publishing, committing, or other external writes.