Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)7.6k · #13182

server-plugins

Skill này làm gì

Skill này giải thích cách plugin máy chủ hoạt động trong ứng dụng Agent-Native và route framework nên nằm ở đâu. Skill dành cho lập trình viên thêm tính năng máy chủ hoặc gỡ lỗi các route xuất hiện tự động.

Khi nào nên dùng

  • ✓Khi bạn cần thêm một plugin máy chủ tùy chỉnh vào ứng dụng.
  • ✓Khi bạn phải quyết định giữa một route API thường và một action.
  • ✓Khi một route framework tích hợp sẵn hoạt động theo cách bất ngờ.

Liên kết skill

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/server-plugins/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/server-plugins/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thêm một tính năng máy chủ tùy chỉnh vào ứng dụng này, và cho tôi biết nó nên là một route API hay một action.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Plugin mặc định được tải tự động. Chỉ các plugin cần tùy chỉnh mới có file riêng, và mọi route framework đều nằm dưới một tiền tố đường dẫn chung.

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.

Server Plugins & Framework Routes

Default Plugins (auto-mount)

Five default plugins auto-mount when your app doesn't have a custom version in server/plugins/:

Plugin Default behavior Customize when
agent-chat Agent chat endpoints Custom mentionProviders or systemPrompt
auth Auth middleware Custom publicPaths or Google OAuth config
core-routes /_agent-native/poll, /_agent-native/ping, etc Custom envKeys or sseRoute
resources Resource CRUD Rarely
terminal Terminal emulator Rarely

Only create plugin files for plugins you need to customize. Let defaults auto-mount.

Framework Route Namespace: /_agent-native/

All framework-level routes live under /_agent-native/ to avoid collisions with template-specific /api/* routes.

Hard rule

  • ALL framework routes go under /_agent-native/.
  • Templates own /api/* only for route-only domain concerns such as uploads, streaming, webhooks, OAuth callbacks, or non-JSON protocols.
  • Never put framework routes under /api/.
  • Never put template routes under /_agent-native/ — that namespace is reserved.
  • Never create /api/* routes that only wrap, proxy, or re-export actions. Use the existing /_agent-native/actions/:name endpoint or the React action hooks.

Auto-mounted framework routes

Route Purpose
GET /_agent-native/poll Polling endpoint for DB change detection
GET /_agent-native/events SSE endpoint for real-time sync
GET /_agent-native/ping Health check
GET/PUT/DELETE /_agent-native/application-state/:key Application state CRUD
GET/PUT/DELETE /_agent-native/application-state/compose/:id Compose draft CRUD
POST /_agent-native/agent-chat Agent chat SSE endpoint
GET /_agent-native/agent-chat/mentions Mention search for @-tagging
GET /_agent-native/env-status Env key configuration status
POST /_agent-native/env-vars Save env vars
/_agent-native/auth/* Authentication (login, session, logout)
/_agent-native/google/* Google OAuth (callback, auth-url, etc.)
/_agent-native/resources/* Resource CRUD
/_agent-native/actions/:name Auto-mounted action endpoints
/_agent-native/available-clis Available CLI tools
/_agent-native/agent-terminal-info Terminal connection info
/_agent-native/collab/* Real-time collaboration (see real-time-collab)
/_agent-native/a2a A2A JSON-RPC endpoint (see a2a-protocol)

Actions-First Approach

For standard CRUD and data operations, use defineAction in actions/ — the framework auto-mounts them as HTTP endpoints at /_agent-native/actions/:name. Only create custom /api/* routes for things actions can't do:

  • File uploads with multipart form data
  • Streaming responses
  • Webhooks from external services
  • OAuth callbacks

Before adding a route, inspect the existing action files. Reuse the action if it already encodes the business rule, or add a new action if the operation should be available to both the agent and the UI. A route whose implementation mostly calls an action is usually the wrong abst

Câu hỏi thường gặp

Mỗi plugin có cần một file không?

Không. Skill nói hãy để mặc định được tải và chỉ tùy chỉnh những gì bạn cần.

Route framework dùng đường dẫn nào?

Chúng dùng tiền tố /_agent-native/ để tránh trùng với route của ứng dụng.

Khi nào nên dùng route /api/?

Cho các mối quan tâm chỉ thuộc về route, như tải lên hoặc streaming.

Chi tiết

Mô tả gốc của tác giả

Framework server plugins and the `/_agent-native/` route namespace. Use when adding a custom server plugin, deciding whether to create an `/api/` route vs an action, or debugging auto-mounted framework routes.

repo: BuilderIO/agent-native

Độ phổ biến

Sao GitHub
7.6k
Vị trí xếp hạng
#13182
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự