[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AS6489MPYZGTBC8S9GVVXS":3,"skill-same:01M7AS6489MPYZGTBC8S9GVVXS":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7AS6489MPYZGTBC8S9GVVXS","cordis-plugin-development",null,"Create, modify, debug, or extend dynamic Cordis Plugins, including Host Services and Events, Client Slot and theme UI, Package-private Client-to-Host calls, dynamic Tools, version updates, approval failures, and runtime diagnostics. Use this Skill to route a user request to the correct platform and Inspect Provider, then define, run, repair, or roll back the Plugin.","Qiuzixiao\u002Fdeepseek-harness-desktop","Qiuzixiao","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F120417469?v=4","01M7AS3GVP6K6CY963D6YR3613","Jar maker","01M7AS3GWP71XA2MZRRBM42Y41",0,"MIT","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-plugin-desktop\u002Fresources\u002Fagent-presets\u002Fcordis\u002Fskills\u002Fcordis-plugin-development\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: cordis-plugin-development\ndescription: Create, modify, debug, or extend dynamic Cordis Plugins, including Host Services and Events, Client Slot and theme UI, Package-private Client-to-Host calls, dynamic Tools, version updates, approval failures, and runtime diagnostics. Use this Skill to route a user request to the correct platform and Inspect Provider, then define, run, repair, or roll back the Plugin.\n---\n\n# Develop Dynamic Cordis Plugins\n\nFirst determine whether a capability belongs on Host or Client, then query the real interface before writing code. Never infer a complete API from a Service name, Event payload, Slot props, theme token, or example.\n\n## Standard workflow\n\n1. Call `cordis_inspect_list` to obtain the Providers, methods, and schemas currently registered on Host and Client.\n2. Select the smallest set of `cordis_inspect_query` calls needed to read the exact Services, Events, Builtins, Slots, Theme tokens, or Tools that the implementation will use.\n3. For a new Plugin, design its first Package. To modify an existing Plugin, first use `cordis_inspect_self(pluginId, packageId)` to read the base source and diagnostics.\n4. Write plain JavaScript in `code.host`, `code.client`, or both, then call `cordis_define`.\n5. Call `cordis_run` with the final `pluginId` and `packageId` returned by define.\n6. Handle approval, waiting, Client loading, and render failures from the Run card, steering messages, or `cordis_inspect_self`.\n7. Use `cordis_stop` to disable the Plugin temporarily. Use `cordis_undefine` only when it is no longer needed.\n\nDo not wait in the same turn for user approval or asynchronous browser results. After `cordis_run` returns `awaiting-approval` or `starting`, end the current Tool flow and wait for the system to report the final outcome through state updates and steering.\n\n## Tool usage guidance\n\n| Tool | Use it when | Do not |\n| --- | --- | --- |\n| `cordis_inspect_list` | Discover current Host\u002FClient Providers and method schemas in one call; refresh after the runtime capability directory changes | Hard-code Provider names and skip list; treat a manifest as business data |\n| `cordis_inspect_query` | Confirm exact Service methods, Event modes, Builtins, Slots, tokens, or Tool schemas before writing code | Use it instead of calling a real Service from the Plugin; assume a Client query will finish without a responding page |\n| `cordis_inspect_self` | List current Plugins, inspect version pointers, or read exact Package source and runtime diagnostics | Fetch all source just to build a list; use it to modify or start a Plugin |\n| `cordis_define` | Create a Plugin's first version or append an immutable Package to an existing Plugin; let the user preview the code first | Expect define to execute `apply`, request approval, or update current |\n| `cordis_run` | Activate an exact Package; use `run` for first activation, restart, or rollback, and `update` to switch versions | Use `run` to switch versions implicitly; treat pending or starting as success |\n| `cordis_stop` | Pause current effects while preserving Packages, grants, and version pointers for later use | Use stop to mean permanent deletion |\n| `cordis_undefine` | Permanently remove a Plugin and all of its Packages and clear historical business views | Call it while rollback, inspection, or restart is still needed |\n\n## Choose a platform\n\n| Requirement | Preferred platform | Inspect first |\n| --- | --- | --- |\n| Files, commands, processes, or networking | Host | `fs`, `bash`, `subprocess`, `pty`, and `web` in `Service.listService` |\n| Agents, durable Session data, or Host lifecycle | Host | The relevant Service and `Event.listEvents` |\n| Register a dynamic Tool callable in the next model step | Host | `harness` in `Builtin.listBuiltins`, plus `Tool.listTools` |\n| Page theme, layout, or current page state | Client | `Theme.listTokens` and Client `Service.listService` |\n| Conversation Snapshot or session\u002Fworkspace lists | Client | The target Slot's standard props and owner props |\n| Settings pages, sidebars, input areas, overlays, or Tool cards | Client | `Slots.listSubTree` |\n| Fetch on Host and display on Client | Both | Host Service + `harness.handle`; Client Slot + `host.call` |\n\nPrefer the capability closest to the data owner. If Slot props already provide the Conversation Snapshot, do not fetch it again through Host. If only the Package's own styles need to change, do not override the global theme. If only a small entry point is needed, do not replace an entire product UI region.\n\n## Provider navigation\n\nSelect methods from the actual `cordis_inspect_list` result. Common initial methods include:\n\n- `Service.listService`: without `service`, returns every callable Service with its purpose and exact method signatures. Query the selected `service` again for access rules, structured method descriptions\u002Fparameters\u002Freturns, and only its referenced types.\n- `Event.listEvents`: without `event`, returns every Event with its purpose, dispatch mode, and exact listener signature. Query the selected `event` again for its structured listener contract and only its referenced types; a Waterfall listener must call `next()`.\n- `Builtin.listBuiltins`: returns evaluator-provided symbols and signatures that cannot be obtained through `ctx.get()`.\n- `Slots.listSubTree`: without `root`, returns compact live trees with each Slot's purpose, kind, scope, registration keys, replacement risk, and children. With an exact `root`, it also returns that selected Slot's full contract, props, and current occupants while keeping descendants compact.\n- `Theme.listTokens`: returns theme tokens that may currently be queried and overridden; it does not modify the theme.\n- `Tool.listTools`: returns Tool schemas actually visible to the current Agent, including dynamically registered Tools.\n\nProvider names, methods, and inputs must come from the current list result. The Service\u002FEvent Catalog describes which interfaces this version permits; it does not guarantee that a Service is currently mounted. At runtime, use real Services and Events rather than caching or displaying Catalog query results.\n\n## Execution environment\n\nBoth `code.host` and `code.client` are plain JavaScript function bodies that return a Cordis Plugin. They are not compiled by TypeScript, JSX, or a bundler.\n\nDo not use:\n\n- `import`, `require`, TypeScript types, `as`, decorators, or JSX;\n- globals not confirmed by `Builtin.listBuiltins`;\n- guessed access to `window`, `document`, `process`, `Buffer`, `fetch`, or native timers.\n\nClient React code must use `React.createElement(...)`.\n\nCorrect:\n\n```js\nreturn {\n  apply(ctx) {\n    const slots = ctx.get('slots')\n    if (slots === undefined) return\n    slots.inject('tool.view.cordis', () => slots.register(\n      { name: 'tool.view.cordis', key: 'self' },\n      () => React.createElement('div', null, 'Hello'),\n    ))\n  },\n}\n```\n\nIncorrect:\n\n```jsx\nreturn {\n  apply(ctx) {\n    return \u003Cdiv>Hello\u003C\u002Fdiv>\n  },\n}\n```\n\nJSX is not the only problem in this example. `apply()` registers lifecycle contributions and cannot return a React Element as the Plugin result. UI must be registered in a queried Slot.\n\n## Access Services\n\nRead optional capabilities with `ctx.get(name)` by default and handle their absence:\n\n```js\nreturn {\n  apply(ctx) {\n    const service = ctx.get('serviceName')\n    if (service === undefined) return\n    service.someMethod()\n  },\n}\n```\n\nDeclare `inject` only when a Service is a hard dependency and the Plugin must enter waiting until Cordis reactivates it after the Service appears:\n\n```js\nreturn {\n  inject: ['requiredService'],\n  apply(ctx) {\n    ctx.requiredService.someMethod()\n  },\n}\n```\n\nDo not overuse `inject` merely to avoid an `undefined` check. Do not access `ctx.requiredService` without declaring the injection; the Guard rejects undeclared dependencies.\n\n## Manage side effects\n\nEvery contribution must be removed after the Plugin is stopped, updated, or removed. Prefer Cordis lifecycle APIs:\n\n- Use `ctx.on()` to register Event listeners.\n- Use `ctx.effect()` to own an external subscription that returns a disposer.\n- Retain disposers returned by Cordis Service, Tool, Slot, timer, and theme APIs.\n- Do not create process-wide or page-wide side effects at module scope or outside `apply()`.\n\nRecommended:\n\n```js\nreturn {\n  apply(ctx) {\n    const service = ctx.get('serviceName')\n    if (service === undefined) return\n    ctx.effect(() => service.subscribe((value) => {\n      console.log(value)\n    }))\n  },\n}\n```\n\nIf `subscribe()` does not return a disposer, first query whether the Service provides a supported cleanup mechanism. Do not assume unload automatically removes arbitrary third-party callbacks.\n\n## Host and Client timers\n\nOn both platforms, the timer is a Service named `timer` with the same interface; it is not a Builtin. Query `{ \"service\": \"timer\" }` through the corresponding platform's `Service.listService` before using it. Declare `inject: ['timer']` before using the timer mixin.\n\nOne-shot delay:\n\n```js\nreturn {\n  inject: ['timer'],\n  apply(ctx) {\n    const onClick = () => {\n      ctx.timeout(() => console.log('done'), 300)\n    }\n    \u002F\u002F Pass onClick to a queried Slot UI.\n  },\n}\n```\n\nPeriodic work in a React component:\n\n```js\nreturn {\n  inject: ['timer'],\n  apply(ctx) {\n    function Clock() {\n      React.useEffect(() => ctx.interval(() => console.log('tick'), 1000), [])\n      return React.createElement('div', null, 'Running')\n    }\n    \u002F\u002F Register Clock in a queried Slot.\n  },\n}\n```\n\nIncorrect:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.timeout(() => console.log('invalid'), 300)\n  },\n}\n```\n\n```js\nsetTimeout(() => console.log('invalid'), 300)\n```\n\nThe first example does not declare the timer hard dependency. The second uses a global timer that does not exist.\n\n## Listen to Events\n\nQuery the Event Provider first to confirm the platform, parameter order, return value, and `mode`.\n\nOrdinary emit Event:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.on('some\u002Fevent', (payload) => {\n      console.log(payload)\n    })\n  },\n}\n```\n\nThe last parameter of a Waterfall Event is `next`. Unless the listener intentionally stops downstream processing, it must call and return it:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.on('some\u002Fwaterfall', (payload, next) => {\n      console.log(payload)\n      return next()\n    })\n  },\n}\n```\n\n## Register Client UI\n\nQuery `Slots.listSubTree` without `root` to choose a target from the compact purpose and topology tree, then query the exact Slot with `root` before writing its registration. The exact result determines:\n\n- the Slot's purpose in the layout;\n- whether its registration protocol is `single`, `list`, `keyed`, or `chain`;\n- registration options;\n- scope standard props and business owner props;\n- current occupants, replacement risks, and descendant Slots.\n\nUse `ctx.get('slots')` and handle its absence. Then use `slots.inject` to wait for the Slot declaration and call `slots.register` inside the callback:\n\n```js\nreturn {\n  apply(ctx) {\n    const slots = ctx.get('slots')\n    if (slots === undefined) return\n    slots.inject('target.slot', () => slots.register(\n      { name: 'target.slot', id: 'my-view' },\n      (props) => React.createElement('div', null, String(props.someValue)),\n    ))\n  },\n}\n```\n\n`ctx.get('slots')` does not require an injection. Do not rewrite it as `ctx.slots` unless `inject: ['slots']` is declared:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.slots.register({ name: 'target.slot' }, () => null)\n  },\n}\n```\n\nDo not guess an `id`, `key`, selector, or props before querying the Slot protocol. Do not default to root-level `root`, `sidebar`, `conversation`, or `details` Slots; replacing an entire occupant also removes the descendant Slots it declares.\n\n### Settings pages\n\nA full settings UI should usually register its own section through `settings.section` to obtain a complete content area. `settings.general.item` is only appropriate for one compact, general-purpose preference. Query the actual subtree, options, and props for both, then select the narrowest entry point that is still sufficient.\n\nDynamic Plugins are temporary and process-local, so their settings UI does not need persistent storage. Do not add durable settings or another persistence mechanism for it. Register the UI in the appropriate settings Slot and keep any transient interaction state in memory for the lifetime of the Plugin.\n\n### Session and page data\n\nA session-scoped Slot may provide `useSession`, `useSessions`, `useWorkspaces`, `useProjection`, input state, or actions through standard props. Follow the query result and prefer owner or standard props directly; do not add a Host RPC for data already present there.\n\nSelect only the fields that the UI actually needs. Do not copy or render an entire Conversation Snapshot, Session, Tool call, or Slot props object.\n\n### Cordis Run-specific panel\n\nTo place interactive UI in the latest `cordis_run` card, register `tool.view.cordis` with `key: 'self'`:\n\nWhen the feature needs user interaction tied to this Package's result, this region is often a good fit because it keeps the controls in the conversation flow beside the Run card. It is not the default target for every Client UI: settings, sidebars, message actions, and overlays should use their own queried Slots when those locations better match the feature.\n\n```js\nreturn {\n  apply(ctx) {\n    const slots = ctx.get('slots')\n    if (slots === undefined) return\n    slots.inject('tool.view.cordis', () => slots.register(\n      { name: 'tool.view.cordis', key: 'self' },\n      (props) => React.createElement('div', null, `Package ${props.packageId}`),\n    ))\n  },\n}\n```\n\nAt runtime, `self` binds to `pluginId + packageId`. Do not include `pluginRunId` in the key. When the same Package runs multiple times, the latest Run card hosts the UI and older cards automatically degrade.\n\n### Ordinary Tool cards\n\nTo customize the call card for an ordinary model Tool, query `tool.call.toolview`. Its key is the Tool name; registering an existing key may replace the product's default card. When customizing only a newly added Tool, first verify its schema with `Tool.listTools`, then query the complete `ToolCallOwnerProps`.\n\n### Overlays and local entry points\n\n- For toasts, status notices, and frame-wide overlays, query `shell.overlay` first; observe its pointer-events and ordering rules.\n- When the selected target is a global overlay Slot, decide whether the UI should be draggable, how the user shows and hides it, and which existing layers it must cover or remain below.\n- For small sidebar actions, prefer additive inner Slots such as `sidebar.footer.action`; do not replace the entire sidebar.\n- For supplementary content after a conversation turn, query `conversation.chat.turnTail` and register according to its returned chain selector and fallback rules.\n\n## Themes and styles\n\nDetermine the scope of the change first:\n\n1. Global theme: first query `Theme.listTokens`, then query `{ \"service\": \"theme\" }` through Client `Service.listService`. Supply light and dark values for each override as required by the query, and retain the returned disposer.\n2. The Package's own components: use `styles.insert(css)` and prefer theme CSS variables for colors.\n3. New visible content: choose a Slot first, then decide between local CSS and global tokens.\n\nDo not manipulate `document.body`, `window`, or hard-coded product DOM selectors. The theme Service changes tokens but does not create UI. Slots create UI but do not replace the theme system.\n\n## Call Host from Client\n\nHost registers a Package-private method with `harness.handle(method, handler)`, and Client invokes it with `host.call(method, args)`. This is Client→Host JSON RPC.\n\nHost:\n\n```js\nreturn {\n  apply(ctx) {\n    harness.handle('read-state', async (args) => {\n      return { value: args.key }\n    })\n  },\n}\n```\n\nClient:\n\n```js\nreturn {\n  async apply(ctx) {\n    const result = await host.call('read-state', { key: 'demo' })\n    console.log(result.value)\n  },\n}\n```\n\nArguments and return values must be lossless JSON. Do not pass functions, React elements, class instances, Contexts, Services, or other runtime objects; return `null` when there is no response data. Do not register a public Remote Service or use `ctx.remote` for Package-private communication.\n\n## Register a dynamic model Tool\n\nHost can use `harness` to register a Tool callable in the next model step. First query the current `harness` signature with Host `Builtin.listBuiltins`, then inspect existing Tool names and schemas with `Tool.listTools` to avoid conflicts.\n\nTool arguments and return values must be JSON-compatible. `execute` owns the business result; render and presentation own only what the model and native UI see. Tool registration must belong to the current Plugin Fiber so it is automatically removed after stop or update.\n\n## Handle internal live data\n\nService instances, Event payloads, Slot props, Session and Conversation Snapshots, Tool state, and other DSH\u002FCordis objects are internal live data.\n\nDo not:\n\n- call `JSON.stringify` or `structuredClone` on these objects or their descendants;\n- recursively enumerate, fully copy, or display them as a whole;\n- place Host objects in the Package's long-lived state or RPC return values.\n\nRead only the leaf fields required by the current feature. Extract the minimum strings, numbers, booleans, and other scalar values before constructing owned JSON.\n\n## Versions, approval, and repair\n\n- A Plugin is the stable instance identified by `pluginId`.\n- A Package is an immutable code version identified by `packageId`.\n- Every activation attempt has its own `pluginRunId`.\n- `currentPackageId` is the latest successful version; it does not imply that the Plugin is currently running.\n- `nextPackageId` is the target awaiting approval, activating, awaiting Client activation, or most recently failed.\n\nChoose the `cordis_run` mode as follows:\n\n| Current state | Target | mode |\n| --- | --- | --- |\n| No current | Any Package under the Plugin | `run` |\n| Has current | The same Package | `run` |\n| Has current | A different Package | `update` |\n| Update failed | `nextPackageId` | `update` to retry |\n| Update failed | `currentPackageId` | `run` to roll back |\n\nAn unauthorized Client Package returns `awaiting-approval`. A single check mark authorizes only the current Package; double check marks authorize future versions of the same Plugin. A grant remains after a technical runtime failure. An authorized Package returns `starting` and completes asynchronously in the browser.\n\nAfter a technical failure:\n\n1. Use `cordis_inspect_self(pluginId, packageId)` to read the failed version's source and exact diagnostics.\n2. If the error involves an unknown capability, list and query the corresponding Provider again.\n3. Define a new Package under the same Plugin; do not overwrite the failed Package.\n4. Run again with the new `packageId` and the correct mode.\n\nDo not retry automatically after the user rejects approval. A failed update does not automatically restore the old physical Run; explicitly run current when recovery is required.\n\n## Modify @pluginId\n\nWhen the user identifies a target with `@pluginId`, do not create another Plugin. The injected context contains only identity, version pointers, and the default base Package, not source code.\n\nModify it as follows:\n\n1. Read the base Package with `cordis_inspect_self(pluginId, packageId)`.\n2. Preserve the Host or Client half that does not need to change and modify only the target code.\n3. Call `cordis_define` with `plugin.kind: 'existing'` and the original `pluginId`.\n4. Use the returned `packageId`; when current exists, activate the new version with `update` in the usual case.\n\nIf the reference is unavailable, explain that the Plugin was removed, belongs to another Session, or was lost on process restart. Do not create a same-named replacement.\n\n## Common failure checks\n\n| Failure | Check first |\n| --- | --- |\n| `service \"x\" is not declared` | Whether code uses `ctx.x` without declaring `inject: ['x']` on the Plugin object; switch to `ctx.get('x')` with an absence check or declare a true hard dependency |\n| `cannot get property \"timer\" without inject` | Query the timer Service and declare `inject: ['timer']` |\n| Client parse failure | Whether the code uses JSX, TypeScript, import, or an unavailable global |\n| Slot registration failure | Whether the live subtree was queried, the Slot exists, and options, key, or selector satisfy the returned protocol |\n| UI loads but the page reports an error | Inspect the `client-render` diagnostic and stack; the error belongs to an exact Run, so define a new Package to repair it |\n| `host.call` failure | The Host handler name, current `pluginRunId`, JSON arguments, and real Service dependencies inside the handler |\n| Update failure | Preserve current\u002Fnext semantics; repair next and update, or run current to roll back |\n","# Develop Dynamic Cordis Plugins\n\nFirst determine whether a capability belongs on Host or Client, then query the real interface before writing code. Never infer a complete API from a Service name, Event payload, Slot props, theme token, or example.\n\n## Standard workflow\n\n1. Call `cordis_inspect_list` to obtain the Providers, methods, and schemas currently registered on Host and Client.\n2. Select the smallest set of `cordis_inspect_query` calls needed to read the exact Services, Events, Builtins, Slots, Theme tokens, or Tools that the implementation will use.\n3. For a new Plugin, design its first Package. To modify an existing Plugin, first use `cordis_inspect_self(pluginId, packageId)` to read the base source and diagnostics.\n4. Write plain JavaScript in `code.host`, `code.client`, or both, then call `cordis_define`.\n5. Call `cordis_run` with the final `pluginId` and `packageId` returned by define.\n6. Handle approval, waiting, Client loading, and render failures from the Run card, steering messages, or `cordis_inspect_self`.\n7. Use `cordis_stop` to disable the Plugin temporarily. Use `cordis_undefine` only when it is no longer needed.\n\nDo not wait in the same turn for user approval or asynchronous browser results. After `cordis_run` returns `awaiting-approval` or `starting`, end the current Tool flow and wait for the system to report the final outcome through state updates and steering.\n\n## Tool usage guidance\n\n| Tool | Use it when | Do not |\n| --- | --- | --- |\n| `cordis_inspect_list` | Discover current Host\u002FClient Providers and method schemas in one call; refresh after the runtime capability directory changes | Hard-code Provider names and skip list; treat a manifest as business data |\n| `cordis_inspect_query` | Confirm exact Service methods, Event modes, Builtins, Slots, tokens, or Tool schemas before writing code | Use it instead of calling a real Service from the Plugin; assume a Client query will finish without a responding page |\n| `cordis_inspect_self` | List current Plugins, inspect version pointers, or read exact Package source and runtime diagnostics | Fetch all source just to build a list; use it to modify or start a Plugin |\n| `cordis_define` | Create a Plugin's first version or append an immutable Package to an existing Plugin; let the user preview the code first | Expect define to execute `apply`, request approval, or update current |\n| `cordis_run` | Activate an exact Package; use `run` for first activation, restart, or rollback, and `update` to switch versions | Use `run` to switch versions implicitly; treat pending or starting as success |\n| `cordis_stop` | Pause current effects while preserving Packages, grants, and version pointers for later use | Use stop to mean permanent deletion |\n| `cordis_undefine` | Permanently remove a Plugin and all of its Packages and clear historical business views | Call it while rollback, inspection, or restart is still needed |\n\n## Choose a platform\n\n| Requirement | Preferred platform | Inspect first |\n| --- | --- | --- |\n| Files, commands, processes, or networking | Host | `fs`, `bash`, `subprocess`, `pty`, and `web` in `Service.listService` |\n| Agents, durable Session data, or Host lifecycle | Host | The relevant Service and `Event.listEvents` |\n| Register a dynamic Tool callable in the next model step | Host | `harness` in `Builtin.listBuiltins`, plus `Tool.listTools` |\n| Page theme, layout, or current page state | Client | `Theme.listTokens` and Client `Service.listService` |\n| Conversation Snapshot or session\u002Fworkspace lists | Client | The target Slot's standard props and owner props |\n| Settings pages, sidebars, input areas, overlays, or Tool cards | Client | `Slots.listSubTree` |\n| Fetch on Host and display on Client | Both | Host Service + `harness.handle`; Client Slot + `host.call` |\n\nPrefer the capability closest to the data owner. If Slot props already provide the Conversation Snapshot, do not fetch it again through Host. If only the Package's own styles need to change, do not override the global theme. If only a small entry point is needed, do not replace an entire product UI region.\n\n## Provider navigation\n\nSelect methods from the actual `cordis_inspect_list` result. Common initial methods include:\n\n- `Service.listService`: without `service`, returns every callable Service with its purpose and exact method signatures. Query the selected `service` again for access rules, structured method descriptions\u002Fparameters\u002Freturns, and only its referenced types.\n- `Event.listEvents`: without `event`, returns every Event with its purpose, dispatch mode, and exact listener signature. Query the selected `event` again for its structured listener contract and only its referenced types; a Waterfall listener must call `next()`.\n- `Builtin.listBuiltins`: returns evaluator-provided symbols and signatures that cannot be obtained through `ctx.get()`.\n- `Slots.listSubTree`: without `root`, returns compact live trees with each Slot's purpose, kind, scope, registration keys, replacement risk, and children. With an exact `root`, it also returns that selected Slot's full contract, props, and current occupants while keeping descendants compact.\n- `Theme.listTokens`: returns theme tokens that may currently be queried and overridden; it does not modify the theme.\n- `Tool.listTools`: returns Tool schemas actually visible to the current Agent, including dynamically registered Tools.\n\nProvider names, methods, and inputs must come from the current list result. The Service\u002FEvent Catalog describes which interfaces this version permits; it does not guarantee that a Service is currently mounted. At runtime, use real Services and Events rather than caching or displaying Catalog query results.\n\n## Execution environment\n\nBoth `code.host` and `code.client` are plain JavaScript function bodies that return a Cordis Plugin. They are not compiled by TypeScript, JSX, or a bundler.\n\nDo not use:\n\n- `import`, `require`, TypeScript types, `as`, decorators, or JSX;\n- globals not confirmed by `Builtin.listBuiltins`;\n- guessed access to `window`, `document`, `process`, `Buffer`, `fetch`, or native timers.\n\nClient React code must use `React.createElement(...)`.\n\nCorrect:\n\n```js\nreturn {\n  apply(ctx) {\n    const slots = ctx.get('slots')\n    if (slots === undefined) return\n    slots.inject('tool.view.cordis', () => slots.register(\n      { name: 'tool.view.cordis', key: 'self' },\n      () => React.createElement('div', null, 'Hello'),\n    ))\n  },\n}\n```\n\nIncorrect:\n\n```jsx\nreturn {\n  apply(ctx) {\n    return \u003Cdiv>Hello\u003C\u002Fdiv>\n  },\n}\n```\n\nJSX is not the only problem in this example. `apply()` registers lifecycle contributions and cannot return a React Element as the Plugin result. UI must be registered in a queried Slot.\n\n## Access Services\n\nRead optional capabilities with `ctx.get(name)` by default and handle their absence:\n\n```js\nreturn {\n  apply(ctx) {\n    const service = ctx.get('serviceName')\n    if (service === undefined) return\n    service.someMethod()\n  },\n}\n```\n\nDeclare `inject` only when a Service is a hard dependency and the Plugin must enter waiting until Cordis reactivates it after the Service appears:\n\n```js\nreturn {\n  inject: ['requiredService'],\n  apply(ctx) {\n    ctx.requiredService.someMethod()\n  },\n}\n```\n\nDo not overuse `inject` merely to avoid an `undefined` check. Do not access `ctx.requiredService` without declaring the injection; the Guard rejects undeclared dependencies.\n\n## Manage side effects\n\nEvery contribution must be removed after the Plugin is stopped, updated, or removed. Prefer Cordis lifecycle APIs:\n\n- Use `ctx.on()` to register Event listeners.\n- Use `ctx.effect()` to own an external subscription that returns a disposer.\n- Retain disposers returned by Cordis Service, Tool, Slot, timer, and theme APIs.\n- Do not create process-wide or page-wide side effects at module scope or outside `apply()`.\n\nRecommended:\n\n```js\nreturn {\n  apply(ctx) {\n    const service = ctx.get('serviceName')\n    if (service === undefined) return\n    ctx.effect(() => service.subscribe((value) => {\n      console.log(value)\n    }))\n  },\n}\n```\n\nIf `subscribe()` does not return a disposer, first query whether the Service provides a supported cleanup mechanism. Do not assume unload automatically removes arbitrary third-party callbacks.\n\n## Host and Client timers\n\nOn both platforms, the timer is a Service named `timer` with the same interface; it is not a Builtin. Query `{ \"service\": \"timer\" }` through the corresponding platform's `Service.listService` before using it. Declare `inject: ['timer']` before using the timer mixin.\n\nOne-shot delay:\n\n```js\nreturn {\n  inject: ['timer'],\n  apply(ctx) {\n    const onClick = () => {\n      ctx.timeout(() => console.log('done'), 300)\n    }\n    \u002F\u002F Pass onClick to a queried Slot UI.\n  },\n}\n```\n\nPeriodic work in a React component:\n\n```js\nreturn {\n  inject: ['timer'],\n  apply(ctx) {\n    function Clock() {\n      React.useEffect(() => ctx.interval(() => console.log('tick'), 1000), [])\n      return React.createElement('div', null, 'Running')\n    }\n    \u002F\u002F Register Clock in a queried Slot.\n  },\n}\n```\n\nIncorrect:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.timeout(() => console.log('invalid'), 300)\n  },\n}\n```\n\n```js\nsetTimeout(() => console.log('invalid'), 300)\n```\n\nThe first example does not declare the timer hard dependency. The second uses a global timer that does not exist.\n\n## Listen to Events\n\nQuery the Event Provider first to confirm the platform, parameter order, return value, and `mode`.\n\nOrdinary emit Event:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.on('some\u002Fevent', (payload) => {\n      console.log(payload)\n    })\n  },\n}\n```\n\nThe last parameter of a Waterfall Event is `next`. Unless the listener intentionally stops downstream processing, it must call and return it:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.on('some\u002Fwaterfall', (payload, next) => {\n      console.log(payload)\n      return next()\n    })\n  },\n}\n```\n\n## Register Client UI\n\nQuery `Slots.listSubTree` without `root` to choose a target from the compact purpose and topology tree, then query the exact Slot with `root` before writing its registration. The exact result determines:\n\n- the Slot's purpose in the layout;\n- whether its registration protocol is `single`, `list`, `keyed`, or `chain`;\n- registration options;\n- scope standard props and business owner props;\n- current occupants, replacement risks, and descendant Slots.\n\nUse `ctx.get('slots')` and handle its absence. Then use `slots.inject` to wait for the Slot declaration and call `slots.register` inside the callback:\n\n```js\nreturn {\n  apply(ctx) {\n    const slots = ctx.get('slots')\n    if (slots === undefined) return\n    slots.inject('target.slot', () => slots.register(\n      { name: 'target.slot', id: 'my-view' },\n      (props) => React.createElement('div', null, String(props.someValue)),\n    ))\n  },\n}\n```\n\n`ctx.get('slots')` does not require an injection. Do not rewrite it as `ctx.slots` unless `inject: ['slots']` is declared:\n\n```js\nreturn {\n  apply(ctx) {\n    ctx.slots.register({ name: 'target.slot' }, () => null)\n  },\n}\n```\n\nDo not guess an `id`, `key`, selector, or props before querying the Slot protocol. Do not default to root-level `root`, `sidebar`, `conversation`, or `details` Slots; replacing an entire occupant also removes the descendant Slots it declares.\n\n### Settings pages\n\nA full settings UI should usually register its own section through `settings.section` to obtain a complete content area. `settings.general.item` is only appropriate for one compact, general-purpose preference. Query the actual subtree, options, and props for both, then select the narrowest entry point that is still sufficient.\n\nDynamic Plugins are temporary and process-local, so their settings UI does not need persistent storage. Do not add durable settings or another persistence mechanism for it. Register the UI in the appropriate settings Slot and keep any transient interaction state in memory for the lifetime of the Plugin.\n\n### Session and page data\n\nA session-scoped Slot may provide `useSession`, `useSessions`, `useWorkspaces`, `useProjection`, input state, or actions through standard props. Follow the query result and prefer owner or standard props directly; do not add a Host RPC for data already present there.\n\nSelect only the fields that the UI actually needs. Do not copy or render an entire Conversation Snapshot, Session, Tool call, or Slot props object.\n\n### Cordis Run-specific panel\n\nTo place interactive UI in the latest `cordis_run` card, register `tool.view.cordis` with `key: 'self'`:\n\nWhen the feature needs user interaction tied to this Package's result, this region is often a good fit because it keeps the controls in the conversation flow beside the Run card. It is not the default target for every Client UI: settings, sidebars, message actions, and overlays should use their own queried Slots when those locations better match the feature.\n\n```js\nreturn {\n  apply(ctx) {\n    const slots = ctx.get('slots')\n    if (slots === undefined) return\n    slots.inject('tool.view.cordis', () => slots.register(\n      { name: 'tool.view.cordis', key: 'self' },\n      (props) => React.createElement('div', null, `Package ${props.packageId}`),\n    ))\n  },\n}\n```\n\nAt runtime, `self` binds to `pluginId + packageId`. Do not include `pluginRunId` in the key. When the same Package runs multiple times, the latest Run card hosts the UI and older cards automatically degrade.\n\n### Ordinary Tool cards\n\nTo customize the call card for an ordinary model Tool, query `tool.call.toolview`. Its key is the Tool name; registering an existing key may replace the product's default card. When customizing only a newly added Tool, first verify its schema with `Tool.listTools`, then query the complete `ToolCallOwnerProps`.\n\n### Overlays and local entry points\n\n- For toasts, status notices, and frame-wide overlays, query `shell.overlay` first; observe its pointer-events and ordering rules.\n- When the selected target is a global overlay Slot, decide whether the UI should be draggable, how the user shows and hides it, and which existing layers it must cover or remain below.\n- For small sidebar actions, prefer additive inner Slots such as `sidebar.footer.action`; do not replace the entire sidebar.\n- For supplementary content after a conversation turn, query `conversation.chat.turnTail` and register according to its returned chain selector and fallback rules.\n\n## Themes and styles\n\nDetermine the scope of the change first:\n\n1. Global theme: first query `Theme.listTokens`, then query `{ \"service\": \"theme\" }` through Client `Service.listService`. Supply light and dark values for each override as required by the query, and retain the returned disposer.\n2. The Package's own components: use `styles.insert(css)` and prefer theme CSS variables for colors.\n3. New visible content: choose a Slot first, then decide between local CSS and global tokens.\n\nDo not manipulate `document.body`, `window`, or hard-coded product DOM selectors. The theme Service changes tokens but does not create UI. Slots create UI but do not replace the theme system.\n\n## Call Host from Client\n\nHost registers a Package-private method with `harness.handle(method, handler)`, and Client invokes it with `host.call(method, args)`. This is Client→Host JSON RPC.\n\nHost:\n\n```js\nreturn {\n  apply(ctx) {\n    harness.handle('read-state', async (args) => {\n      return { value: args.key }\n    })\n  },\n}\n```\n\nClient:\n\n```js\nreturn {\n  async apply(ctx) {\n    const result = await host.call('read-state', { key: 'demo' })\n    console.log(result.value)\n  },\n}\n```\n\nArguments and return values must be lossless JSON. Do not pass functions, React elements, class instances, Contexts, Services, or other runtime objects; return `null` when there is no response data. Do not register a public Remote Service or use `ctx.remote` for Package-private communication.\n\n## Register a dynamic model Tool\n\nHost can use `harness` to register a Tool callable in the next model step. First query the current `harness` signature with Host `Builtin.listBuiltins`, then inspect existing Tool names and schemas with `Tool.listTools` to avoid conflicts.\n\nTool arguments and return values must be JSON-compatible. `execute` owns the business result; render and presentation own only what the model and native UI see. Tool registration must belong to the current Plugin Fiber so it is automatically removed after stop or update.\n\n## Handle internal live data\n\nService instances, Event payloads, Slot props, Session and Conversation Snapshots, Tool state, and other DSH\u002FCordis objects are internal live data.\n\nDo not:\n\n- call `JSON.stringify` or `structuredClone` on these objects or their descendants;\n- recursively enumerate, fully copy, or display them as a whole;\n- place Host objects in the Package's long-lived state or RPC return values.\n\nRead only the leaf fields required by the current feature. Extract the minimum strings, numbers, booleans, and other scalar values before constructing owned JSON.\n\n## Versions, approval, and repair\n\n- A Plugin is the stable instance identified by `pluginId`.\n- A Package is an immutable code version identified by `packageId`.\n- Every activation attempt has its own `pluginRunId`.\n- `currentPackageId` is the latest successful version; it does not imply that the Plugin is currently running.\n- `nextPackageId` is the target awaiting approval, activating, awaiting Client activation, or most recently failed.\n\nChoose the `cordis_run` mode as follows:\n\n| Current state | Target | mode |\n| --- | --- | --- |\n| No current | Any Package under the Plugin | `run` |\n| Has current | The same Package | `run` |\n| Has current | A different Package | `update` |\n| Update failed | `nextPackageId` | `update` to retry |\n| Update failed | `currentPackageId` | `run` to roll back |\n\nAn unauthorized Client Package returns `awaiting-approval`. A single check mark authorizes only the current Package; double check marks authorize future versions of the same Plugin. A grant remains after a technical runtime failure. An authorized Package returns `starting` and completes asynchronously in the browser.\n\nAfter a technical failure:\n\n1. Use `cordis_inspect_self(pluginId, packageId)` to read the failed version's source and exact diagnostics.\n2. If the error involves an unknown capability, list and query the corresponding Provider again.\n3. Define a new Package under the same Plugin; do not overwrite the failed Package.\n4. Run again with the new `packageId` and the correct mode.\n\nDo not retry automatically after the user rejects approval. A failed update does not automatically restore the old physical Run; explicitly run current when recovery is required.\n\n## Modify @pluginId\n\nWhen the user identifies a target with `@pluginId`, do not create another Plugin. The injected context contains only identity, version pointers, and the default base Package, not source code.\n\nModify it as follows:\n\n1. Read the base Package with `cordis_inspect_self(pluginId, packageId)`.\n2. Preserve the Host or Client half that does not need to change and modify only the target code.\n3. Call `cordis_define` with `plugin.kind: 'existing'` and the original `pluginId`.\n4. Use the returned `packageId`; when current exists, activate the new version with `update` in the usual case.\n\nIf the reference is unavailable, explain that the Plugin was removed, belongs to another Session, or was lost on process restart. Do not create a same-named replacement.\n\n## Common failure checks\n\n| Failure | Check first |\n| --- | --- |\n| `service \"x\" is not declared` | Whether code uses `ctx.x` without declaring `inject: ['x']` on the Plugin object; switch to `ctx.get('x')` with an absence check or declare a true hard dependency |\n| `cannot get property \"timer\" without inject` | Query the timer Service and declare `inject: ['timer']` |\n| Client parse failure | Whether the code uses JSX, TypeScript, import, or an unavailable global |\n| Slot registration failure | Whether the live subtree was queried, the Slot exists, and options, key, or selector satisfy the returned protocol |\n| UI loads but the page reports an error | Inspect the `client-render` diagnostic and stack; the error belongs to an exact Run, so define a new Package to repair it |\n| `host.call` failure | The Host handler name, current `pluginRunId`, JSON arguments, and real Service dependencies inside the handler |\n| Update failure | Preserve current\u002Fnext semantics; repair next and update, or run current to roll back |\n",{"name":5,"description":7},"master","62087459d3d7f4149ee9a33bff63ed9ca4b6c1d8","dsh-plugin-desktop\u002Fresources\u002Fagent-presets\u002Fcordis\u002Fskills\u002Fcordis-plugin-development","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop","https:\u002F\u002Fdshdesktop.cn","https:\u002F\u002Fgithub.com\u002FQiuzixiao","2026-09-10 18:31:27",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add Qiuzixiao\u002Fdeepseek-harness-desktop --skill cordis-plugin-development",{"tool":37,"command":38},"bunx","bunx skills add Qiuzixiao\u002Fdeepseek-harness-desktop --skill cordis-plugin-development",{"tool":40,"command":41},"pnpm","pnpm dlx skills add Qiuzixiao\u002Fdeepseek-harness-desktop --skill cordis-plugin-development","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-plugin-desktop\u002Fresources\u002Fagent-presets\u002Fcordis\u002Fskills\u002Fcordis-plugin-development\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7AS86XE0PJQ0MCDH5DPZCFC","short-drama-domain","Short-drama project object map and task routing. Use when the user works with screenplay artifacts, episode scenes, continuity, diagnosis, revision, or delivery. This skill provides operational vocabulary and questions, not a mandatory writing style.","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-short-drama\u002Fmanaged-presets\u002Fscreenplay-v1\u002Fskills\u002Fshort-drama-domain\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7AS837QRW3BDY2W6PHXB2AB","creative-project-organization","从梗概开始创作、生成设定\u002F人物\u002F大纲\u002F正文等文件时，在首批落盘前规划内容分组和保存位置；新增独立交付物时复核布局。自动适配项目语言和命名习惯，也用于用户要求的项目整理。无需用户提出归档要求。","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-short-drama\u002Fmanaged-presets\u002Fscreenplay-v1\u002Fskills\u002Fcreative-project-organization\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7AS7YHQTH0H79BZGANZF6V5","skill-sink","技能沉淀机制：把创作中验证有效的经验、方法论与个人文风，提炼成可复用的 DSH skill。当创作中发现可复用经验、用户要沉淀个人文风、或要把反复出现的规则固化成技能时使用。","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-plugin-desktop\u002Fresources\u002Fagent-presets\u002Fshort-drama\u002Fskills\u002Fskill-sink\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7AS7S0NS2PQVSNFQFRES3PW","short-drama-zonggang","短剧创作总纲与情绪账务引擎方法论。以「恨账—存债\u002F付息\u002F兑付」债务系统为内核，覆盖选题、故事骨架、压爽循环与卡点、付费闸门、台词正文格式、验收自检与失效模式库。当用户要创作短剧剧本、立项选题、写分集大纲、写正文台词、设计付费卡点，或评审\u002F修改\u002F验收短剧时，先加载本 Skill。","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-plugin-desktop\u002Fresources\u002Fagent-presets\u002Fshort-drama\u002Fskills\u002Fshort-drama-zonggang\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7AS7KHM1F0V7HM33VDGAEQG","short-drama-structure","把已确认的故事前提排成短剧四幕二十拍、分集节奏和场次骨架（4×5 节拍表、卡点与高潮兑现）。当用户已有故事梗概，要求拆成四幕\u002F20 拍\u002F分集\u002F场次表、中段松散需要重排转折，或想设置悬念、反转、付费卡点及高潮兑现路径时使用。不适用于从零提炼创意、单场对白润色或平台投稿咨询。","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-plugin-desktop\u002Fresources\u002Fagent-presets\u002Fshort-drama\u002Fskills\u002Fshort-drama-structure\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7AS7EEA9D20P4R5BBSPNBCN","short-drama-scene","当用户提供剧本片段、分场或对白，要求更可拍\u002F更有戏\u002F减少解释\u002F改得口语化时调用；重点处理单场冲突、动作进出、状态变化、信息差、潜台词和对白瘦身。不适用于从零搭故事结构、设计整部剧的悬念卡点或行业投稿咨询。","https:\u002F\u002Fgithub.com\u002FQiuzixiao\u002Fdeepseek-harness-desktop\u002Fblob\u002Fmaster\u002Fdsh-plugin-desktop\u002Fresources\u002Fagent-presets\u002Fshort-drama\u002Fskills\u002Fshort-drama-scene\u002FSKILL.md",[],[]]