
cloudbase-document-database-in-wechat-miniprogram
Use CloudBase document database WeChat MiniProgram SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.
- Installs
- 66
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/tencentcloudbase/cloudbase-ai-toolkit --skill cloudbase-document-database-in-wechat-miniprogram- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads cloudbase-document-database-in-wechat-miniprogram automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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.
CloudBase Document Database WeChat Mini Program SDK
Activation Contract
Use this first when
- A WeChat Mini Program must access CloudBase document database through
wx.cloud.database(). - The request mentions Mini Program collection CRUD, pagination, aggregation, or geolocation queries.
Read before writing code if
- The task is Mini Program database work but you still need to separate it from Web SDK, cloud functions, or SQL tasks.
- The request depends on built-in user identity,
_openid, or Mini Program-side permissions.
Then also read
- Mini Program project rules and CloudBase integration ->
../miniprogram-development/SKILL.md - Mini Program auth and identity flow ->
../auth-wechat-miniprogram/SKILL.md - Browser-side document database code ->
../cloudbase-document-database-web-sdk/SKILL.md
Do NOT use for
- Browser/Web code using
@cloudbase/js-sdk. - Server-side or cloud-function database access.
- MySQL / relational database work.
Common mistakes / gotchas
- Copying Web SDK code into Mini Program pages.
- Manually writing
_openidduring create or update operations. - Assuming built-in Mini Program identity means security rules can be ignored.
- Mixing collection CRUD and backend-wide admin workflows in the same client path.
Minimal checklist
- Confirm the caller is a Mini Program page/component or Mini Program-side logic.
- Initialize
wx.cloudcorrectly before database calls. - Verify whether the collection rules rely on
auth.openid/_openid. - Read the specific companion reference file for the operation you need.
Overview
This skill covers Mini Program-side document database access through wx.cloud.database().
Use it for:
- collection CRUD in Mini Program pages
- query composition and pagination
- aggregation
- geolocation queries
Mini Program CloudBase access comes with built-in identity, but database operations are still constrained by collection permissions and security rules.
Canonical initialization
const db = wx.cloud.database();
const _ = db.command;
To target a specific environment:
const db = wx.cloud.database({
env: "test"
});
Important notes:
- Users are authenticated through the Mini Program CloudBase context.
- In cloud functions, caller identity is available through
wxContext.OPENID. - In client-side collection rules, ownership checks usually use
auth.openid/doc._openid.
Quick routing
- CRUD ->
./crud-operations.md - Complex queries ->
./complex-queries.md - Pagination ->
./pagination.md - Aggregation ->
./aggregation.md - Geolocation ->
./geolocation.md - Security rules ->
./security-rules.md
Working rules for a coding agent
-
Keep Mini Program code Mini Program-native
- Use
wx.cloud.database(). - Do not substitute browser SDK initialization patterns.
- Use
-
Respect ownership fields
_openidis system-managed for SDK writes.- Never set or override
_openidmanually in.add(),.set(), or.update()payloads.
-
Remember that security rules validate requests
- If a rule requires ownership conditions, the query shape must match that rule model.
- Permission errors usually mean the rule/query relationship is wrong, not only that the user is logged out.
-
Route admin-style operations to backend flows
- If the task needs privileged global access, use backend tools or functions instead of exposing that path directly in Mini Program client code.
Quick examples
Basic collection access
const todos = db.collection("todos");
const result = await todos.where({ completed: false }).get();
Document reference
const todo = db.collection("todos").doc("todo-id");
const result = await todo.get();
Best practices
- Create clear collection naming conventions.
- Use typed wrappers or model helpers in app code where possible.
- Design rules around real ownership and sharing patterns.
- Use pagination instead of large unbounded reads.
- Keep admin/operations logic in backend code, not Mini Program direct access.
FAQ
What does the cloudbase-document-database-in-wechat-miniprogram skill do?
Use CloudBase document database WeChat MiniProgram SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.
How do I install cloudbase-document-database-in-wechat-miniprogram?
Run npx skills add https://github.com/tencentcloudbase/cloudbase-ai-toolkit --skill cloudbase-document-database-in-wechat-miniprogram in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/cloudbase-document-database-in-wechat-miniprogram/ (personal) or .claude/skills/cloudbase-document-database-in-wechat-miniprogram/ (project).
Which AI agents can use cloudbase-document-database-in-wechat-miniprogram?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is cloudbase-document-database-in-wechat-miniprogram safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains cloudbase-document-database-in-wechat-miniprogram?
It is published by tencentcloudbase in tencentcloudbase/cloudbase-ai-toolkit. It has 66 recorded installs.
More from tencentcloudbase/cloudbase-ai-toolkit
miniprogram-development
tencentcloudbase/cloudbase-ai-toolkit
WeChat Mini Program development skill for building, debugging, previewing, testing, publishing, and optimizing mini program projects (小程序开发、调试、预览、发布). Covers project structure and config (project.config.json, appid, miniprogramRoot, tabBar, routing/navigation, icon assets), WeChat Developer Tools Nightly workflows (wechatide CLI, WeChat IDE Skills/MCP), miniprogram-ci preview/upload, console/network debugging, message push (消息推送) and customer-service auto-reply (客服消息), mini program SEO / search indexing (小程序搜索优化、页面收录、搜索推广、mpcrawler), and CloudBase integration (wx.cloud, 腾讯云开发, 云开发) when explicitly used. Use when users create, develop, modify, debug, preview, deploy, publish, or promote WeChat Mini Programs. NOT for Web frontend (use web-development), pure backend services (use cloudrun-development / cloud-functions), or UI-design-only tasks (use ui-design).
web-development
tencentcloudbase/cloudbase-ai-toolkit
Use when users need to implement, integrate, debug, build, deploy, or validate a Web frontend after the product direction is already clear, especially for React, Vue, Vite, browser flows, or CloudBase Web integration.
cloudbase-platform
tencentcloudbase/cloudbase-ai-toolkit
CloudBase platform overview and routing guide. This skill should be used when users need high-level capability selection, platform concepts, console navigation, realtime (broadcast / presence / live database changes), or cross-platform best practices before choosing a more specific implementation skill.
auth-wechat-miniprogram
tencentcloudbase/cloudbase-ai-toolkit
Open the skill to read its SKILL.md instructions.
ai-model-wechat
tencentcloudbase/cloudbase-ai-toolkit
Open the skill to read its SKILL.md instructions.
ui-design
tencentcloudbase/cloudbase-ai-toolkit
Open the skill to read its SKILL.md instructions.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.