Agent skill

Cline SDK Guide

by cline in cline/cline

Reference for building AI agents with the Cline SDK: the Agent runtime, ClineCore sessions, custom tools, plugins, events, providers, scheduling and multi-agent teams.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Cline SDK Guide

skills CLI
$ npx skills add cline/cline --skill cline-sdk -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cline/cline cline-sdk --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cline/cline.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/cline-sdk .claude/skills/cline-sdk && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cline-sdk
GitHub stars
70k
Token cost
~2.2k tokens
SKILL.md length
544 words
Files
19 (incl. references)
Skills in repo
8
Repo updated
First seen
Licence
Apache-2.0

At a glance

Reference for building AI agents with the Cline SDK: the Agent runtime, ClineCore sessions, custom tools, plugins, events, providers, scheduling and multi-agent teams.

  • Works in 7 steps: Install with npm install @cline/sdk. The… → Requires Node.js 22 or later. → Use createTool() from @cline/sdk (or… → …
  • Writing an agent with the Cline SDK
  • SKILL.md covers Critical Rules, How to Use This Skill, Quick Decision Trees and Product Index, plus 1 more section
  • Calls npm

What it does

The skill uses decision trees to pick an entry point and then loads detailed references. Its critical rules are to install @cline/sdk with npm, which re-exports the core, agents, llms and shared packages, to use Node.js 22 or later, to define tools with createTool using snake_case names, to return errors from tools as structured data because throwing counts as a mistake against the agent's limit, to flag run-ending tools with a lifecycle setting, and to call dispose() on ClineCore when finished.

It stresses that the standalone Agent and ClineCore use different event systems. Agent uses agent.subscribe() with runtime event types and reads outputText, while ClineCore uses cline.subscribe() with core session events and reads the result text, and the agent config has no top-level onEvent field. Each main API has a four-file reference set covering overview, API, patterns and gotchas, and cross-cutting topics such as events, plugins, providers, multi-agent teams and production deployment each have their own reference.

When your agent uses it

  • Writing an agent with the Cline SDK
  • Defining custom tools with createTool
  • Subscribing to Agent or ClineCore events
  • Building multi-agent teams or scheduling runs
  • Preparing a Cline SDK agent for production

Example prompts

  • “Build a Cline SDK agent with a custom tool that looks up order status and ends the run once it returns an answer.”
  • “Why does agent.subscribe() never fire the content_update events I expected?”
  • “Run this ClineCore session and make sure its resources are cleaned up afterwards.”

Requirements

  • Node.js 22 or later
  • The @cline/sdk package

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Install with npm install @cline/sdk. The @cline/sdk package re-exports everything from @cline/core, @cline/agents, @cline/llms, and…
  2. Requires Node.js 22 or later.
  3. Use createTool() from @cline/sdk (or @cline/shared) to define tools. Tool names must be snake_case.
  4. Return errors as structured data from tool execute functions. Throwing counts as a "mistake" against the agent's mistake limit.
  5. Use lifecycle: { completesRun: true } on tools that should end the agent loop (e.g. a "submit answer" tool).
  6. When using ClineCore, always call dispose() when done to clean up resources.
  7. The standalone Agent and ClineCore have different event systems. For Agent: use agent.subscribe() to get AgentRuntimeEvent types (text…

What it can do on your machine

Read from SKILL.md and the folder at commit fa840c7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.cline.bot
    • discord.gg

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cline SDK Guide loads about 2.2k tokens when it runs, and up to ~27k if it reads all its reference files. Until then it costs about 68 tokens; SKILL.md has 544 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~27k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from cline/cline at commit fa840c7, republished under its Apache-2.0 licence (© cline). 544 words, ~2,198 tokens.

Download SKILL.mdSave it as .claude/skills/cline-sdk/SKILL.md (or your agent's skills folder). This skill also uses 18 other files; get the full folder from GitHub.
name
cline-sdk
description
Comprehensive Cline SDK skill for building AI agents. Covers the 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.
metadata.references
agent, clinecore

Cline SDK Skill

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.

Critical Rules

Follow these rules in all Cline SDK code:

  1. Install with npm install @cline/sdk. The @cline/sdk package re-exports everything from @cline/core, @cline/agents, @cline/llms, and @cline/shared.
  2. Requires Node.js 22 or later.
  3. Use createTool() from @cline/sdk (or @cline/shared) to define tools. Tool names must be snake_case.
  4. Return errors as structured data from tool execute functions. Throwing counts as a "mistake" against the agent's mistake limit.
  5. Use lifecycle: { completesRun: true } on tools that should end the agent loop (e.g. a "submit answer" tool).
  6. When using ClineCore, always call dispose() when done to clean up resources.
  7. The standalone Agent and ClineCore have different event systems. For Agent: use agent.subscribe() to get AgentRuntimeEvent types (text streaming is "assistant-text-delta", result text is result.outputText). For ClineCore: use cline.subscribe() to get CoreSessionEvent types (text streaming is "chunk" with payload.type === "text", result text is result.text). There is no top-level onEvent field on AgentRuntimeConfig -- use agent.subscribe() or hooks.onEvent instead. Do not use event types like "content_update" or "content_start" with agent.subscribe() -- those are internal legacy types from the ClineCore adapter layer.

How to Use This Skill

Reference File Structure

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:

FilePurposeWhen to Read
REFERENCE.mdOverview, when to use, quick startAlways read first
api.mdFull API: classes, methods, config, typesWriting code
patterns.mdCommon patterns, best practicesImplementation guidance
gotchas.mdPitfalls, limitations, debuggingTroubleshooting

Cross-cutting concepts in ./references/<concept>/ have REFERENCE.md as the entry point.

Reading Order
  1. Start with REFERENCE.md for your chosen API surface
  2. Then read additional files relevant to your task:
    • Writing agent code -> api.md
    • Common patterns -> patterns.md
    • Creating tools -> tools/REFERENCE.md
    • Adding plugins/hooks -> plugins/REFERENCE.md
    • Configuring LLM providers -> providers/REFERENCE.md
    • Streaming events -> events/REFERENCE.md
    • Deploying to production -> production/REFERENCE.md
    • Scheduling agents -> scheduling/REFERENCE.md
    • Multi-agent orchestration -> multi-agent/REFERENCE.md
    • Debugging -> gotchas.md
Show full SKILL.md (205 more words)Show less
Example Paths
./references/agent/REFERENCE.md           # Start here for lightweight agents
./references/clinecore/REFERENCE.md       # Start here for full runtime
./references/agent/api.md                 # Agent class, config, methods
./references/tools/REFERENCE.md           # Creating and using tools
./references/plugins/REFERENCE.md         # Plugin system
./references/providers/REFERENCE.md       # LLM provider configuration

Quick Decision Trees

"Which API surface should I use?"
Which API?
+-- I want a simple, stateless agent with custom tools
|   +-- agent/ (Agent class from @cline/agents)
+-- I need session persistence, built-in tools, config discovery
|   +-- clinecore/ (ClineCore from @cline/core)
+-- I want built-in file/shell/search/web tools
|   +-- clinecore/ (has built-in tools; Agent does not)
+-- I want scheduled or recurring agents
|   +-- clinecore/ (automation API)
+-- I need multi-process or multi-client session sharing
|   +-- clinecore/ (hub-backed runtime)
+-- I'm building a browser-compatible agent
|   +-- agent/ (no Node.js dependencies)
"I need to create tools"
Tools?
+-- Define a custom tool with schema -> tools/REFERENCE.md
+-- Use built-in tools (bash, editor, read_files) -> tools/REFERENCE.md (built-in section)
+-- Control tool approval/policies -> tools/REFERENCE.md (policies section)
+-- Tool that ends the agent loop -> tools/REFERENCE.md (completion tools)
+-- Package tools as a reusable plugin -> plugins/REFERENCE.md
"I need to handle events"
Events?
+-- Stream text/reasoning in real time -> events/REFERENCE.md
+-- Track token usage and costs -> events/REFERENCE.md
+-- Watch tool calls -> events/REFERENCE.md
+-- Detect completion/errors -> events/REFERENCE.md
+-- Hook into lifecycle stages -> plugins/REFERENCE.md
"I need to configure a model provider"
Providers?
+-- Anthropic (Claude) -> providers/REFERENCE.md
+-- OpenAI (GPT) -> providers/REFERENCE.md
+-- Google (Gemini/Vertex) -> providers/REFERENCE.md
+-- AWS Bedrock -> providers/REFERENCE.md
+-- Mistral -> providers/REFERENCE.md
+-- OpenAI-compatible (vLLM, Together, etc.) -> providers/REFERENCE.md
+-- Custom/self-hosted provider -> providers/REFERENCE.md
"I need plugins or hooks"
Plugins?
+-- Package tools + hooks together -> plugins/REFERENCE.md
+-- Observe tool calls (logging, metrics) -> plugins/REFERENCE.md
+-- Intercept lifecycle events -> plugins/REFERENCE.md
+-- Add system prompt rules -> plugins/REFERENCE.md
+-- Distribute via npm/git -> plugins/REFERENCE.md
"I need multi-agent coordination"
Multi-agent?
+-- Spawn one-off background agents -> multi-agent/REFERENCE.md (sub-agents)
+-- Persistent cross-session teams -> multi-agent/REFERENCE.md (teams)
+-- Parent-child delegation -> multi-agent/REFERENCE.md (sub-agents)
+-- Peer-to-peer task board -> multi-agent/REFERENCE.md (teams)
"I need scheduling or automation"
Scheduling?
+-- Recurring cron jobs -> scheduling/REFERENCE.md
+-- One-off scheduled tasks -> scheduling/REFERENCE.md
+-- Event-driven triggers -> scheduling/REFERENCE.md
+-- CLI schedule management -> scheduling/REFERENCE.md
"I need to go to production"
Production?
+-- Error handling and status checks -> production/REFERENCE.md
+-- Cost control and token limits -> production/REFERENCE.md
+-- Observability (OpenTelemetry) -> production/REFERENCE.md
+-- Security and sandboxing -> production/REFERENCE.md
+-- Deployment patterns -> production/REFERENCE.md
Troubleshooting Index
  • Agent loop not stopping -> tools/REFERENCE.md (completion tools)
  • Tool errors crashing the agent -> agent/gotchas.md or clinecore/gotchas.md
  • Provider auth failures -> providers/REFERENCE.md
  • Session not persisting -> clinecore/gotchas.md
  • Token usage too high -> production/REFERENCE.md (cost control)
  • Hub connection issues -> clinecore/gotchas.md
  • Plugin not loading -> plugins/REFERENCE.md
  • Events not firing -> events/REFERENCE.md

Product Index

API Surfaces
APIEntry FileDescription
Agent./references/agent/REFERENCE.mdLightweight stateless agent loop
ClineCore./references/clinecore/REFERENCE.mdFull runtime with sessions, persistence, built-in tools
Cross-Cutting Concepts
ConceptEntry FileDescription
Tools./references/tools/REFERENCE.mdBuilt-in and custom tool creation
Plugins./references/plugins/REFERENCE.mdExtension system with hooks
Events./references/events/REFERENCE.mdReal-time streaming events
Providers./references/providers/REFERENCE.mdLLM provider configuration
Production./references/production/REFERENCE.mdDeployment, security, observability
Scheduling./references/scheduling/REFERENCE.mdCron jobs and automation
Multi-Agent./references/multi-agent/REFERENCE.mdTeams and sub-agents
Package Map
PackagePurpose
@cline/sdkEverything you need, install this one
@cline/coreSessions, persistence, built-in tools, config, hub
@cline/agentsStateless agent loop, tool orchestration, streaming
@cline/llmsLLM provider gateway
@cline/sharedTypes, tool helpers, hook engine

Resources

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

© cline, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 18 other files (references) in .agents/skills/cline-sdk of cline/cline.

  • SKILL.md
  • references/agent/REFERENCE.md
  • references/agent/api.md
  • references/agent/gotchas.md
  • references/agent/patterns.md
  • references/clinecore/REFERENCE.md
  • references/clinecore/api.md
  • references/clinecore/gotchas.md
  • references/clinecore/patterns.md
  • references/events/REFERENCE.md
  • references/multi-agent/REFERENCE.md
  • references/plugins/REFERENCE.md
  • references/production/REFERENCE.md
  • references/providers
  • … and 5 more

Open the folder on GitHubat commit fa840c7

Compare with similar skills

Cline SDK Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cline SDK Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cline SDK Guide this skillcline/cline70k—~2.2kAutomated safety check: PassApache-2.0
Swarms Multi-Agent Frameworkkyegomez/swarms7.2k—~5.5kAutomated safety check: PassApache-2.0
Agent Squad Python Guide2FastLabs/agent-squad7.8k—~4.7kAutomated safety check: PassApache-2.0
Agent Squad for TypeScript2FastLabs/agent-squad7.8k—~4.3kAutomated safety check: PassApache-2.0
Langgraph Agent Patternssoba-labs/langchain-agent-skills107—~3.6kAutomated safety check: PassMIT
Openai Agentscoco-research/coco503—~3.3kAutomated safety check: PassMIT

Similar skills

  • Teaches the Swarms Python framework: the Agent class, tools, loops, memory and multi-agent structures such as sequential, concurrent and graph workflows.

    7.2k GitHub stars~5.5k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Agent Squad Python Guide

    2FastLabs/agent-squad

    Map of the agent-squad Python framework for async multi-agent orchestration: which agent, classifier, storage and tool provider to pick, and the pitfalls to avoid.

    7.8k GitHub stars~4.7k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Agent Squad for TypeScript

    2FastLabs/agent-squad

    Guide to building Node.js and TypeScript apps on the agent-squad package: orchestrator, agent types, classifier routing, storage, retrievers and MCP tools.

    7.8k GitHub stars~4.3k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Langgraph Agent Patterns

    soba-labs/langchain-agent-skills

    Implement multi-agent coordination patterns (supervisor-subagent, router, orchestrator-worker, handoffs) for LangGraph applications.

    107 GitHub stars~3.6k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Openai Agents

    coco-research/coco

    Build AI applications with OpenAI Agents SDK - text agents, voice agents, multi-agent handoffs, tools with Zod schemas, guardrails, and streaming.

    503 GitHub stars~3.3k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • AI Agents Architect

    omer-metin/skills-for-antigravity

    Expert in designing and building autonomous AI agents. An agent skill from omer-metin/skills-for-antigravity.

    162 GitHub stars~558 tokensUpdated 8 mo ago
    AI & LLM EngineeringAuto-check passed

More from cline/cline

All 8 skills in this repo
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    Auto-check passed
  • Helps build terminal user interfaces with OpenTUI using its core imperative API or its React and Solid reconcilers, with references for layout, keyboard, animation and testing.

    70k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Guides publishing a one-time What's new dialog in the Cline desktop app: deciding if one is due, picking highlights from the changelog and editing one content file.

    70k GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Covers preparing, tagging and publishing a Cline desktop app release on the stable, beta or nightly channel through the desktop-publish GitHub workflow.

    70k GitHub stars~4.5k tokensUpdated today
    Auto-check passed
  • Validates and publishes the standalone @cline/ui npm package through its own release workflow, separate from the Cline SDK runtime packages.

    70k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Walks through releasing the Cline CLI package to npm: release notes, version bump, matching git tag, and either the GitHub workflow or a local publish.

    70k GitHub stars~3.4k tokensUpdated today
    Auto-check: warnings

Questions about Cline SDK Guide

What does Cline SDK Guide do?

Reference for building AI agents with the Cline SDK: the Agent runtime, ClineCore sessions, custom tools, plugins, events, providers, scheduling and multi-agent teams. The skill uses decision trees to pick an entry point and then loads detailed references.js 22 or later, to define tools with createTool using snake_case names, to return errors from tools as structured data because throwing counts as a mistake against the agent's limit, to flag run-ending tools with a lifecycle setting, and to call dispose() on ClineCore when finished.

When should I use Cline SDK Guide?

Cline SDK Guide fits situations like: writing an agent with the Cline SDK; defining custom tools with createTool; subscribing to Agent or ClineCore events; building multi-agent teams or scheduling runs.

How do I install Cline SDK Guide in Claude Code?

Run `npx skills add cline/cline --skill cline-sdk -a claude-code`. Or copy the skill folder (.agents/skills/cline-sdk in cline/cline) into .claude/skills/cline-sdk in your project. Claude Code loads it when a task matches its description.

How do I install Cline SDK Guide in Codex?

Run `npx skills add cline/cline --skill cline-sdk -a codex`. Or copy the skill folder (.agents/skills/cline-sdk in cline/cline) into .agents/skills/cline-sdk in your project. Codex loads it when a task matches its description.

Can I use Cline SDK Guide in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cline/cline --skill cline-sdk -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cline-sdk, .gemini/skills/cline-sdk, .github/skills/cline-sdk and .opencode/skills/cline-sdk in your project.

What does Cline SDK Guide need to run?

Going by SKILL.md and its folder, Cline SDK Guide needs the command-line tools its instructions call (npm). Our summary lists: Node.js 22 or later; The @cline/sdk package.

Does Cline SDK Guide access the network?

SKILL.md names 2 domains. As links in the text: docs.cline.bot and discord.gg. This is read from the text; nothing was executed.

Is Cline SDK Guide safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Cline SDK Guide use?

Cline SDK Guide is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cline SDK Guide use?

About 2.2k tokens (SKILL.md is roughly 8.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 25k tokens, read only when the agent opens those files.

What are the alternatives to Cline SDK Guide?

Skills that share tags, products or a category with Cline SDK Guide: Swarms Multi-Agent Framework (kyegomez/swarms, 7.2k stars), Agent Squad Python Guide (2FastLabs/agent-squad, 7.8k stars), Agent Squad for TypeScript (2FastLabs/agent-squad, 7.8k stars) and Langgraph Agent Patterns (soba-labs/langchain-agent-skills, 107 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cline SDK Guide?

cline (a GitHub organization) maintains it in cline/cline, which has 70,041 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on October 9, 2026.

Source: cline/cline on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.