Skip to main content
For the TypeScript examples, use the TypeScript setup, including "type": "module" and the tsx runner. Use a skill for reusable instructions the model can load, a command for a prompt your application invokes explicitly, and an inline plugin to bundle related definitions. All three can be supplied programmatically without creating configuration files on the runtime host.

Run a namespaced command

Use the quickstart setup with OPENAI_API_KEY. Save this as commands.ts and run node --env-file=.env --import tsx commands.ts.
An inline plugin namespaces its commands as plugin:command; here that is editorial:review. A command registered directly in Agent.commands keeps its own name. $ARGUMENTS is replaced by the argument string supplied to session.command(). Commands run a model turn in the existing session and return a terminal result. They can select an agent/model, apply tool restrictions or delegate as a subtask. They do not execute concurrently with another active query in that session.

Let the model load a skill

This separate example registers a skill directly. Its name is therefore plain-writing, without a plugin prefix.
The facade hides skill by default, so enable it deliberately. A skill description helps the model decide whether to load its content; registration alone does not guarantee invocation. Optional fields include baseDir, allowedTools, model and disableModelInvocation. Setting disableModelInvocation prevents autonomous model invocation of that skill. Skills provide instructions, not a trusted execution boundary. A model can still make mistakes, and application side effects need validation and permissions independent of prompt text. An inline plugin can include skills, commands, agents, hooks and MCP descriptors. Skill, command and agent names receive the plugin namespace; inspect session.getAppliedSettings() for the effective configuration and diagnostics. Use unique plugin names within a session. Programmatic definitions work with the SDK’s default empty settingSources. They are held in runtime memory, so re-register the intended definitions when resuming after a runtime restart. Persisting a transcript does not persist JavaScript callbacks or all runtime overrides.

Load a compatible local plugin

claudeCompat("/absolute/plugin/path") describes a supported local Claude-compatible plugin directory. This is an advanced compatibility path: it translates supported components, and unsupported components appear as diagnostics. It does not provide the Claude SDK API or guarantee every behavior of the original plugin. Paths refer to files the runtime can access; inspect diagnostics before relying on the plugin. Remote marketplace installation is outside v2. Filesystem instruction and skill discovery is separately controlled by defaults and isolation and settingSources. You do not need to enable filesystem discovery to use the programmatic examples above.