cline-sdk
Skill này làm gì
Skill này giải thích cách xây dựng AI agent bằng Cline SDK, từ tool tùy chỉnh tới thiết lập sản xuất đầy đủ. Nó dành cho lập trình viên muốn tạo phần mềm agent của riêng họ.
Khi nào nên dùng
- ✓Khi một lập trình viên muốn xây dựng AI agent bằng Cline SDK.
- ✓Khi ai đó cần tool hoặc sự kiện tùy chỉnh cho một agent xây trên Cline.
- ✓Khi lên kế hoạch cho một đội nhiều agent hoặc agent theo lịch với Cline SDK.
Liên kết skill
https://github.com/cline/cline/blob/main/.agents/skills/cline-sdk/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi muốn xây một AI agent nhỏ bằng Node.js dùng tool tùy chỉnh. Tôi bắt đầu với Cline SDK thế nào?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent dùng các hướng dẫn quyết định để chọn điểm vào phù hợp, rồi làm theo quy tắc cho tool, phiên và sự kiện. Nó tải các hướng dẫn chi tiết cho những phần dự án cần.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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:
- Install with
npm install @cline/sdk. The@cline/sdkpackage re-exports everything from@cline/core,@cline/agents,@cline/llms, and@cline/shared. - Requires Node.js 22 or later.
- Use
createTool()from@cline/sdk(or@cline/shared) to define tools. Tool names must besnake_case. - Return errors as structured data from tool
executefunctions. Throwing counts as a "mistake" against the agent's mistake limit. - Use
lifecycle: { completesRun: true }on tools that should end the agent loop (e.g. a "submit answer" tool). - When using
ClineCore, always calldispose()when done to clean up resources. - The standalone
AgentandClineCorehave different event systems. ForAgent: useagent.subscribe()to getAgentRuntimeEventtypes (text streaming is"assistant-text-delta", result text isresult.outputText). ForClineCore: usecline.subscribe()to getCoreSessionEventtypes (text streaming is"chunk"withpayload.type === "text", result text isresult.text). There is no top-levelonEventfield onAgentRuntimeConfig-- useagent.subscribe()orhooks.onEventinstead. Do not use event types like"content_update"or"content_start"withagent.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:
| 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.
Reading Order
- Start with
REFERENCE.mdfor your chosen API surface - 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
- Writing agent code ->
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 t
Câu hỏi thường gặp
SDK yêu cầu gì?
Skill cho biết Node.js 22 trở lên, và cài đặt bằng npm install @cline/sdk.
Tool được định nghĩa thế nào?
Skill cho biết dùng createTool, với tên dạng snake_case và kết quả lỗi có cấu trúc.
Các agent có làm việc theo đội được không?
Có. Skill bao gồm các đội nhiều agent như một trong những chủ đề.
Chi tiết
Mô tả gốc của tác giả
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.
repo: cline/cline
Độ phổ biến
- Sao GitHub
- 71k
- Vị trí xếp hạng
- #3105
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
create-pull-request
71kGiúp agent của bạn tạo pull request trên GitHub với tiêu đề và mô tả rõ ràng, theo template của dự án và kiểm tra nhánh trước.
opentui
71kGiúp agent của bạn xây giao diện người dùng terminal bằng OpenTUI, bao gồm bố cục, xử lý bàn phím, thành phần, hoạt ảnh và kiểm thử.
tuistory
71kDạy agent của bạn điều khiển và kiểm thử ứng dụng terminal trong một phiên chạy nền, gõ lệnh và đọc màn hình, ngay cả khi không có màn hình hiển thị.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.