tencentcloudbase/cloudbase-ai-toolkit/cloudbase-document-database-in-wechat-miniprogram

Claude Code and agent skill by tencentcloudbase/cloudbase-ai-toolkit

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use CloudBase document database WeChat MiniProgram SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.

Install

npx vskill@latest install tencentcloudbase/cloudbase-ai-toolkit/cloudbase-document-database-in-wechat-miniprogram

SKILL.md

The same SKILL.md was published earlier as tencentcloudbase/cloudbase-ai-toolkit/cloudbase-document-database-in-wechat-miniprogram.

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.
  • Moving that Mini Program app's data onto CloudBase PG while keeping wx.cloud.database() is pgdoc — read ../postgresql-development-cloudbase/references/pgdoc.md before changing any SDK call. CUSTOM security rules do not apply after pgdoc takes over.
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 _openid during 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.cloud correctly 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

javascript
const db = wx.cloud.database();
const _ = db.command;

To target a specific environment:

javascript
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

  1. Keep Mini Program code Mini Program-native
  • Use wx.cloud.database().
  • Do not substitute browser SDK initialization patterns.
  1. Respect ownership fields
  • _openid is system-managed for SDK writes.
  • Never set or override _openid manually in .add(), .set(), or .update() payloads.
  1. 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.
  1. 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
javascript
const todos = db.collection("todos");
const result = await todos.where({ completed: false }).get();
Document reference
javascript
const todo = db.collection("todos").doc("todo-id");
const result = await todo.get();

Best practices

  1. Create clear collection naming conventions.
  2. Use typed wrappers or model helpers in app code where possible.
  3. Design rules around real ownership and sharing patterns.
  4. Use pagination instead of large unbounded reads.
  5. Keep admin/operations logic in backend code, not Mini Program direct access.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1,130
Repository forks
146
7-day trend score
35

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/tencentcloudbase/cloudbase-ai-toolkit/cloudbase-document-database-in-wechat-miniprogram/badge)](https://verified-skill.com/skills/tencentcloudbase/cloudbase-ai-toolkit/cloudbase-document-database-in-wechat-miniprogram)

Something wrong with this skill or its page? Tell us.