Awesome-omni-skill cloudbase-platform
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.
git clone https://github.com/diegosouzapw/awesome-omni-skill
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/development/cloudbase-platform-sycsky" ~/.claude/skills/diegosouzapw-awesome-omni-skill-cloudbase-platform-022e6f && rm -rf "$T"
skills/development/cloudbase-platform-sycsky/SKILL.mdWhen to use this skill
Use this skill for CloudBase platform knowledge when you need to:
- Understand CloudBase storage and hosting concepts
- Configure authentication for different platforms (Web vs Mini Program)
- Deploy and manage cloud functions
- Understand database permissions and access control
- Work with data models (MySQL and NoSQL)
- 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
-
Follow best practices
- Use SDK built-in authentication features (Web)
- Understand natural login-free feature (Mini Program)
- Configure appropriate database permissions
- Use cloud functions for cross-collection operations
-
Use correct SDKs and APIs
- Different platforms require different SDKs for data models
- MySQL data models must use models SDK, not collection API
- Use
tool to get environment IDenvQuery
CloudBase Platform Knowledge
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
-
Static Hosting Domain:
- CloudBase static hosting domain can be obtained via
toolgetWebsiteConfig - Combine with static hosting file paths to construct final access addresses
- Important: If access address is a directory, it must end with
/
- CloudBase static hosting domain can be obtained via
Environment and Authentication
- SDK Initialization:
- CloudBase SDK initialization requires environment ID
- Can query environment ID via
toolenvQuery - Then proceed with login, for example using anonymous login
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:
redirect to default login pageauth.toDefaultLoginPage() - Forbidden behavior: Do not use cloud functions to implement login authentication logic
- User management: After login, get user information via
auth.getCurrentUser()
Mini Program Authentication
- Login-free feature: Mini program CloudBase is naturally login-free, no login flow needed
- User identifier: In cloud functions, get
via wx-server-sdkwxContext.OPENID - 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
, declaring required dependenciespackage.json - Can use
to create functionscreateFunction - Use
to deploy cloud functionsupdateFunctionCode - Prioritize cloud dependency installation, do not upload node_modules
refers to the parent directory of function directories, e.g.,functionRootPath
directorycloudfunctions
- Node.js cloud functions need to include
Database Permissions
-
Permission Model:
- CloudBase database access has permissions
- Default basic permissions include:
- Only creator can write, everyone can read
- Only creator can read/write
- Only admin can write, everyone can read
- Only admin can read/write
- If directly requesting database from web or mini program side, need to configure appropriate database permissions
- In cloud functions, there is no permission control by default
-
Cross-Collection Operations:
- If user has no special requirements, operations involving cross-database collections must be implemented via cloud functions
-
Cloud Function Optimization:
- If involving cloud functions, while ensuring security, can minimize the number of cloud functions as much as possible
- For example: implement one cloud function for client-side requests, implement one cloud function for data initialization
Data Models
-
Get Data Model Operation Object:
- Mini Program: Need
, initialize@cloudbase/wx-cloud-client-sdk
, useconst client = initHTTPOverCallFunction(wx.cloud)client.models - Cloud Function: Need
, initialize@cloudbase/node-sdk@3.10+
, useconst app = cloudbase.init({env})app.models - Web: Need
, initialize@cloudbase/js-sdk
, after login useconst app = cloudbase.init({env})app.models
- Mini Program: Need
-
Data Model Query:
- Can call MCP
tool to:manageDataModel- Query model list
- Get model detailed information (including Schema fields)
- Get specific models SDK usage documentation
- Can call MCP
-
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
tool'smanageDataModel
method to get specific SDK usagedocs
Console Management
After 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.