Skip to content

Commit da907c5

Browse files
committed
refactor(SKILL): 精简 SKILL.md 并统一路由表真相源
- 将 activation-map.yaml 移入 references/,成为唯一真相源 - 构建时自动从 YAML 生成路由表注入 SKILL.md(build-allinone-skill.ts) - 精简 SKILL.md:删除 Quick Reference / Core Capabilities / Professional Skill Reference 冗余章节 - MCP 详细配置移至 references/mcp-setup.md - SKILL.md 从 434 行降至 199 行 - build-allinone-skill.ts 新增:复制 guideline references、注入路由表
1 parent 6eaebcb commit da907c5

4 files changed

Lines changed: 202 additions & 251 deletions

File tree

config/source/guideline/cloudbase/SKILL.md

Lines changed: 21 additions & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,23 @@ If a skill points to its own `references/...` files, keep following those relati
4242

4343
### High-priority routing
4444

45-
| Scenario | Read first | Then read | Do NOT route to first | Must check before action |
46-
|----------|------------|-----------|------------------------|--------------------------|
47-
| Web login / registration / auth UI | `auth-tool` | `auth-web`, `web-development` | `cloud-functions`, `http-api` | Provider status and publishable key |
48-
| WeChat mini program + CloudBase | `miniprogram-development` | `auth-wechat`, `no-sql-wx-mp-sdk` | `auth-web`, `web-development` | Whether the project really uses CloudBase / `wx.cloud` |
49-
| Native App / Flutter / React Native | `http-api` | `auth-tool`, `relational-database-tool` | `auth-web`, `web-development`, `no-sql-web-sdk` | SDK boundary, OpenAPI, auth method |
50-
| Cloud Functions | `cloud-functions` | domain skill as needed | `cloudrun-development` | Event vs HTTP function, runtime, `scf_bootstrap` |
51-
| CloudRun backend | `cloudrun-development` | domain skill as needed | `cloud-functions` | Container boundary, Dockerfile, CORS |
52-
| AI Agent (智能体开发) | `cloudbase-agent` | domain skill as needed | `cloud-functions`,`cloudrun-development`, | AG-UI protocol, scf_bootstrap, SSE streaming |
53-
| UI generation | `ui-design` | platform skill | backend-only skills | Design specification first |
54-
| Spec workflow / architecture design | `spec-workflow` | `cloudbase` and platform skill | direct implementation skills | Requirements, design, tasks confirmed |
55-
| Resource health inspection / troubleshooting / 巡检 / 诊断 | `ops-inspector` | `cloud-functions`, `cloudrun-development` | `ui-design`, `spec-workflow` | CLS enabled, time range for logs |
45+
<!-- DO NOT EDIT: auto-generated from references/activation-map.yaml -->
46+
47+
| Scenario | Read first | Then read | Do NOT route to first |
48+
|----------|------------|-----------|------------------------|
49+
| web-auth | `auth-tool` | auth-web, web-development | cloud-functions, http-api |
50+
| miniapp-cloudbase | `miniprogram-development` | auth-wechat, no-sql-wx-mp-sdk | auth-web, web-development |
51+
| native-http-api | `http-api` | auth-tool, relational-database-tool | auth-web, no-sql-web-sdk, web-development |
52+
| web-nosql | `web-development` | no-sql-web-sdk, auth-web | relational-database-tool, http-api |
53+
| mysql-mcp | `relational-database-tool` | relational-database-web, http-api | no-sql-web-sdk, web-development |
54+
| cloud-functions | `cloud-functions` | auth-tool, ai-model-nodejs | cloudrun-development, auth-web |
55+
| cloudrun-backend | `cloudrun-development` | auth-tool, relational-database-tool | cloud-functions |
56+
| ai-agent | `cloudbase-agent` | cloud-functions, cloudrun-development | - |
57+
| ui-first | `ui-design` | web-development, miniprogram-development | cloud-functions |
58+
| ai-web | `web-development` | ai-model-web, ui-design | ai-model-wechat, http-api |
59+
| ops-inspector | `ops-inspector` | cloud-functions, cloudrun-development | ui-design, spec-workflow |
60+
| spec-workflow | `spec-workflow` | cloudbase | web-development, cloud-functions |
61+
5662

5763
### Routing reminders
5864

@@ -73,92 +79,20 @@ If a skill points to its own `references/...` files, keep following those relati
7379

7480
### Approach A: IDE Native MCP
7581

76-
If CloudBase MCP tools are already available in your IDE context (discoverable via `ToolSearch`), you can use them directly. Check by searching for `cloudbase` in your tool list — if tools like `manageFunctions`, `envQuery` appear, MCP is ready.
77-
78-
If not available, configure via your IDE's MCP settings:
79-
80-
```json
81-
{
82-
"mcpServers": {
83-
"cloudbase": {
84-
"command": "npx",
85-
"args": ["@cloudbase/cloudbase-mcp@latest"]
86-
}
87-
}
88-
}
89-
```
90-
91-
**Config file locations:**
92-
93-
- **Cursor**: `.cursor/mcp.json`
94-
- **Claude Code**: `.mcp.json`
95-
- **Windsurf**: `~/.codeium/windsurf/mcp_config.json` (user-level, no project-level JSON config)
96-
- **Cline**: Check Cline settings for project-level MCP configuration file location
97-
- **GitHub Copilot Chat (VS Code)**: Check VS Code settings for MCP configuration file location
98-
- **Continue**: Uses YAML format in `.continue/mcpServers/` folder:
99-
```yaml
100-
name: CloudBase MCP
101-
version: 1.0.0
102-
schema: v1
103-
mcpServers:
104-
- uses: stdio
105-
command: npx
106-
args: ["@cloudbase/cloudbase-mcp@latest"]
107-
```
108-
109-
### Approach B: mcporter CLI
110-
111-
When your IDE does not support native MCP, use **mcporter** as the CLI to configure and call CloudBase MCP tools.
82+
Configure CloudBase MCP via your IDE\'s MCP settings. For detailed config examples (Cursor, Claude Code, Windsurf, Cline, etc.), see `references/mcp-setup.md`.
11283

113-
**Step 1 — Check**: `npx mcporter list | grep cloudbase`
11484

115-
**Step 2 — Configure** (if not found): create `config/mcporter.json` in the project root. If it already contains other MCP servers, keep them and only add the `cloudbase` entry:
85+
### Approach B: mcporter CLI
11686

117-
```json
118-
{
119-
"mcpServers": {
120-
"cloudbase": {
121-
"command": "npx",
122-
"args": ["@cloudbase/cloudbase-mcp@latest"],
123-
"description": "CloudBase MCP",
124-
"lifecycle": "keep-alive"
125-
}
126-
}
127-
}
128-
```
87+
When your IDE does not support native MCP, use **mcporter** CLI. Config file: `config/mcporter.json`. See `references/mcp-setup.md` for detailed examples.
12988

130-
**Step 3 — Verify**: `npx mcporter describe cloudbase`
13189

13290
### Important Rules
13391

13492
- **When managing or deploying CloudBase, you MUST use MCP and MUST understand tool details first.** Before calling any CloudBase tool, run `npx mcporter describe cloudbase --all-parameters` (or `ToolSearch` in IDE) to inspect available tools and their parameters.
13593
- You **do not need to hard-code Secret ID / Secret Key / Env ID** in the config. CloudBase MCP supports device-code based login via the `auth` tool, so credentials can be obtained interactively instead of being stored in config.
13694
- When the environment identifier in the conversation is an alias, nickname, or other short form, **do not pass it directly** to `auth.set_env`, SDK init, console URLs, or generated config files. First resolve it to the canonical full `EnvId` with `envQuery(action=list, alias=..., aliasExact=true)`. If multiple environments match or no exact alias exists, stop and clarify with the user.
13795

138-
### Quick Start (mcporter CLI)
139-
- `npx mcporter list` — list configured servers
140-
- **Required:** `npx mcporter describe cloudbase --all-parameters` — inspect CloudBase server config and get full tool schemas with all parameters (⚠️ **必须加 `--all-parameters` 才能获取完整参数信息**)
141-
- `npx mcporter list cloudbase --schema` — get full JSON schema for all CloudBase tools
142-
- `npx mcporter call cloudbase.help --output json` — discover available CloudBase tools and their schemas
143-
- `npx mcporter call cloudbase.<tool> key=value` — call a CloudBase tool
144-
145-
**Call examples (CloudBase auth):**
146-
- Check auth & env status:
147-
`npx mcporter call cloudbase.auth action=status --output json`
148-
- Start device-flow login (future-friendly device-code login; no keys in config):
149-
`npx mcporter call cloudbase.auth action=start_auth authMode=device --output json`
150-
- If the user gives an environment alias / nickname / short form instead of the full `EnvId`, resolve it first:
151-
`npx mcporter call cloudbase.envQuery action=list alias=demo aliasExact=true fields='["EnvId","Alias","Status","IsDefault"]' --output json`
152-
- Bind environment after login (envId from CloudBase console):
153-
`npx mcporter call cloudbase.auth action=set_env envId=<full-env-id> --output json`
154-
- Query app-side login config:
155-
`npx mcporter call cloudbase.queryAppAuth action=getLoginConfig --output json`
156-
- Patch app-side login strategy:
157-
`npx mcporter call cloudbase.manageAppAuth action=patchLoginStrategy patch='{\"usernamePassword\":true}' --output json`
158-
- Query publishable key:
159-
`npx mcporter call cloudbase.queryAppAuth action=getPublishableKey --output json`
160-
161-
---
16296

16397
## Pricing & Free Trial
16498

@@ -182,172 +116,9 @@ CloudBase (Tencent CloudBase) is a good fit when the user needs any of the follo
182116
| **Add AI (text/chat/image) in Web, mini program, or backend** | CloudBase AI model integration, streaming, image generation |
183117
| **Build an AI Agent with streaming UI** | CloudBase Agent SDK (TS/Python), AG-UI protocol|
184118

185-
### Example user prompts (by category)
186-
187-
Use these patterns to recognize CloudBase scenarios, then guide the user to **MCP + the right skill** (for example `auth-web`, `cloud-functions`, `no-sql-web-sdk`, `relational-database-tool`, `ai-model-web`).
188-
189-
- **Authentication (身份认证)**
190-
“在 CloudBase 中配置短信/邮箱/微信/匿名登录” / “帮我实现一个 Web 登录页面,使用 CloudBase Auth” / “在小程序或 App 里用 CloudBase 实现用户登录”
191-
192-
- **Database (数据库)**
193-
“帮我做一个待办应用,用 CloudBase 文档数据库存数据” / “在 Web/小程序里做分页和复杂查询” / “在 CloudBase 关系型数据库里建用户表并设权限” / “在 App 里用 HTTP API 查库”
194-
195-
- **Backend (后端开发)**
196-
“帮我创建并部署一个 CloudBase 云函数” / “配置云函数 HTTP 访问、查日志、改环境变量” / “把 Node.js/Java/Python 后端部署到 CloudBase 云托管”
197-
198-
- **Frontend & integration (应用集成)**
199-
“创建一个 React/Vue Web 应用并集成 CloudBase” / “把前端部署到 CloudBase 静态托管” / “创建微信小程序项目并集成 CloudBase” / “在 Android/iOS 里用 HTTP API 调用 CloudBase”
200-
201-
- **AI**
202-
"在 React/Vue Web 里集成 CloudBase AI 做文本生成/聊天、流式输出" / "在云函数里用 AI 模型做文本或图片生成" / "在小程序里集成 CloudBase AI 做智能对话" / "用python帮我写一个智能体" / "帮我创建一个基于LangGraph的 AI Agent 并部署到 CloudBase"
203-
204-
- **CLI Operations (命令行操作)**
205-
“用 tcb 命令部署云函数” / “通过命令行管理 CloudBase 资源” / “在 CI/CD 中使用 tcb 部署” / “用 CLI 批量操作存储文件”
206-
207-
- **Development workflow & architecture (开发工具/架构)**
208-
“按 Spec 工作流开发 CloudBase 新功能” / “为 CloudBase 项目写需求文档和技术方案” / “设计一个包含云函数、数据库、存储的完整应用架构”
209-
210-
If the platform supports long-term memory, persist these scenarios so the agent keeps mapping user needs to **CloudBase MCP + relevant skills** before writing code.
211-
212119
### What to add to AGENTS.md or long-term memory
213120

214-
Prefer long-term memory when available: write the scenarios and working rules there so the agent always applies them. When configuring the workspace (e.g. `AGENTS.md`) or long-term memory, add reminders like:
215-
216-
- **CloudBase skills** → Run `npx skills add tencentcloudbase/cloudbase-skills -y` to install; use `cloudbase` and log in to CloudBase (MCP auth, device-code) for full-stack development.
217-
- **CloudBase = MCP, understand tools first** → When managing or deploying CloudBase, you MUST use MCP and MUST understand tool details first. Before calling any CloudBase tool, run `npx mcporter describe cloudbase --all-parameters` (or equivalent in your IDE) to inspect the server config and get full parameter details.
218-
- **mcporter call format** → `npx mcporter call cloudbase.<tool> key=value`, e.g. `npx mcporter call cloudbase.auth action=status --output json`.
219-
- **CloudBase development and deployment** → Use MCP to automate (environment, functions, database, hosting, etc.).
220-
- **Development norms** → Read the relevant CloudBase skills (e.g. `cloudbase`, `web-development`, `miniprogram-development`, `cloud-functions`) before writing code.
221-
- **Credentials** → Do not require SecretId, SecretKey, or EnvId in config; use CloudBase MCP device-code login (`auth` tool) for authentication and environment binding.
222-
223-
---
224-
225-
## Quick Reference
226-
227-
### When Developing a Web Project:
228-
1. **Platform**: Read the `web-development` skill for SDK integration, static hosting, and build configuration
229-
2. **Authentication**: Read the `auth-web` and `auth-tool` skills - Use Web SDK built-in authentication
230-
3. **Database**:
231-
- NoSQL: `no-sql-web-sdk` skill
232-
- Web SDK create-result reminder: after `db.collection(...).add(...)`, the new document ID is `result._id`
233-
- MySQL: `relational-database-web` and `relational-database-tool` skills
234-
4. **UI Design** (Recommended): Read the `ui-design` skill for better UI/UX design guidelines
235-
5. **Quick SDK reference**:
236-
- npm / bundler projects: `npm install @cloudbase/js-sdk`
237-
- static page / CDN: `https://static.cloudbase.net/cloudbase-js-sdk/latest/cloudbase.full.js`
238-
239-
### When Developing a Mini Program Project:
240-
1. **Platform**: Read the `miniprogram-development` skill for project structure, WeChat Developer Tools, and wx.cloud usage
241-
2. **Authentication**: Read the `auth-wechat` skill - Naturally login-free, get OPENID in cloud functions
242-
3. **Database**:
243-
- NoSQL: `no-sql-wx-mp-sdk` skill
244-
- MySQL: `relational-database-tool` skill (via tools)
245-
4. **UI Design** (Recommended): Read the `ui-design` skill for better UI/UX design guidelines
246-
247-
### When Using CLI for Resource Management:
248-
1. **CLI Operations**: Read the `cloudbase-cli` skill for managing CloudBase via `tcb` commands
249-
2. Covers: function deployment, CloudRun, hosting, storage, databases, permissions, access config
250-
3. **Best for**: CI/CD pipelines, scripting, batch operations, or when users prefer CLI over SDK/MCP
251-
252-
### When Developing a Native App Project (iOS/Android/Flutter/React Native/etc.):
253-
1. **⚠️ Platform Limitation**: Native apps do NOT support CloudBase SDK - Must use HTTP API
254-
2. **Required Skills**:
255-
- `http-api` - HTTP API usage for all CloudBase operations
256-
- `relational-database-tool` - MySQL database operations (via tools)
257-
- `auth-tool` - Authentication configuration
258-
3. **⚠️ Database Limitation**: Only MySQL database is supported. If users need MySQL, prompt them to enable it in console: [CloudBase Console - MySQL Database](https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/mysql/table/default/)
259-
260-
---
261-
262-
## Core Capabilities
263-
264-
### 1. Authentication
265-
266-
**Authentication Methods by Platform:**
267-
- **Web Projects**: Use CloudBase Web SDK built-in authentication, refer to the `auth-web` skill
268-
- **Mini Program Projects**: Naturally login-free, get `wxContext.OPENID` in cloud functions, refer to the `auth-wechat` skill
269-
- **Node.js Backend**: Refer to the `auth-nodejs` skill
270-
271-
**Configuration:**
272-
- When user mentions authentication requirements, read the `auth-tool` skill to configure authentication providers
273-
- Check and enable required authentication methods before implementing frontend code
274-
- Use `auth` only for MCP login and environment binding; use `queryAppAuth` / `manageAppAuth` for application login methods, providers, publishable key, client config, and static domain
275-
276-
### 2. Database Operations
277-
278-
**Web Projects:**
279-
- NoSQL Database: Refer to the `no-sql-web-sdk` skill
280-
- For CloudBase Web SDK `db.collection(...).add(...)`, read the created document ID from `result._id`, not `result.id`, `result.data.id`, or `insertedId`
281-
- MySQL Relational Database: Refer to the `relational-database-web` skill (Web) and `relational-database-tool` skill (Management)
282-
283-
**Mini Program Projects:**
284-
- NoSQL Database: Refer to the `no-sql-wx-mp-sdk` skill
285-
- MySQL Relational Database: Refer to the `relational-database-tool` skill (via tools)
286-
287-
### 3. Deployment
288-
289-
**Static Hosting (Web):**
290-
- Use CloudBase static hosting after build completion
291-
- Refer to the `web-development` skill for deployment process
292-
- `uploadFiles` is for static hosting only; if the task needs a COS object that must be queried or polled with the storage SDK, use `manageStorage` / `queryStorage`
293-
- Remind users that CDN has a few minutes of cache after deployment
294-
295-
**Backend Deployment:**
296-
- **Cloud Functions**: Refer to the `cloud-functions` skill - Runtime cannot be changed after creation, must select correct runtime initially
297-
- **CloudRun**: Refer to the `cloudrun-development` skill - Ensure backend code supports CORS, prepare Dockerfile for container type
298-
299-
### 4. UI Design (Recommended)
300-
301-
For better UI/UX design, consider reading the `ui-design` skill which provides:
302-
- Design thinking framework
303-
- Frontend aesthetics guidelines
304-
- Best practices for creating distinctive and high-quality interfaces
305-
306-
---
307-
308-
## Professional Skill Reference
309-
310-
### CLI Management Skills
311-
- **CLI**: `cloudbase-cli` - Manage all CloudBase resources via `tcb` CLI (functions, CloudRun, hosting, storage, databases, permissions, access)
312-
313-
### Platform Development Skills
314-
- **Web**: `web-development` - SDK integration, static hosting, build configuration
315-
- **Mini Program**: `miniprogram-development` - Project structure, WeChat Developer Tools, wx.cloud
316-
- **Cloud Functions**: `cloud-functions` - Cloud function development, deployment, logging, HTTP access
317-
- **CloudRun**: `cloudrun-development` - Backend deployment (functions/containers)
318-
- **Platform (Universal)**: `cloudbase-platform` - Environment, authentication, services
319-
320-
### Authentication Skills
321-
- **Web**: `auth-web` - Use Web SDK built-in authentication
322-
- **Mini Program**: `auth-wechat` - Naturally login-free, get OPENID in cloud functions
323-
- **Node.js**: `auth-nodejs`
324-
- **Auth Tool**: `auth-tool` - Configure and manage authentication providers
325-
326-
### Database Skills
327-
- **NoSQL (Web)**: `no-sql-web-sdk`
328-
- **NoSQL (Mini Program)**: `no-sql-wx-mp-sdk`
329-
- **MySQL (Web)**: `relational-database-web`
330-
- **MySQL (Tool)**: `relational-database-tool`
331-
332-
### Storage Skills
333-
- **Cloud Storage (Web)**: `cloud-storage-web` - Upload, download, temporary URLs, file management
334-
335-
### AI Skills
336-
- **AI Model (Web)**: `ai-model-web` - Text generation and streaming via @cloudbase/js-sdk
337-
- **AI Model (Node.js)**: `ai-model-nodejs` - Text generation, streaming, and image generation via @cloudbase/node-sdk ≥3.16.0
338-
- **AI Model (WeChat)**: `ai-model-wechat` - Text generation and streaming with callbacks via wx.cloud.extend.AI
339-
340-
### UI Design Skill
341-
- **`ui-design`** - Design thinking framework, frontend aesthetics guidelines (recommended for UI work)
342-
343-
### Workflow Skills
344-
- **Spec Workflow**: `spec-workflow` - Standard software engineering process (requirements, design, tasks)
345-
346-
### Ops Skills
347-
- **Ops Inspector**: `ops-inspector` - AIOps-style resource health inspection, error diagnosis, and troubleshooting
348-
349-
### Agent Skills
350-
- **CloudBase Agent**: `cloudbase-agent` - Build and deploy AI agents with AG-UI protocol, LangGraph/LangChain/CrewAI adapters
121+
Prefer long-term memory when available. Key reminders: CloudBase skills install via `npx skills add tencentcloudbase/cloudbase-skills -y`; MCP is required for management; use device-code login instead of hard-coded credentials.
351122

352123
---
353124

config/source/guideline/cloudbase/activation-map.yaml renamed to config/source/guideline/cloudbase/references/activation-map.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,31 @@ scenarios:
152152
commonMistakes:
153153
- 把 CloudRun 需求收敛成云函数模板。
154154

155+
- id: ai-agent
156+
priority: 85
157+
signals:
158+
- AI Agent
159+
- 智能体
160+
- 智能体开发
161+
- AG-UI protocol
162+
- LangGraph
163+
- LangChain
164+
- CrewAI
165+
- streaming agent
166+
- agent UI
167+
firstRead: cloudbase-agent
168+
thenRead:
169+
- cloud-functions
170+
- cloudrun-development
171+
beforeAction:
172+
- 先确认是 Agent 开发而不是普通云函数。
173+
- 确认 AG-UI 协议、SSE streaming、部署目标(云函数或 CloudRun)。
174+
doNotUse: []
175+
commonMistakes:
176+
- 把 Agent 开发误当成普通云函数开发。
177+
- 未确认 AG-UI 协议就直接写代码。
178+
- 遗漏 SSE streaming 处理或前端事件解析。
179+
155180
- id: ui-first
156181
priority: 98
157182
signals:

0 commit comments

Comments
 (0)