// CloudBase platform knowledge and best practices. Use this skill for general CloudBase platform understanding, including storage, hosting, authentication, cloud functions, database permissions, and data models.
| name | cloudbase-platform |
| description | CloudBase platform knowledge and best practices. Use this skill for general CloudBase platform understanding, including storage, hosting, authentication, cloud functions, database permissions, and data models. |
| alwaysApply | false |
Use this skill for CloudBase platform knowledge when you need to:
This skill provides foundational knowledge that applies to all CloudBase projects, regardless of whether they are Web, Mini Program, or backend services.
Understand platform differences
Follow best practices
Use correct SDKs and APIs
envQuery tool to get environment IDStatic Hosting vs Cloud Storage:
Static Hosting Domain:
getWebsiteConfig tool/envQuery toolimport cloudbase from "@cloudbase/js-sdk"; const app = cloudbase.init({ env: "xxxx-yyy" });import("@cloudbase/js-sdk") or async wrappers such as initCloudBase() with internal initPromiseImportant: Authentication methods for different platforms are completely different, must strictly distinguish!
auth.toDefaultLoginPage() redirect to default login pageauth.getCurrentUser()wxContext.OPENID via wx-server-sdkpackage.json, declaring required dependenciescreateFunction to create functionsupdateFunctionCode to deploy cloud functionsfunctionRootPath refers to the parent directory of function directories, e.g., cloudfunctions directory⚠️ CRITICAL: Always configure permissions BEFORE writing database operation code!
Permission Model:
Platform Compatibility (CRITICAL):
ADMINWRITE or ADMINONLY for write operationsConfiguration Workflow:
Create collection → Configure security rules → Write code → Test
writeSecurityRule MCP tool to configure permissionsno-sql-web-sdk/security-rules.md for detailed examplesCommon Scenarios:
READONLY (admin manages via cloud functions)CUSTOM with auth.uid check (users manage their own)CUSTOM with ownership validationPRIVATE or ADMINONLYCross-Collection Operations:
Cloud Function Optimization:
Get Data Model Operation Object:
@cloudbase/wx-cloud-client-sdk, initialize const client = initHTTPOverCallFunction(wx.cloud), use client.models@cloudbase/node-sdk@3.10+, initialize const app = cloudbase.init({env}), use app.models@cloudbase/js-sdk, initialize const app = cloudbase.init({env}), after login use app.modelsData Model Query:
manageDataModel tool to:
MySQL Data Model Invocation Rules:
db.collection('model_name').get()app.models.model_name.list({ filter: { where: {} } })manageDataModel tool's docs method to get specific SDK usageAfter creating/deploying resources, provide corresponding console management page links:
Static Hosting: https://console.cloud.tencent.com/tcb/hosting
Cloud Function: https://tcb.cloud.tencent.com/dev?envId=${envId}#/scf/detail?id=${functionName}&NameSpace=${envId}
Database Collection: https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc/collection/${collectionName}
Data Model: https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/doc/model/${modelName}
Usage: After creating corresponding resources, replace variables with actual values, provide to user for management operations.