Sibling skills (local only)
Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.
If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do not HTTP-fetch remote skill or protocol markdown into the agent context.
Cross-cutting protocols (required before code changes or deployments):
- Change Safety Protocol:
references/protocols/change-safety-protocol.md
- Deployment Gate:
references/protocols/deployment-gate.md
- Sensitive Runtime Data Protection:
references/protocols/sensitive-runtime-data-protection.md
Activation Contract
Use this first when
- The user asks which CloudBase capability, service, or tool to use, or needs a high-level understanding of hosting, storage, authentication, cloud functions, or database options.
- The task is about console navigation, cross-platform differences, permission models, or platform-level best practices before implementation.
Read before writing code if
- It is still unclear whether the task belongs to Web, mini program, cloud functions, storage, MySQL / NoSQL, or auth.
- The response needs platform selection, conceptual explanation, or control-plane navigation more than direct implementation steps.
Then also read
- Minimal Web + database demo (BaaS-first, no cloud functions by default) ->
../minimal-web-baas-demo/SKILL.md
- Stack order for 最小前后端 / Lovable-like demos: Web SDK CRUD > MCP schema > template warmup during credential wait > cloud functions (default count = 0). Capability sniff: connector ready →
envQuery → lock one DB plane → MCP schema → @cloudbase/js-sdk CRUD → preview.
- Web app implementation ->
../web-development/SKILL.md
- Web auth and provider setup ->
../auth-tool-cloudbase/SKILL.md, ../auth-web-cloudbase/SKILL.md
- Mini program development ->
../miniprogram-development/SKILL.md
- WeChat Pay, Official Account OAuth, JSAPI Pay, or Native QR-code Pay through CloudBase Integration Center ->
../cloudbase-wechat-integration/SKILL.md (official docs: https://docs.cloudbase.net/integration/introduce/index.md)
- Cloud functions ->
../cloud-functions/SKILL.md
- Official HTTP API clients ->
../http-api-cloudbase/SKILL.md
- Document database ->
../cloudbase-document-database-web-sdk/SKILL.md or ../cloudbase-document-database-in-wechat-miniprogram/SKILL.md
- CloudBase PostgreSQL / PG ->
../postgresql-development-cloudbase/SKILL.md
- MySQL relational database / data modeling ->
../relational-database-mcp-cloudbase/SKILL.md or ../data-model-creation/SKILL.md
- Cloud storage ->
../cloud-storage-web/SKILL.md
Do NOT use for
- Direct implementation of web pages, auth flows, functions, or database operations when a more specific skill already fits.
- Low-level API parameter references or SDK recipes that belong in specialized skills.
Common mistakes / gotchas
- Treating this general skill as the default entry point for all CloudBase development.
- Staying here after the correct implementation skill is already clear.
- Mixing platform overview with platform-specific API shapes or SDK details.
- Using this overview skill as a detour in an existing application where the active auth, storage, and data files are already obvious.
- Making code or configuration changes without first following the Change Safety Protocol (
cloudbase-platform/references/protocols/change-safety-protocol.md).
- Starting any deployment, publish, custom domain, or CloudRun work without first completing the checks in
cloudbase-platform/references/protocols/deployment-gate.md.
- Echoing
x-cloudbase-context, full req.headers, or process.env from Cloud Functions / CloudRun (including httpbin-style debug images) — follow references/protocols/sensitive-runtime-data-protection.md.
- Confusing security domains with custom domains: These are two completely different tools for different purposes:
envDomainManagement (action: create/delete) = Security domains (安全域名) for CORS/request source validation - used for browser upload whitelisting. Does NOT accept certificateId.
manageGateway(action="bindCustomDomain") = Bind a new custom domain (自定义域名) for public HTTPS — requires domain + certificateId. If queryGateway(action="listCustomDomains") already returns a usable custom domain, prefer manageGateway(action="createRoute", domain="<existing-domain>") instead; routing does not need certificateId.
When to use this skill
Use this skill for CloudBase platform knowledge when you need to:
- Understand CloudBase storage and hosting concepts
- Compare platform capabilities before implementation
- Understand cross-platform auth differences (Web vs Mini Program)
- Understand database permissions and access control
- Access CloudBase console management pages
This skill provides foundational knowledge that applies to all CloudBase projects, regardless of whether they are Web, Mini Program, or backend services.
How to use this skill (for a coding agent)
Understand platform differences
- Web and Mini Program have completely different authentication approaches
- Must strictly distinguish between platforms
- Never mix authentication methods across platforms
- If the workspace is already an application with TODOs or prebuilt handlers, do not stay in platform overview mode. Move quickly to the concrete implementation skill and the existing files that own the flow.
Follow best practices
- Use SDK built-in authentication features (Web)
- Understand natural login-free feature (Mini Program)
- Configure appropriate database permissions
- Prefer
@cloudbase/js-sdk direct DB access for browser CRUD; use cloud functions only for secrets, scheduled/background jobs, or elevated cross-collection logic that security rules / RLS cannot express (see ../minimal-web-baas-demo/SKILL.md for the demo default)
Use correct SDKs and APIs
- Different platforms require different SDKs for data models
- MySQL data models must use models SDK, not collection API
- PostgreSQL / CloudBase PG work must route to
postgresql-development-cloudbase; do not reuse NoSQL app.database() / db.collection(...) snippets or MySQL queryMysqlDatabase / manageMysqlDatabase for PG data paths
- Use
envQuery tool to get environment ID
- In an existing Web application with fixed structure, inspect the existing
src/lib/backend.*, src/lib/auth.*, src/lib/*service.*, and bound page handlers before broad concept reading.
Use the canonical CloudBase MCP setup from the main cloudbase guideline
- This platform overview intentionally does not duplicate the full MCP / mcporter config block
- For the canonical config snippet, CLI commands, and auth examples, read the main
cloudbase guideline first
- Keep the same core rules here: prefer MCP when tools are available in this session; if not, configure MCP for next session and use
tcb CLI now (../cloudbase-cli/SKILL.md, ../cloudbase/references/tooling-fallback.md). Inspect tool schemas before MCP execution. Do not hard-code Secret ID / Secret Key / Env ID in config
- Keep the auth split explicit: management-side login uses
auth, while application-side auth configuration uses queryAppAuth / manageAppAuth
CloudBase Platform Knowledge
Domain Management Tools: Clear Distinction
When working with domain-related tasks, use the correct tool based on the requirement:
| Requirement |
Tool |
Parameters |
Purpose |
| Security Domain (安全域名) |
envDomainManagement |
action, domains (array of host:port strings) |
CORS/request source validation for browser uploads. No certificate involved. |
| Reuse existing Custom Domain |
queryGateway(listCustomDomains) → manageGateway(createRoute) |
domain = existing custom domain; route fields |
Expose a service/path on an already-bound custom domain. No certificateId. Prefer this when a custom domain already exists. |
| Bind new Custom Domain (自定义域名) |
manageGateway(action="bindCustomDomain") |
domain (string), certificateId (string) |
First-time bind of a new public HTTPS domain. Requires certId from SSL console. |
| Delete Custom Domain |
manageGateway(action="deleteCustomDomain") |
domain (string) |
Remove custom domain binding (only after routes on that domain are deleted). |
| Disable / enable gateway route |
manageGateway(action="disableRoute" | "enableRoute") |
path (required), prefer explicit domain |
Toggle Routes[].Enable via ModifyHTTPServiceRoute (not ModifyGatewayRoute). |
| Disable static hosting default domain |
queryGateway(listRoutes) → manageGateway(disableRoute) |
domain = *.tcloudbaseapp.com (DomainType=STATIC_STORE, IsDefault=true), usually path="/" |
Turns off public access on the shared hosting CDN default host. Do not use manageHosting. |
Key indicators for choosing the right tool:
- Task mentions "自定义域名访问" but env already has a custom domain →
listCustomDomains then createRoute(domain=...) (no certificateId)
- Task mentions "certificate ID" or "SSL" and needs to bind a new domain →
manageGateway(action="bindCustomDomain")
- Task mentions "浏览器上传" or "CORS" or "安全域名" → Use
envDomainManagement
- Task mentions "public access" or "HTTPS" with domain → Prefer reuse via
createRoute when possible; only bindCustomDomain for first-time domain bind
- Task mentions "关闭/禁用静态托管默认域名" /
*.tcloudbaseapp.com → queryGateway(listRoutes) then manageGateway(disableRoute) with that STATIC_STORE domain; never invent ModifyGatewayRoute
Recording Operation Results
When a task explicitly requires recording operation steps or results to a file (e.g., RESULT.json):
- Perform the tool calls first to get actual results
- Collect all operation steps with their success/failure status
- Write the complete record to the specified file in the required format
- Include both successful operations and failed attempts with error messages
Example structure for operation recording:
{
"steps": [
{"action": "listDomains", "success": true, "message": "Found 3 domains"},
{"action": "bindDomain", "success": false, "message": "Certificate not found"}
],
"summary": {
"totalAttempted": 2,
"succeeded": 1,
"failed": 1
}
}
Storage and Hosting
Static Hosting vs Cloud Storage:
- CloudBase static hosting and cloud storage are two different buckets
- Generally, publicly accessible files can be stored in static hosting, which provides a public web address
- Static hosting supports custom domain configuration (requires console operation)
- Cloud storage is suitable for files with privacy requirements, can get temporary access addresses via temporary file URLs
- If the task needs COS SDK polling, file metadata lookup, or temporary URLs for an uploaded object, use cloud storage tools (
manageStorage / queryStorage), not manageHosting(action="upload")
Static Hosting Domain:
- CloudBase static hosting domain and website document config can be obtained via
queryHosting(action="websiteConfig")
- Combine with static hosting file paths to construct final access addresses
- Default shared host looks like
<envId>-<appId>.tcloudbaseapp.com (DomainType=STATIC_STORE, often IsDefault=true in queryGateway(listRoutes))
- To disable that default public host:
manageGateway(action="disableRoute", domain="<that-host>", path="/") (or updateRoute with enable=false). Re-enable with enableRoute. Do not look for a manageHosting disable-default-domain action; do not call non-existent ModifyGatewayRoute — the API is ModifyHTTPServiceRoute
- Important: If access address is a directory, it must end with
/
Cloud Storage Public URL:
- CRITICAL:
manageStorage(action=upload) and queryStorage(action=url) return temporaryUrl which is a temporary signed URL that expires (default 1 hour). Do NOT use this as a permanent public URL.
- To get the permanent public access URL for a cloud storage object:
- Call
envQuery(action=info) to get environment details
- Extract the storage CDN domain from
EnvInfo.Storages[0].CdnDomain (e.g., your-env-id.tcb.qcloud.la)
- Construct the public URL:
https://{CdnDomain}/{cloudPath}
- Example: If
CdnDomain is env-xxx.tcb.qcloud.la and cloudPath is uploads/avatar.jpg, the public URL is https://env-xxx.tcb.qcloud.la/uploads/avatar.jpg
- Note: The public URL is accessible only if the storage bucket ACL allows public read (default is
PRIVATE which requires signed URLs)
Environment and Authentication
SDK Initialization:
- CloudBase SDK initialization requires environment ID
- Can query environment ID via
envQuery tool
- If the user only provides an environment alias, nickname, or other short form, resolve it with
envQuery(action="list", alias=..., aliasExact=true) first and use the returned full EnvId
- Do not pass alias-like short forms directly into SDK init,
auth.set_env, console URLs, or generated config files
- For Web, always initialize synchronously:
import cloudbase from "@cloudbase/js-sdk"; const app = cloudbase.init({ env: "your-full-env-id" });
- Do not use dynamic imports like
import("@cloudbase/js-sdk") or async wrappers such as initCloudBase() with internal initPromise
- Then proceed with login using a verified method (username/password, phone, email, or WeChat)
Environment Management (via manageEnv):
The manageEnv tool provides full lifecycle management for CloudBase environments.
| Action |
Description |
Key Parameters |
listPackages |
Query available plans |
(none) |
create |
Create new environment (needs confirm) |
alias, packageId, resources, duration |
modifyPlan |
Change plan (upgrade/downgrade, needs confirm) |
envId, packageId |
renew |
Renew environment (needs confirm) |
envId, duration |
Creating an environment with specific resources:
manageEnv(action="create", alias="my-env", packageId="baas_personal",
resources=["flexdb","storage","function","postgresql"], confirm="yes")
resources (optional, create only): controls which CloudBase capabilities to enable:
flexdb — Document database (NoSQL)
storage — Cloud Storage
function — Cloud Functions
postgresql — PostgreSQL relational database (PG mode)
- Defaults to all four when omitted. MCP always sends non-empty
Resources to CreateEnv.
- Do not pass
region: CreateEnv does not accept Region; environment region is determined by account/package.
- ⚠️ All paid operations (create / modifyPlan / renew) require
confirm="yes".
Querying available packages before creating:
manageEnv(action="listPackages")
Changing plan (e.g. personal → standard):
manageEnv(action="modifyPlan", envId="your-env-id", packageId="baas_pf_standard", confirm="yes")
Renewing an environment:
manageEnv(action="renew", envId="your-env-id", duration=1, confirm="yes")
Authentication Best Practices
Important: Authentication methods for different platforms are completely different, must strictly distinguish!
Web Authentication
- Must use SDK built-in authentication: CloudBase Web SDK provides complete authentication features
- Recommended method: SMS login with
auth.getVerification(), for detailed, refer to web auth related docs
- Forbidden behavior: Do not use cloud functions to implement login authentication logic
- Session management: For route guards and login proof, use
auth.getSession() and require data.session; do not use deprecated getLoginState() or auth.getUser() / auth.getCurrentUser() as proof of real login.
- Provider and login-method setup: Use
queryAppAuth / manageAppAuth, not the MCP auth tool
- Anonymous login is disabled by default. Publishable
accessKey alone does not create a gateway-authenticated anonymous session. With @cloudbase/js-sdk 3.x, call await auth.signInAnonymously() (or an equivalent authenticated session) before NoSQL app.database() CRUD, or the gateway returns 401. If the app uses AuthGuard or RLS for access control, ensure is_anonymous checks are in place when anonymous access is allowed.
- ⚠️ PG RLS: Use
auth.uid(), NOT current_user. When writing RLS policies for CloudBase PostgreSQL, the user identity must use auth.uid() (returns the JWT sub / actual user ID as text, not uuid — unlike Supabase). Prefer owner columns as varchar(64) / text; if the column is uuid, cast with auth.uid()::uuid or you get operator does not exist: uuid = text. Do NOT use current_user or current_setting(...) — these PostgreSQL built-in functions return the database role name (e.g. authenticated), not the CloudBase auth user ID. CloudBase PG provides four auth helper functions: auth.uid(), auth.role(), auth.email(), auth.jwt(). Verify availability with SELECT proname FROM pg_proc WHERE pronamespace = 'auth'::regnamespace.
Mini Program Authentication
- Login-free feature: Mini program CloudBase is naturally login-free, no login flow needed
- User identifier: In cloud functions, get
wxContext.OPENID via wx-server-sdk
- User management: Manage user data in cloud functions based on openid
- Forbidden behavior: Do not generate login pages or login flow code
Cloud Functions
- Node.js Cloud Functions:
- Node.js cloud functions need to include
package.json, declaring required dependencies
- Can use
manageFunctions(action="createFunction") to create functions
- Use
manageFunctions(action="updateFunctionCode") to deploy cloud functions
- Prioritize cloud dependency installation, do not upload node_modules
functionRootPath refers to the parent directory of function directories, e.g., cloudfunctions directory
Database Permissions
⚠️ CRITICAL: Always configure permissions BEFORE writing database operation code!
Permission Model:
- CloudBase database access has permissions
- Default basic permissions include:
- READONLY: Everyone can read, only creator/admin can write
- PRIVATE: Only creator/admin can read/write
- ADMINWRITE: Everyone can read, only admin can write (⚠️ NOT for Web SDK write!)
- ADMINONLY: Only admin can read/write
- CUSTOM: Fine-grained control with custom rules
Platform Compatibility (CRITICAL):
- ⚠️ Web SDK cannot use
ADMINWRITE or ADMINONLY for write operations
- ✅ For user-generated content in Web apps, use CUSTOM rules
- ✅ For admin-managed data (products, settings), use READONLY
- ✅ Cloud functions have full access regardless of permission type
Configuration Workflow:
Create collection → Configure security rules → Write code → Test
- Use
managePermissions(action="updateResourcePermission") to configure resource permissions
- If permissions were just changed, retry after a few seconds (typically within ~30s). Do not blind-wait 2-5 minutes. If it still fails, re-check the actual rule shape and active client write pattern first — most failures are misconfigured rules, not cache.
- See
no-sql-web-sdk/security-rules.md for detailed resourceType="noSqlDatabase" examples only; do not treat doc._openid, auth.openid, query-subset validation, or create / update / delete JSON templates as generic rules for functions, storage, or SQL tables
- Official references:
- General security rules overview:
https://cloud.tencent.com/document/product/876/41802
- NoSQL database security rules:
https://docs.cloudbase.net/database/security-rules
- Cloud function security rules:
https://docs.cloudbase.net/cloud-function/security-rules
- Storage security rules:
https://docs.cloudbase.net/storage/security-rules
Compatibility note:
- Canonical plugin name:
permissions
- Legacy plugin aliases
security-rule, security-rules, secret-rule, secret-rules, and access-control still resolve to the permissions plugin
- Legacy tools
readSecurityRule / writeSecurityRule are removed; prefer queryPermissions / managePermissions
Common Scenarios:
- E-commerce products:
READONLY (admin manages via cloud functions)
- Shopping carts:
CUSTOM with auth.uid check (users manage their own)
- Orders:
CUSTOM with ownership validation
- System logs:
PRIVATE or ADMINONLY
Cross-Collection Operations:
- Prefer security rules / RLS and client SDK when the permission model allows it
- Use cloud functions when the operation needs elevated privileges, server secrets, or multi-collection logic that rules cannot express
- For minimal Web demos (Todo / Notes / Kanban / 最小前后端), do not introduce cloud functions for CRUD — follow
../minimal-web-baas-demo/SKILL.md
Role Management (MCP)
CloudBase MCP provides role management capabilities through the queryPermissions and managePermissions tools. These are equivalent to the CLI tcb role commands.
⚠️ CRITICAL: Role policies and resource permissions are two independent systems with NO automatic synchronization.
- Resource permissions (security rules) control access to specific resources (tables, collections, functions, storage)
- Roles (identity dimension) control policy bundles and member assignments
Available Actions
Query Operations (via queryPermissions):
| Action |
Description |
listRoles |
List all roles (system and custom) |
getRole |
Get detailed role information by roleId/roleIdentity/roleName |
Management Operations (via managePermissions):
| Action |
Description |
createRole |
Create a new custom role |
updateRole |
Update an existing role (add/remove policies or members) |
deleteRoles |
Delete one or more custom roles |
addRoleMembers |
Add members to a role |
removeRoleMembers |
Remove members from a role |
addRolePolicies |
Add policies to a role |
removeRolePolicies |
Remove policies from a role |
Usage Examples
List all roles:
queryPermissions(action="listRoles")
Get specific role details:
queryPermissions(action="getRole", roleId="role-xxx")
# or by identity
queryPermissions(action="getRole", roleIdentity="dev_role")
# or by name
queryPermissions(action="getRole", roleName="Developer")
Delete a custom role:
managePermissions(action="deleteRoles", roleIds=["role-xxx"])
Create a custom role:
managePermissions(action="createRole", roleName="Developer", roleIdentity="developer", policies=["FunctionsAccess"], memberUids=["user-uid-1"])
Update a role (add policies):
managePermissions(action="updateRole", roleId="role-xxx", addPolicies=["StoragesAccess"])
⚠️ Note: Only custom roles can be deleted. System roles are read-only.
See also: CLI equivalent commands in cloudbase-cli/references/permission.md
- Cloud Function Optimization:
- Browser CRUD should not default to a cloud-function middleware layer; prefer
@cloudbase/js-sdk → database (see ../minimal-web-baas-demo/SKILL.md)
- When cloud functions are truly required, keep the count minimal and scope each function to secrets, elevated privilege, or background work
Data Models
Get Data Model Operation Object:
- Mini Program: Need
@cloudbase/wx-cloud-client-sdk, initialize const client = initHTTPOverCallFunction(wx.cloud), use client.models
- Cloud Function: Need
@cloudbase/node-sdk@3.10+, initialize const app = cloudbase.init({env}), use app.models
- Web: Need
@cloudbase/js-sdk, initialize const app = cloudbase.init({env}), after login use app.models
Data Model Query:
- Can call MCP
manageDataModel tool to:
- Query model list
- Get model detailed information (including Schema fields)
- Get specific models SDK usage documentation
MySQL Data Model Invocation Rules:
- MySQL data models cannot use collection method invocation, must use data model SDK
- Wrong:
db.collection('model_name').get()
- Correct:
app.models.model_name.list({ filter: { where: {} } })
- Use
manageDataModel tool's docs method to get specific SDK usage
Console Management
After creating/deploying resources, provide corresponding console management page links. All console URLs follow the pattern: https://tcb.cloud.tencent.com/dev?envId=${envId}#/{path}.
The CloudBase console is updated frequently. If a live, logged-in console shows a different hash path from this document, prefer the live console path over stale documentation and then update this skill to match.
Core Function Entry Points
Overview (概览): https://tcb.cloud.tencent.com/dev?envId=${envId}#/overview
- Main dashboard showing environment status, resource usage, and quick access to key features
- Displays overview of all CloudBase services and their status
Template Center (模板中心): https://tcb.cloud.tencent.com/dev?envId=${envId}#/cloud-template/market
- Access project templates for React, Vue, Mini Program, UniApp, and backend frameworks
- AI Builder templates for rapid application generation
- Framework templates: React, Vue, Miniapp, UniApp, Gin, Django, Flask, SpringBoot, Express, NestJS, FastAPI
Document Database (文档型数据库): https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc
- Manage NoSQL document database collections
- Collection Management:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc/collection/${collectionName}
- View, edit, and manage collection data
- Configure security rules and permissions
- Data Model Management:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc/model/${modelName}
- Create and manage data models with relationships
- View model schema and field definitions
MySQL Database (MySQL 数据库): https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/mysql
- Manage MySQL relational database
- Table Management:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/mysql/table/default/
- Create, modify, and manage database tables
- Execute SQL queries and manage table structure
- Important: Must enable MySQL database in console before use
Cloud Functions (云函数): https://tcb.cloud.tencent.com/dev?envId=${envId}#/scf
- Manage and deploy Node.js cloud functions
- Function List:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/scf
- Function Detail:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/scf/detail?id=${functionName}&NameSpace=${envId}
- View function code, logs, and configuration
- Manage function triggers and environment variables
- Monitor function invocations and performance
CloudRun (云托管): https://tcb.cloud.tencent.com/dev?envId=${envId}#/platform-run
- Manage containerized backend services
- Deploy services using Function mode or Container mode
- Configure service scaling, access types, and environment variables
- View service logs and monitoring data
Cloud Storage (云存储): https://tcb.cloud.tencent.com/dev?envId=${envId}#/storage
- Manage file storage buckets
- Upload, download, and organize files
- Configure storage permissions and access policies
- Generate temporary access URLs for private files
AI+: https://tcb.cloud.tencent.com/dev?envId=${envId}#/ai
- Access AI capabilities and services
- AI Builder for generating templates and code
- AI image recognition and other AI features
Static Website Hosting (静态网站托管): https://tcb.cloud.tencent.com/dev?envId=${envId}#/static-hosting
- Deploy and manage static websites
- Alternative URL:
https://console.cloud.tencent.com/tcb/hosting
- Configure custom domains and CDN settings
- View deployment history and access logs
Identity Authentication (身份认证): https://tcb.cloud.tencent.com/dev?envId=${envId}#/identity
- Configure authentication methods and user management
- Login Management:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/identity/login-manage
- Enable/disable login methods (SMS, Email, Username/Password, WeChat, Custom Login)
- Configure SMS/Email templates
- Manage security domain whitelist
- Token Management:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/identity/token-management
- Manage API Keys and Publishable Keys
- View and manage access tokens
Weida Low-Code (微搭低代码): https://tcb.cloud.tencent.com/dev?envId=${envId}#/lowcode/apps
- Access Weida low-code development platform
- Build applications using visual drag-and-drop interface
Logs & Monitoring (日志监控): https://tcb.cloud.tencent.com/dev?envId=${envId}#/devops/log
- View logs from cloud functions, CloudRun services, and other resources
- Monitor resource usage, performance metrics, and error rates
- Set up alerts and notifications
Environment Settings (环境配置): https://tcb.cloud.tencent.com/dev?envId=${envId}#/env/http-access
- Configure environment-level settings
- Manage security domains and CORS settings
- Configure environment variables and secrets
- View environment information and resource quotas
URL Construction Guidelines
- Base URL Pattern:
https://tcb.cloud.tencent.com/dev?envId=${envId}#/{path}
- Replace Variables: Always replace
${envId} with the actual environment ID queried via envQuery tool
- Alias Handling: If the conversation only contains an alias or shorthand, first resolve it with
envQuery(action="list", alias=..., aliasExact=true) and use the returned EnvId; if the alias is ambiguous or missing, ask the user to confirm before generating links
- Resource-Specific URLs: For specific resources (collections, functions, models), replace resource name variables with actual values
- Usage: After creating/deploying resources, provide these console links to users for management operations
Quick Reference
When directing users to console pages:
- Use the full URL with environment ID
- Explain what they can do on each page
- Provide context about why they need to access that specific page
- For configuration pages (like login management), guide users through the setup process
Reference index
All packaged reference files (required for skill lint reachability):
- protocols/change-safety-protocol.md
- protocols/deployment-gate.md
- protocols/sensitive-runtime-data-protection.md
1---
2name: cloudbase-platform
3description: CloudBase platform overview and routing guide. This skill should be used when users need high-level capability selection, platform concepts, console navigation, or cross-platform best practices before choosing a more specific implementation skill.
4version: 2.32.5
5alwaysApply: false
6metadata:
7 source: https://skillmd.com/skills/ahang1598/cloudbase-platform
8---
9
10## Sibling skills (local only)
11
12Sibling CloudBase skills ship beside this skill. Use local relative paths such as `../auth-tool-cloudbase/SKILL.md`.
13
14If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do **not** HTTP-fetch remote skill or protocol markdown into the agent context.
15
16**Cross-cutting protocols** (required before code changes or deployments):
17- Change Safety Protocol: `references/protocols/change-safety-protocol.md`
18- Deployment Gate: `references/protocols/deployment-gate.md`
19- Sensitive Runtime Data Protection: `references/protocols/sensitive-runtime-data-protection.md`
20
21## Activation Contract
22
23### Use this first when
24
25- The user asks which CloudBase capability, service, or tool to use, or needs a high-level understanding of hosting, storage, authentication, cloud functions, or database options.
26- The task is about console navigation, cross-platform differences, permission models, or platform-level best practices before implementation.
27
28### Read before writing code if
29
30- It is still unclear whether the task belongs to Web, mini program, cloud functions, storage, MySQL / NoSQL, or auth.
31- The response needs platform selection, conceptual explanation, or control-plane navigation more than direct implementation steps.
32
33### Then also read
34
35- Minimal Web + database demo (BaaS-first, no cloud functions by default) -> `../minimal-web-baas-demo/SKILL.md`
36 - **Stack order for 最小前后端 / Lovable-like demos:** Web SDK CRUD > MCP schema > template warmup during credential wait > cloud functions (default count = 0). Capability sniff: connector ready → `envQuery` → lock one DB plane → MCP schema → `@cloudbase/js-sdk` CRUD → preview.
37- Web app implementation -> `../web-development/SKILL.md`
38- Web auth and provider setup -> `../auth-tool-cloudbase/SKILL.md`, `../auth-web-cloudbase/SKILL.md`
39- Mini program development -> `../miniprogram-development/SKILL.md`
40- WeChat Pay, Official Account OAuth, JSAPI Pay, or Native QR-code Pay through CloudBase Integration Center -> `../cloudbase-wechat-integration/SKILL.md` (official docs: `https://docs.cloudbase.net/integration/introduce/index.md`)
41- Cloud functions -> `../cloud-functions/SKILL.md`
42- Official HTTP API clients -> `../http-api-cloudbase/SKILL.md`
43- Document database -> `../cloudbase-document-database-web-sdk/SKILL.md` or `../cloudbase-document-database-in-wechat-miniprogram/SKILL.md`
44- CloudBase PostgreSQL / PG -> `../postgresql-development-cloudbase/SKILL.md`
45- MySQL relational database / data modeling -> `../relational-database-mcp-cloudbase/SKILL.md` or `../data-model-creation/SKILL.md`
46- Cloud storage -> `../cloud-storage-web/SKILL.md`
47
48### Do NOT use for
49
50- Direct implementation of web pages, auth flows, functions, or database operations when a more specific skill already fits.
51- Low-level API parameter references or SDK recipes that belong in specialized skills.
52
53### Common mistakes / gotchas
54
55- Treating this general skill as the default entry point for all CloudBase development.
56- Staying here after the correct implementation skill is already clear.
57- Mixing platform overview with platform-specific API shapes or SDK details.
58- Using this overview skill as a detour in an existing application where the active auth, storage, and data files are already obvious.
59- Making code or configuration changes without first following the Change Safety Protocol (`cloudbase-platform/references/protocols/change-safety-protocol.md`).
60- Starting any deployment, publish, custom domain, or CloudRun work without first completing the checks in `cloudbase-platform/references/protocols/deployment-gate.md`.
61- Echoing `x-cloudbase-context`, full `req.headers`, or `process.env` from Cloud Functions / CloudRun (including httpbin-style debug images) — follow `references/protocols/sensitive-runtime-data-protection.md`.
62- **Confusing security domains with custom domains**: These are two completely different tools for different purposes:
63 - `envDomainManagement` (action: create/delete) = Security domains (安全域名) for CORS/request source validation - used for browser upload whitelisting. Does NOT accept certificateId.
64 - `manageGateway(action="bindCustomDomain")` = Bind a **new** custom domain (自定义域名) for public HTTPS — requires `domain` + `certificateId`. If `queryGateway(action="listCustomDomains")` already returns a usable custom domain, prefer `manageGateway(action="createRoute", domain="<existing-domain>")` instead; routing does **not** need certificateId.
65
66## When to use this skill
67
68Use this skill for **CloudBase platform knowledge** when you need to:
69
70- Understand CloudBase storage and hosting concepts
71- Compare platform capabilities before implementation
72- Understand cross-platform auth differences (Web vs Mini Program)
73- Understand database permissions and access control
74- Access CloudBase console management pages
75
76**This skill provides foundational knowledge** that applies to all CloudBase projects, regardless of whether they are Web, Mini Program, or backend services.
77
78---
79
80## How to use this skill (for a coding agent)
81
821. **Understand platform differences**
83 - Web and Mini Program have completely different authentication approaches
84 - Must strictly distinguish between platforms
85 - Never mix authentication methods across platforms
86 - If the workspace is already an application with TODOs or prebuilt handlers, do not stay in platform overview mode. Move quickly to the concrete implementation skill and the existing files that own the flow.
87
882. **Follow best practices**
89 - Use SDK built-in authentication features (Web)
90 - Understand natural login-free feature (Mini Program)
91 - Configure appropriate database permissions
92 - Prefer `@cloudbase/js-sdk` direct DB access for browser CRUD; use cloud functions only for secrets, scheduled/background jobs, or elevated cross-collection logic that security rules / RLS cannot express (see `../minimal-web-baas-demo/SKILL.md` for the demo default)
93
943. **Use correct SDKs and APIs**
95 - Different platforms require different SDKs for data models
96 - MySQL data models must use models SDK, not collection API
97 - PostgreSQL / CloudBase PG work must route to `postgresql-development-cloudbase`; do not reuse NoSQL `app.database()` / `db.collection(...)` snippets or MySQL `queryMysqlDatabase` / `manageMysqlDatabase` for PG data paths
98 - Use `envQuery` tool to get environment ID
99 - In an existing Web application with fixed structure, inspect the existing `src/lib/backend.*`, `src/lib/auth.*`, `src/lib/*service.*`, and bound page handlers before broad concept reading.
100
1014. **Use the canonical CloudBase MCP setup from the main `cloudbase` guideline**
102 - This platform overview intentionally does **not** duplicate the full MCP / mcporter config block
103 - For the canonical config snippet, CLI commands, and auth examples, read the main `cloudbase` guideline first
104 - Keep the same core rules here: prefer MCP when tools are available in this session; if not, configure MCP for next session and use `tcb` CLI now (`../cloudbase-cli/SKILL.md`, `../cloudbase/references/tooling-fallback.md`). Inspect tool schemas before MCP execution. Do not hard-code Secret ID / Secret Key / Env ID in config
105 - Keep the auth split explicit: management-side login uses `auth`, while application-side auth configuration uses `queryAppAuth` / `manageAppAuth`
106
107---
108
109# CloudBase Platform Knowledge
110
111### Domain Management Tools: Clear Distinction
112
113When working with domain-related tasks, use the correct tool based on the requirement:
114
115| Requirement | Tool | Parameters | Purpose |
116|-------------|------|------------|---------|
117| **Security Domain (安全域名)** | `envDomainManagement` | `action`, `domains` (array of host:port strings) | CORS/request source validation for browser uploads. No certificate involved. |
118| **Reuse existing Custom Domain** | `queryGateway(listCustomDomains)` → `manageGateway(createRoute)` | `domain` = existing custom domain; route fields | Expose a service/path on an already-bound custom domain. **No certificateId.** Prefer this when a custom domain already exists. |
119| **Bind new Custom Domain (自定义域名)** | `manageGateway(action="bindCustomDomain")` | `domain` (string), `certificateId` (string) | First-time bind of a new public HTTPS domain. Requires certId from SSL console. |
120| **Delete Custom Domain** | `manageGateway(action="deleteCustomDomain")` | `domain` (string) | Remove custom domain binding (only after routes on that domain are deleted). |
121| **Disable / enable gateway route** | `manageGateway(action="disableRoute" \| "enableRoute")` | `path` (required), prefer explicit `domain` | Toggle `Routes[].Enable` via `ModifyHTTPServiceRoute` (not `ModifyGatewayRoute`). |
122| **Disable static hosting default domain** | `queryGateway(listRoutes)` → `manageGateway(disableRoute)` | `domain` = `*.tcloudbaseapp.com` (`DomainType=STATIC_STORE`, `IsDefault=true`), usually `path="/"` | Turns off public access on the shared hosting CDN default host. **Do not use `manageHosting`.** |
123
124**Key indicators for choosing the right tool:**
125- Task mentions "自定义域名访问" but env already has a custom domain → `listCustomDomains` then `createRoute(domain=...)` (no certificateId)
126- Task mentions "certificate ID" or "SSL" **and** needs to bind a **new** domain → `manageGateway(action="bindCustomDomain")`
127- Task mentions "浏览器上传" or "CORS" or "安全域名" → Use `envDomainManagement`
128- Task mentions "public access" or "HTTPS" with domain → Prefer reuse via `createRoute` when possible; only `bindCustomDomain` for first-time domain bind
129- Task mentions "关闭/禁用静态托管默认域名" / `*.tcloudbaseapp.com` → `queryGateway(listRoutes)` then `manageGateway(disableRoute)` with that STATIC_STORE domain; never invent `ModifyGatewayRoute`
130
131### Recording Operation Results
132
133When a task explicitly requires recording operation steps or results to a file (e.g., `RESULT.json`):
134
1351. Perform the tool calls first to get actual results
1362. Collect all operation steps with their success/failure status
1373. Write the complete record to the specified file in the required format
1384. Include both successful operations and failed attempts with error messages
139
140Example structure for operation recording:
141```json
142{
143 "steps": [
144 {"action": "listDomains", "success": true, "message": "Found 3 domains"},
145 {"action": "bindDomain", "success": false, "message": "Certificate not found"}
146 ],
147 "summary": {
148 "totalAttempted": 2,
149 "succeeded": 1,
150 "failed": 1
151 }
152}
153```
154
155## Storage and Hosting
156
1571. **Static Hosting vs Cloud Storage**:
158 - CloudBase static hosting and cloud storage are two different buckets
159 - Generally, publicly accessible files can be stored in static hosting, which provides a public web address
160 - Static hosting supports custom domain configuration (requires console operation)
161 - Cloud storage is suitable for files with privacy requirements, can get temporary access addresses via temporary file URLs
162 - If the task needs COS SDK polling, file metadata lookup, or temporary URLs for an uploaded object, use cloud storage tools (`manageStorage` / `queryStorage`), not `manageHosting(action="upload")`
163
1642. **Static Hosting Domain**:
165 - CloudBase static hosting domain and website document config can be obtained via `queryHosting(action="websiteConfig")`
166 - Combine with static hosting file paths to construct final access addresses
167 - Default shared host looks like `<envId>-<appId>.tcloudbaseapp.com` (`DomainType=STATIC_STORE`, often `IsDefault=true` in `queryGateway(listRoutes)`)
168 - To **disable** that default public host: `manageGateway(action="disableRoute", domain="<that-host>", path="/")` (or `updateRoute` with `enable=false`). Re-enable with `enableRoute`. Do **not** look for a `manageHosting` disable-default-domain action; do **not** call non-existent `ModifyGatewayRoute` — the API is `ModifyHTTPServiceRoute`
169 - **Important**: If access address is a directory, it must end with `/`
170
1713. **Cloud Storage Public URL**:
172 - **CRITICAL**: `manageStorage(action=upload)` and `queryStorage(action=url)` return `temporaryUrl` which is a temporary signed URL that expires (default 1 hour). Do NOT use this as a permanent public URL.
173 - To get the permanent public access URL for a cloud storage object:
174 1. Call `envQuery(action=info)` to get environment details
175 2. Extract the storage CDN domain from `EnvInfo.Storages[0].CdnDomain` (e.g., `your-env-id.tcb.qcloud.la`)
176 3. Construct the public URL: `https://{CdnDomain}/{cloudPath}`
177 - Example: If `CdnDomain` is `env-xxx.tcb.qcloud.la` and `cloudPath` is `uploads/avatar.jpg`, the public URL is `https://env-xxx.tcb.qcloud.la/uploads/avatar.jpg`
178 - Note: The public URL is accessible only if the storage bucket ACL allows public read (default is `PRIVATE` which requires signed URLs)
179
180## Environment and Authentication
181
1821. **SDK Initialization**:
183 - CloudBase SDK initialization requires environment ID
184 - Can query environment ID via `envQuery` tool
185 - If the user only provides an environment alias, nickname, or other short form, resolve it with `envQuery(action="list", alias=..., aliasExact=true)` first and use the returned full `EnvId`
186 - Do not pass alias-like short forms directly into SDK init, `auth.set_env`, console URLs, or generated config files
187 - For Web, always initialize synchronously:
188 - `import cloudbase from "@cloudbase/js-sdk"; const app = cloudbase.init({ env: "your-full-env-id" });`
189 - Do **not** use dynamic imports like `import("@cloudbase/js-sdk")` or async wrappers such as `initCloudBase()` with internal `initPromise`
190 - Then proceed with login using a verified method (username/password, phone, email, or WeChat)
191
1922. **Environment Management (via manageEnv)**:
193 The `manageEnv` tool provides full lifecycle management for CloudBase environments.
194
195 | Action | Description | Key Parameters |
196 |--------|-------------|----------------|
197 | `listPackages` | Query available plans | (none) |
198 | `create` | Create new environment (needs confirm) | `alias`, `packageId`, `resources`, `duration` |
199 | `modifyPlan` | Change plan (upgrade/downgrade, needs confirm) | `envId`, `packageId` |
200 | `renew` | Renew environment (needs confirm) | `envId`, `duration` |
201
202 **Creating an environment with specific resources:**
203 ```
204 manageEnv(action="create", alias="my-env", packageId="baas_personal",
205 resources=["flexdb","storage","function","postgresql"], confirm="yes")
206 ```
207
208 - **`resources`** (optional, create only): controls which CloudBase capabilities to enable:
209 - `flexdb` — Document database (NoSQL)
210 - `storage` — Cloud Storage
211 - `function` — Cloud Functions
212 - `postgresql` — PostgreSQL relational database (PG mode)
213 - Defaults to all four when omitted. MCP always sends non-empty `Resources` to CreateEnv.
214 - Do **not** pass `region`: CreateEnv does not accept Region; environment region is determined by account/package.
215 - ⚠️ **All paid operations** (create / modifyPlan / renew) require `confirm="yes"`.
216
217 **Querying available packages before creating:**
218 ```
219 manageEnv(action="listPackages")
220 ```
221
222 **Changing plan (e.g. personal → standard):**
223 ```
224 manageEnv(action="modifyPlan", envId="your-env-id", packageId="baas_pf_standard", confirm="yes")
225 ```
226
227 **Renewing an environment:**
228 ```
229 manageEnv(action="renew", envId="your-env-id", duration=1, confirm="yes")
230 ```
231
232## Authentication Best Practices
233
234**Important: Authentication methods for different platforms are completely different, must strictly distinguish!**
235
236### Web Authentication
237- **Must use SDK built-in authentication**: CloudBase Web SDK provides complete authentication features
238- **Recommended method**: SMS login with `auth.getVerification()`, for detailed, refer to web auth related docs
239- **Forbidden behavior**: Do not use cloud functions to implement login authentication logic
240- **Session management**: For route guards and login proof, use `auth.getSession()` and require `data.session`; do not use deprecated `getLoginState()` or `auth.getUser()` / `auth.getCurrentUser()` as proof of real login.
241- **Provider and login-method setup**: Use `queryAppAuth` / `manageAppAuth`, not the MCP `auth` tool
242- **Anonymous login is disabled by default.** Publishable `accessKey` alone does **not** create a gateway-authenticated anonymous session. With `@cloudbase/js-sdk` **3.x**, call `await auth.signInAnonymously()` (or an equivalent authenticated session) **before** NoSQL `app.database()` CRUD, or the gateway returns **401**. If the app uses AuthGuard or RLS for access control, ensure `is_anonymous` checks are in place when anonymous access is allowed.
243- **⚠️ PG RLS: Use `auth.uid()`, NOT `current_user`.** When writing RLS policies for CloudBase PostgreSQL, the user identity must use `auth.uid()` (returns the JWT `sub` / actual user ID as **`text`**, not `uuid` — unlike Supabase). Prefer owner columns as `varchar(64)` / `text`; if the column is `uuid`, cast with `auth.uid()::uuid` or you get `operator does not exist: uuid = text`. Do NOT use `current_user` or `current_setting(...)` — these PostgreSQL built-in functions return the database role name (e.g. `authenticated`), not the CloudBase auth user ID. CloudBase PG provides four auth helper functions: `auth.uid()`, `auth.role()`, `auth.email()`, `auth.jwt()`. Verify availability with `SELECT proname FROM pg_proc WHERE pronamespace = 'auth'::regnamespace`.
244
245### Mini Program Authentication
246- **Login-free feature**: Mini program CloudBase is naturally login-free, no login flow needed
247- **User identifier**: In cloud functions, get `wxContext.OPENID` via wx-server-sdk
248- **User management**: Manage user data in cloud functions based on openid
249- **Forbidden behavior**: Do not generate login pages or login flow code
250
251## Cloud Functions
252
2531. **Node.js Cloud Functions**:
254 - Node.js cloud functions need to include `package.json`, declaring required dependencies
255 - Can use `manageFunctions(action="createFunction")` to create functions
256 - Use `manageFunctions(action="updateFunctionCode")` to deploy cloud functions
257 - Prioritize cloud dependency installation, do not upload node_modules
258 - `functionRootPath` refers to the parent directory of function directories, e.g., `cloudfunctions` directory
259
260## Database Permissions
261
262**⚠️ CRITICAL: Always configure permissions BEFORE writing database operation code!**
263
2641. **Permission Model**:
265 - CloudBase database access has permissions
266 - Default basic permissions include:
267 - **READONLY**: Everyone can read, only creator/admin can write
268 - **PRIVATE**: Only creator/admin can read/write
269 - **ADMINWRITE**: Everyone can read, **only admin can write** (⚠️ NOT for Web SDK write!)
270 - **ADMINONLY**: Only admin can read/write
271 - **CUSTOM**: Fine-grained control with custom rules
272
2732. **Platform Compatibility** (CRITICAL):
274 - ⚠️ **Web SDK cannot use `ADMINWRITE` or `ADMINONLY` for write operations**
275 - ✅ For user-generated content in Web apps, use **CUSTOM** rules
276 - ✅ For admin-managed data (products, settings), use **READONLY**
277 - ✅ Cloud functions have full access regardless of permission type
278
2793. **Configuration Workflow**:
280 ```
281 Create collection → Configure security rules → Write code → Test
282 ```
283 - Use `managePermissions(action="updateResourcePermission")` to configure resource permissions
284 - If permissions were just changed, retry after a few seconds (typically within ~30s). Do not blind-wait 2-5 minutes. If it still fails, re-check the actual rule shape and active client write pattern first — most failures are misconfigured rules, not cache.
285 - See `no-sql-web-sdk/security-rules.md` for detailed `resourceType="noSqlDatabase"` examples only; do not treat `doc._openid`, `auth.openid`, query-subset validation, or `create` / `update` / `delete` JSON templates as generic rules for functions, storage, or SQL tables
286 - Official references:
287 - General security rules overview: `https://cloud.tencent.com/document/product/876/41802`
288 - NoSQL database security rules: `https://docs.cloudbase.net/database/security-rules`
289 - Cloud function security rules: `https://docs.cloudbase.net/cloud-function/security-rules`
290 - Storage security rules: `https://docs.cloudbase.net/storage/security-rules`
291
292Compatibility note:
293- Canonical plugin name: `permissions`
294- Legacy plugin aliases `security-rule`, `security-rules`, `secret-rule`, `secret-rules`, and `access-control` still resolve to the `permissions` plugin
295- Legacy tools `readSecurityRule` / `writeSecurityRule` are removed; prefer `queryPermissions` / `managePermissions`
296
2974. **Common Scenarios**:
298 - **E-commerce products**: `READONLY` (admin manages via cloud functions)
299 - **Shopping carts**: `CUSTOM` with `auth.uid` check (users manage their own)
300 - **Orders**: `CUSTOM` with ownership validation
301 - **System logs**: `PRIVATE` or `ADMINONLY`
302
3035. **Cross-Collection Operations**:
304 - Prefer security rules / RLS and client SDK when the permission model allows it
305 - Use cloud functions when the operation needs elevated privileges, server secrets, or multi-collection logic that rules cannot express
306 - For minimal Web demos (Todo / Notes / Kanban / 最小前后端), do **not** introduce cloud functions for CRUD — follow `../minimal-web-baas-demo/SKILL.md`
307
308## Role Management (MCP)
309
310CloudBase MCP provides role management capabilities through the `queryPermissions` and `managePermissions` tools. These are equivalent to the CLI `tcb role` commands.
311
312**⚠️ CRITICAL: Role policies and resource permissions are two independent systems with NO automatic synchronization.**
313
314- Resource permissions (security rules) control access to specific resources (tables, collections, functions, storage)
315- Roles (identity dimension) control policy bundles and member assignments
316
317### Available Actions
318
319**Query Operations** (via `queryPermissions`):
320| Action | Description |
321|--------|-------------|
322| `listRoles` | List all roles (system and custom) |
323| `getRole` | Get detailed role information by roleId/roleIdentity/roleName |
324
325**Management Operations** (via `managePermissions`):
326| Action | Description |
327|--------|-------------|
328| `createRole` | Create a new custom role |
329| `updateRole` | Update an existing role (add/remove policies or members) |
330| `deleteRoles` | Delete one or more custom roles |
331| `addRoleMembers` | Add members to a role |
332| `removeRoleMembers` | Remove members from a role |
333| `addRolePolicies` | Add policies to a role |
334| `removeRolePolicies` | Remove policies from a role |
335
336### Usage Examples
337
338**List all roles:**
339```
340queryPermissions(action="listRoles")
341```
342
343**Get specific role details:**
344```
345queryPermissions(action="getRole", roleId="role-xxx")
346# or by identity
347queryPermissions(action="getRole", roleIdentity="dev_role")
348# or by name
349queryPermissions(action="getRole", roleName="Developer")
350```
351
352**Delete a custom role:**
353```
354managePermissions(action="deleteRoles", roleIds=["role-xxx"])
355```
356
357**Create a custom role:**
358```
359managePermissions(action="createRole", roleName="Developer", roleIdentity="developer", policies=["FunctionsAccess"], memberUids=["user-uid-1"])
360```
361
362**Update a role (add policies):**
363```
364managePermissions(action="updateRole", roleId="role-xxx", addPolicies=["StoragesAccess"])
365```
366
367> ⚠️ Note: Only custom roles can be deleted. System roles are read-only.
368
369See also: CLI equivalent commands in `cloudbase-cli/references/permission.md`
370
3713. **Cloud Function Optimization**:
372 - Browser CRUD should not default to a cloud-function middleware layer; prefer `@cloudbase/js-sdk` → database (see `../minimal-web-baas-demo/SKILL.md`)
373 - When cloud functions are truly required, keep the count minimal and scope each function to secrets, elevated privilege, or background work
374
375## Data Models
376
3771. **Get Data Model Operation Object**:
378 - **Mini Program**: Need `@cloudbase/wx-cloud-client-sdk`, initialize `const client = initHTTPOverCallFunction(wx.cloud)`, use `client.models`
379 - **Cloud Function**: Need `@cloudbase/node-sdk@3.10+`, initialize `const app = cloudbase.init({env})`, use `app.models`
380 - **Web**: Need `@cloudbase/js-sdk`, initialize `const app = cloudbase.init({env})`, after login use `app.models`
381
3822. **Data Model Query**:
383 - Can call MCP `manageDataModel` tool to:
384 - Query model list
385 - Get model detailed information (including Schema fields)
386 - Get specific models SDK usage documentation
387
3883. **MySQL Data Model Invocation Rules**:
389 - MySQL data models cannot use collection method invocation, must use data model SDK
390 - **Wrong**: `db.collection('model_name').get()`
391 - **Correct**: `app.models.model_name.list({ filter: { where: {} } })`
392 - Use `manageDataModel` tool's `docs` method to get specific SDK usage
393
394## Console Management
395
396After creating/deploying resources, provide corresponding console management page links. All console URLs follow the pattern: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/{path}`.
397
398The CloudBase console is updated frequently. If a live, logged-in console shows a different hash path from this document, prefer the live console path over stale documentation and then update this skill to match.
399
400### Core Function Entry Points
401
4021. **Overview (概览)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/overview`
403 - Main dashboard showing environment status, resource usage, and quick access to key features
404 - Displays overview of all CloudBase services and their status
405
4062. **Template Center (模板中心)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/cloud-template/market`
407 - Access project templates for React, Vue, Mini Program, UniApp, and backend frameworks
408 - AI Builder templates for rapid application generation
409 - Framework templates: React, Vue, Miniapp, UniApp, Gin, Django, Flask, SpringBoot, Express, NestJS, FastAPI
410
4113. **Document Database (文档型数据库)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc`
412 - Manage NoSQL document database collections
413 - **Collection Management**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc/collection/${collectionName}`
414 - View, edit, and manage collection data
415 - Configure security rules and permissions
416 - **Data Model Management**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc/model/${modelName}`
417 - Create and manage data models with relationships
418 - View model schema and field definitions
419
4204. **MySQL Database (MySQL 数据库)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/mysql`
421 - Manage MySQL relational database
422 - **Table Management**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/mysql/table/default/`
423 - Create, modify, and manage database tables
424 - Execute SQL queries and manage table structure
425 - **Important**: Must enable MySQL database in console before use
426
4275. **Cloud Functions (云函数)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/scf`
428 - Manage and deploy Node.js cloud functions
429 - **Function List**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/scf`
430 - **Function Detail**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/scf/detail?id=${functionName}&NameSpace=${envId}`
431 - View function code, logs, and configuration
432 - Manage function triggers and environment variables
433 - Monitor function invocations and performance
434
4356. **CloudRun (云托管)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/platform-run`
436 - Manage containerized backend services
437 - Deploy services using Function mode or Container mode
438 - Configure service scaling, access types, and environment variables
439 - View service logs and monitoring data
440
4417. **Cloud Storage (云存储)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/storage`
442 - Manage file storage buckets
443 - Upload, download, and organize files
444 - Configure storage permissions and access policies
445 - Generate temporary access URLs for private files
446
4478. **AI+**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/ai`
448 - Access AI capabilities and services
449 - AI Builder for generating templates and code
450 - AI image recognition and other AI features
451
4529. **Static Website Hosting (静态网站托管)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/static-hosting`
453 - Deploy and manage static websites
454 - Alternative URL: `https://console.cloud.tencent.com/tcb/hosting`
455 - Configure custom domains and CDN settings
456 - View deployment history and access logs
457
45810. **Identity Authentication (身份认证)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/identity`
459 - Configure authentication methods and user management
460 - **Login Management**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/identity/login-manage`
461 - Enable/disable login methods (SMS, Email, Username/Password, WeChat, Custom Login)
462 - Configure SMS/Email templates
463 - Manage security domain whitelist
464 - **Token Management**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/identity/token-management`
465 - Manage API Keys and Publishable Keys
466 - View and manage access tokens
467
46811. **Weida Low-Code (微搭低代码)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/lowcode/apps`
469 - Access Weida low-code development platform
470 - Build applications using visual drag-and-drop interface
471
47212. **Logs & Monitoring (日志监控)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/devops/log`
473 - View logs from cloud functions, CloudRun services, and other resources
474 - Monitor resource usage, performance metrics, and error rates
475 - Set up alerts and notifications
476
47713. **Environment Settings (环境配置)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/env/http-access`
478 - Configure environment-level settings
479 - Manage security domains and CORS settings
480 - Configure environment variables and secrets
481 - View environment information and resource quotas
482
483### URL Construction Guidelines
484
485- **Base URL Pattern**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/{path}`
486- **Replace Variables**: Always replace `${envId}` with the actual environment ID queried via `envQuery` tool
487- **Alias Handling**: If the conversation only contains an alias or shorthand, first resolve it with `envQuery(action="list", alias=..., aliasExact=true)` and use the returned `EnvId`; if the alias is ambiguous or missing, ask the user to confirm before generating links
488- **Resource-Specific URLs**: For specific resources (collections, functions, models), replace resource name variables with actual values
489- **Usage**: After creating/deploying resources, provide these console links to users for management operations
490
491### Quick Reference
492
493When directing users to console pages:
494- Use the full URL with environment ID
495- Explain what they can do on each page
496- Provide context about why they need to access that specific page
497- For configuration pages (like login management), guide users through the setup process
498
499## Reference index
500
501All packaged reference files (required for skill lint reachability):
502
503- [protocols/change-safety-protocol.md](references/protocols/change-safety-protocol.md)
504- [protocols/deployment-gate.md](references/protocols/deployment-gate.md)
505- [protocols/sensitive-runtime-data-protection.md](references/protocols/sensitive-runtime-data-protection.md)