npx skills add ...
npx skills add cline/sdk-skill --skill cline-sdk
Comprehensive Cline SDK skill for building AI agents. Covers the direct Agent runtime, ClineCore sessions, custom tools, plugins, events, LLM providers, scheduling, multi-agent teams, and production deployment. Use for any task involving @cline/sdk or its sub-packages.
npx skills add cline/sdk-skill --skill cline-sdk
Consolidated skill for building AI agents with the Cline SDK. Use the decision trees below to find the right entry point and API surface, then load detailed references.
Follow these rules in all Cline SDK code:
npm install @cline/sdk. The @cline/sdk package re-exports @cline/core, not every sub-package directly. Core re-exports the public SDK surface such as ClineCore, Agent, createAgentRuntime, createTool, built-in tool helpers, provider helpers, and the Llms namespace. Import from @cline/agents, @cline/llms, or @cline/shared only when you need APIs that core does not re-export, such as AgentRuntime, createAgent, or some low-level types.createTool() from @cline/sdk (or @cline/shared) to define tools. Tool names must be snake_case.execute functions when the agent can recover. Direct Agent converts thrown tool errors into error tool results; ClineCore can also count repeated failed tool turns toward its mistake-limit handling.lifecycle: { completesRun: true } on tools that should end the agent loop (e.g. a "submit answer" tool).ClineCore, always call dispose() when done to clean up resources.Agent and ClineCore have different event systems. For Agent: use agent.subscribe() to get AgentRuntimeEvent types, text streaming is "assistant-text-delta", and result text is result.outputText. For ClineCore: use cline.subscribe() to get CoreSessionEvent types. Render user-facing text, reasoning, and tool activity from "agent_event" payloads (content_start, content_update, content_end, done). Treat "chunk" events as raw transport chunks with { stream, chunk, ts }, not as typed text deltas. ClineCore result text is result.text. There is no top-level onEvent field on AgentRuntimeConfig; use agent.subscribe() or hooks.onEvent instead. Do not use "content_update" or "content_start" with agent.subscribe(); those are host-facing AgentEvent types carried inside ClineCore agent_event events.Agent, plugins are simple runtime plugins with setup(context) returning { tools, hooks }. For ClineCore, extensions are AgentPlugin objects with manifest, setup(api, ctx), and optional hooks. Do not use ClineCore plugin examples inside direct Agent.plugins.registerSkill() and no api.registerSkill. A plugin ships skills as SKILL.md files under <package>/skills/<name>/SKILL.md (package shape required); the host discovers them and surfaces them as /slash-commands automatically -- do not call registerCommand for skills. Plugin MCP servers use api.registerMcpServer() with the "mcp" capability. Configured agents (agent profiles) are YAML files in .cline/agents/ loaded as subagent_<name> tools when enableSpawnAgent is true.The two main API surfaces (Agent and ClineCore) follow a 4-file pattern. Cross-cutting concepts are single-file guides.
Each main API surface in ./references/<api>/ contains:
| File | Purpose | When to Read |
|---|---|---|
REFERENCE.md | Overview, when to use, quick start | Always read first |
api.md | Full API: classes, methods, config, types | Writing code |
patterns.md | Common patterns, best practices | Implementation guidance |
gotchas.md | Pitfalls, limitations, debugging | Troubleshooting |
Cross-cutting concepts in ./references/<concept>/ have REFERENCE.md as the entry point.
REFERENCE.md for your chosen API surfaceapi.mdpatterns.mdtools/REFERENCE.mdplugins/REFERENCE.mdproviders/REFERENCE.mdevents/REFERENCE.mdproduction/REFERENCE.mdscheduling/REFERENCE.mdmulti-agent/REFERENCE.mdgotchas.mdtools/REFERENCE.md (completion tools)agent/gotchas.md or clinecore/gotchas.mdproviders/REFERENCE.mdclinecore/gotchas.mdproduction/REFERENCE.md (cost control)clinecore/gotchas.mdplugins/REFERENCE.mdevents/REFERENCE.md| API | Entry File | Description |
|---|---|---|
| Agent | ./references/agent/REFERENCE.md | Lightweight in-memory agent loop |
| ClineCore | ./references/clinecore/REFERENCE.md | Full runtime with sessions, persistence, built-in tools |
| Concept | Entry File | Description |
|---|---|---|
| Tools | ./references/tools/REFERENCE.md | Built-in and custom tool creation |
| Plugins | ./references/plugins/REFERENCE.md | Extension system with hooks, MCP servers, and bundled skills |
| Events | ./references/events/REFERENCE.md | Real-time streaming events |
| Providers | ./references/providers/REFERENCE.md | LLM provider configuration |
| Production | ./references/production/REFERENCE.md | Deployment, security, observability |
| Scheduling | ./references/scheduling/REFERENCE.md | Cron jobs and automation |
| Multi-Agent | ./references/multi-agent/REFERENCE.md | Teams, sub-agents, and configured agent profiles |
| Package | Purpose |
|---|---|
@cline/sdk | User-facing alias for @cline/core; install this first |
@cline/core | Sessions, persistence, built-in tools, config, hub, and selected re-exports |
@cline/agents | Browser-compatible AgentRuntime class and lower-level factories |
@cline/llms | LLM provider gateway |
@cline/shared | Types, tool helpers, hook engine |
Repository: https://github.com/cline/cline SDK Source: https://github.com/cline/cline/tree/main/sdk Documentation: https://docs.cline.bot/sdk/overview Discord: https://discord.gg/cline