Skip to content

Commit 66e102f

Browse files
authored
Merge pull request #694 from TencentCloudBase/feat/improve-docs-and-star-prompt
feat(docs): 📚 improve documentation clarity and tool descriptions
2 parents 6eaebcb + caed0e5 commit 66e102f

12 files changed

Lines changed: 2187 additions & 656 deletions

File tree

README-EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ The bridge that connects your AI IDE (Cursor, Copilot, etc.) directly to Tencent
2121
[![][cnb-shield]][cnb-link]
2222
[![][deepwiki-shield]][deepwiki-link]
2323

24+
⭐ Like this project? Star it to get notified when new versions are released!
25+
2426
**Found a game-changer for AI coding: one-click deploy from prompt to production**
2527

2628
[![][share-x-shield]][share-x-link]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
[![][deepwiki-shield]][deepwiki-link]
2727
[![MCP Badge](https://lobehub.com/badge/mcp/tencentcloudbase-cloudbase-ai-toolkit)](https://lobehub.com/mcp/tencentcloudbase-cloudbase-ai-toolkit)
2828

29+
⭐ 喜欢这个项目?点个 Star,新版本发布时你会收到通知~
30+
2931
**发现了一个让 AI 编程一键上线的神器,推荐给正在用 AI 编程的朋友**
3032

3133
[![][share-x-shield]][share-x-link]

config/source/skills/auth-web/SKILL.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ If the current task has not retrieved a real Publishable Key, omit `accessKey` i
107107

108108
**1. Phone OTP (Recommended)**
109109
- Automatically use `auth-tool-cloudbase` to turn on `SMS Login` through `manageAppAuth`
110-
- For phone registration, send the phone number to `auth.signUp({ phone, ... })` first, then call the returned `verifyOtp({ token })`. Do not swap the order.
110+
- Send the phone number to `auth.signInWithOtp({ phone, ... })`, then call the returned `verifyOtp({ token })`.
111+
- `signInWithOtp` can automatically create a new user if the user does not exist; control this via `shouldCreateUser` parameter (default `true`).
111112
```js
112-
const { data, error } = await auth.signUp({ phone: '13800138000' })
113-
const { data: loginData, error: loginError } = await data.verifyOtp({ token:'123456' })
113+
const { data, error } = await auth.signInWithOtp({ phone: '13800138000' })
114+
const { data: loginData, error: loginError } = await data.verifyOtp({ token: '123456' })
114115
```
115116

116117
**2. Email OTP**

doc/components/TutorialsGrid.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Link from '@docusaurus/Link';
2-
import React, { useMemo, useState } from 'react';
2+
import { useMemo, useState } from 'react';
33
import styles from './TutorialsGrid.module.css';
44

55
interface Tutorial {
@@ -388,17 +388,6 @@ const tutorials: Tutorial[] = [
388388
devToolTags: ['Cursor', 'Figma'],
389389
},
390390
// 视频
391-
{
392-
id: 'video-vibecoding-compare-coze-cloudbase',
393-
title: 'vibecoding托管平台对比 扣子 vs cloudbase',
394-
description: '君黎的折腾日常',
395-
category: '视频教程',
396-
url: 'https://www.bilibili.com/video/BV1vGXEBrERj/',
397-
type: 'video',
398-
thumbnail: 'https://7463-tcb-advanced-a656fc-1257967285.tcb.qcloud.la/video-thumbnails/BV1vGXEBrERj.jpg',
399-
terminalTags: ['Web'],
400-
appTypeTags: ['工具/效率'],
401-
},
402391
{
403392
id: 'video-figma-codebuddy-miniprogram',
404393
title: 'Figma + CodeBuddy + CloudBase 实战:完整开发一个微信小程序',

doc/index.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ AI 负责代码生成和问题修复,CloudBase 提供运行环境。两者结
2020

2121
先选择你正在使用的 AI 开发工具,**点击下方图标进入对应安装文档**,按文档完成 MCP 安装或配置。
2222

23-
> **注意**:这里的图标列表是安装入口,不是展示列表。请先点进去完成对应工具的接入,再继续下面的 Skills 和提示词。
23+
> 可点击下方图标完成对应工具的接入
2424
2525
<IDEIconGrid />
2626

2727
## 第 2 步:按需安装 CloudBase AI Skill(可选)
2828

2929
将云开发最佳实践打包成「技能包」,与 MCP 搭配使用:MCP 负责连接与权限,Skills 负责规范与直觉,让 AI 既有权又懂规矩。
3030

31-
> **这一步不是安装 MCP。** 如果你还没完成上一步,请先点击上方图标查看对应 IDE 的 MCP 安装指引。
32-
3331
```bash
3432
npx skills add tencentcloudbase/cloudbase-skills
3533
```

doc/mcp-tools.md

Lines changed: 2025 additions & 608 deletions
Large diffs are not rendered by default.

doc/prompts/auth-web.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ If the current task has not retrieved a real Publishable Key, omit `accessKey` i
147147
- `signInWithOtp` can automatically create a new user if the user does not exist; control this via `shouldCreateUser` parameter (default `true`).
148148
```js
149149
const { data, error } = await auth.signInWithOtp({ phone: '13800138000' })
150-
const { data: loginData, error: loginError } = await data.verifyOtp({ token:'123456' })
150+
const { data: loginData, error: loginError } = await data.verifyOtp({ token: '123456' })
151151
```
152152

153153
**2. Email OTP**

doc/prompts/cloudbase-platform.mdx

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ Keep local `references/...` paths for files that ship with the current skill dir
8686
- Staying here after the correct implementation skill is already clear.
8787
- Mixing platform overview with platform-specific API shapes or SDK details.
8888
- Using this overview skill as a detour in an existing application where the active auth, storage, and data files are already obvious.
89+
- **Confusing security domains with custom domains**: These are two completely different tools for different purposes:
90+
- `envDomainManagement` (action: create/delete) = Security domains (安全域名) for CORS/request source validation - used for browser upload whitelisting. Does NOT accept certificateId.
91+
- `manageGateway(action="bindCustomDomain")` = Custom domains (自定义域名) for public HTTPS access with SSL certificates - requires domain and certificateId parameters.
8992

9093
## When to use this skill
9194

@@ -131,6 +134,45 @@ Use this skill for **CloudBase platform knowledge** when you need to:
131134

132135
# CloudBase Platform Knowledge
133136

137+
### Domain Management Tools: Clear Distinction
138+
139+
When working with domain-related tasks, use the correct tool based on the requirement:
140+
141+
| Requirement | Tool | Parameters | Purpose |
142+
|-------------|------|------------|---------|
143+
| **Security Domain (安全域名)** | `envDomainManagement` | `action`, `domains` (array of host:port strings) | CORS/request source validation for browser uploads. No certificate involved. |
144+
| **Custom Domain (自定义域名)** | `manageGateway(action="bindCustomDomain")` | `domain` (string), `certificateId` (string) | Public HTTPS access with SSL certificate. Requires certId from SSL console. |
145+
| **Delete Custom Domain** | `manageGateway(action="deleteCustomDomain")` | `domain` (string) | Remove custom domain binding. |
146+
147+
**Key indicators for choosing the right tool:**
148+
- Task mentions "certificate ID" or "SSL" → Use `manageGateway(action="bindCustomDomain")`
149+
- Task mentions "浏览器上传" or "CORS" or "安全域名" → Use `envDomainManagement`
150+
- Task mentions "public access" or "HTTPS" with domain → Use `manageGateway`
151+
152+
### Recording Operation Results
153+
154+
When a task explicitly requires recording operation steps or results to a file (e.g., `RESULT.json`):
155+
156+
1. Perform the tool calls first to get actual results
157+
2. Collect all operation steps with their success/failure status
158+
3. Write the complete record to the specified file in the required format
159+
4. Include both successful operations and failed attempts with error messages
160+
161+
Example structure for operation recording:
162+
```json
163+
{
164+
"steps": [
165+
{"action": "listDomains", "success": true, "message": "Found 3 domains"},
166+
{"action": "bindDomain", "success": false, "message": "Certificate not found"}
167+
],
168+
"summary": {
169+
"totalAttempted": 2,
170+
"succeeded": 1,
171+
"failed": 1
172+
}
173+
}
174+
```
175+
134176
## Storage and Hosting
135177

136178
1. **Static Hosting vs Cloud Storage**:
@@ -229,6 +271,69 @@ Compatibility note:
229271
5. **Cross-Collection Operations**:
230272
- If user has no special requirements, operations involving cross-database collections must be implemented via cloud functions
231273

274+
## Role Management (MCP)
275+
276+
CloudBase MCP provides role management capabilities through the `queryPermissions` and `managePermissions` tools. These are equivalent to the CLI `tcb role` commands.
277+
278+
**⚠️ CRITICAL: Role policies and resource permissions are two independent systems with NO automatic synchronization.**
279+
280+
- Resource permissions (security rules) control access to specific resources (tables, collections, functions, storage)
281+
- Roles (identity dimension) control policy bundles and member assignments
282+
283+
### Available Actions
284+
285+
**Query Operations** (via `queryPermissions`):
286+
| Action | Description |
287+
|--------|-------------|
288+
| `listRoles` | List all roles (system and custom) |
289+
| `getRole` | Get detailed role information by roleId/roleIdentity/roleName |
290+
291+
**Management Operations** (via `managePermissions`):
292+
| Action | Description |
293+
|--------|-------------|
294+
| `createRole` | Create a new custom role |
295+
| `updateRole` | Update an existing role (add/remove policies or members) |
296+
| `deleteRoles` | Delete one or more custom roles |
297+
| `addRoleMembers` | Add members to a role |
298+
| `removeRoleMembers` | Remove members from a role |
299+
| `addRolePolicies` | Add policies to a role |
300+
| `removeRolePolicies` | Remove policies from a role |
301+
302+
### Usage Examples
303+
304+
**List all roles:**
305+
```
306+
queryPermissions(action="listRoles")
307+
```
308+
309+
**Get specific role details:**
310+
```
311+
queryPermissions(action="getRole", roleId="role-xxx")
312+
# or by identity
313+
queryPermissions(action="getRole", roleIdentity="dev_role")
314+
# or by name
315+
queryPermissions(action="getRole", roleName="Developer")
316+
```
317+
318+
**Delete a custom role:**
319+
```
320+
managePermissions(action="deleteRoles", roleIds=["role-xxx"])
321+
```
322+
323+
**Create a custom role:**
324+
```
325+
managePermissions(action="createRole", roleName="Developer", roleIdentity="developer", policies=["FunctionsAccess"], memberUids=["user-uid-1"])
326+
```
327+
328+
**Update a role (add policies):**
329+
```
330+
managePermissions(action="updateRole", roleId="role-xxx", addPolicies=["StoragesAccess"])
331+
```
332+
333+
> ⚠️ Note: Only custom roles can be deleted. System roles are read-only.
334+
335+
See also: CLI equivalent commands in `cloudbase-cli/references/permission.md`
336+
232337
3. **Cloud Function Optimization**:
233338
- If involving cloud functions, while ensuring security, can minimize the number of cloud functions as much as possible
234339
- For example: implement one cloud function for client-side requests, implement one cloud function for data initialization

doc/prompts/no-sql-web-sdk.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ Keep local `references/...` paths for files that ship with the current skill dir
7777
- SQL / MySQL database operations.
7878
- Pure resource-permission administration with no browser SDK code.
7979

80+
### SDK Code vs MCP Tools
81+
82+
**When to write SDK code (use this skill):**
83+
- The task explicitly asks to "modify code" or "use SDK"
84+
- The task asks to implement app/frontend logic
85+
- The task mentions specific SDK methods like `db.collection().add()`, `.get()`, `.update()`
86+
- The context shows an existing Web project with SDK initialization (e.g., `index.js` already has `cloudbase.init()`)
87+
88+
**When to use MCP tools instead:**
89+
- The task asks to manage CloudBase resources (create collection, set permissions, etc.)
90+
- The task involves admin/management operations without writing app code
91+
- The task mentions tools like `writeNoSqlDatabaseContent`, `managePermissions`, etc.
92+
93+
**Key distinction:** If the user says "使用 JS SDK 执行 XX 操作" (use JS SDK to perform XX operation) or "修改代码" (modify code), write SDK code in the project files. Do not use MCP database write tools for app-level data operations.
94+
8095
### Common mistakes / gotchas
8196

8297
- Querying before the user is signed in when the collection rules require identity.

0 commit comments

Comments
 (0)