cloudbase-document-database-in-wechat-miniprogram skill
✓ 検証済みwx.cloud.database SDKを使用して、WeChat Mini Program内でCRUD操作、複雑なクエリ、ページネーション、集計、およびジオロケーションクエリを実行します。
- GitHubスター
- 1,164
- ファイル
- 8
- 最終コミット
- 2026年11月11日
- ライセンス
- MIT
- 許可されたツール
- —
cloudbase-document-database-in-wechat-miniprogram skillは何をしますか
wx.cloud.database SDKを使用して、WeChat Mini Program内でCRUD操作、複雑なクエリ、ページネーション、集計、およびジオロケーションクエリを実行します。
skillのSKILL.mdから生成された要約。
cloudbase-document-database-in-wechat-miniprogram skill について
WeChat Mini Program内のデータ管理がこのSKILLの主な機能です。wx.cloud.database() SDKを通じて、ドキュメントデータベース操作を直接実行できます。エージェントは、Mini ProgramのコレクションのCRUD、ページネーション、集計、またはジオロケーションクエリに関連するタスクが発生した際に、このツールをロードする必要があります。このツールは、Mini Program環境向けに特別に設計されたクライアントサイドのコードを生成し、データベース呼び出しがネイティブフレームワークと互換性があることを保証します。
このSKILLは、Web SDKやサーバーサイドのクラウド関数ではなく、Mini Program側のSDKにのみ焦点を当てている点が特徴です。CloudBaseのコンテキストを通じて組み込みのユーザー識別を処理し、_openidのようなシステム管理フィールドを尊重します。セキュリティルールと所有権のチェックが正しく機能するように、Mini Programのページやコンポーネント内で作業する場合は、必ずこれを使用してください。MySQL、リレーショナルデータベース、またはブラウザベースの @cloudbase/js-sdk 実装を目的としたものではありません。
エージェントができること
- 1コレクションのCRUD操作の実行WeChat Mini Programのコレクション内でドキュメントを作成、読み取り、更新、または削除するためのコードを記述します。
- 2データページネーションの実装ページネーションを使用して、データベースの結果を管理しやすい小さなチャンクで取得するロジックを開発します。
- 3複雑なジオロケーションクエリの実行地理的な位置データに基づいてデータをフィルタリングまたは取得するクエリを作成します。
skill の SKILL.md から作成されています。すべてのユースケースは、その引用と照合されています。
cloudbase-document-database-in-wechat-miniprogram skillのインストール方法
各コマンドはskillフォルダをクライアントのskillsディレクトリにコピーします。読み込むには、クライアントを再起動するか新しいセッションを開始してください。Claude Codeにcloudbase-document-database-in-wechat-miniprogram skillをインストールする
~/.claude/skills/cloudbase-document-database-in-wechat-miniprogram/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-in-wechat-miniprogram ~/.claude/skills/cloudbase-document-database-in-wechat-miniprogramClaude Code (project)にcloudbase-document-database-in-wechat-miniprogram skillをインストールする
.claude/skills/cloudbase-document-database-in-wechat-miniprogram/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-in-wechat-miniprogram .claude/skills/cloudbase-document-database-in-wechat-miniprogramCodexにcloudbase-document-database-in-wechat-miniprogram skillをインストールする
~/.agents/skills/cloudbase-document-database-in-wechat-miniprogram/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-in-wechat-miniprogram ~/.agents/skills/cloudbase-document-database-in-wechat-miniprogramGemini CLIにcloudbase-document-database-in-wechat-miniprogram skillをインストールする
~/.gemini/skills/cloudbase-document-database-in-wechat-miniprogram/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-in-wechat-miniprogram ~/.gemini/skills/cloudbase-document-database-in-wechat-miniprogramClaude.aiにcloudbase-document-database-in-wechat-miniprogram skillをインストールする
npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-in-wechat-miniprogram cloudbase-document-database-in-wechat-miniprogram && zip -r cloudbase-document-database-in-wechat-miniprogram.zip cloudbase-document-database-in-wechat-miniprogram # claude.ai → Customize → Skills → + → Create skill → Upload a skill → cloudbase-document-database-in-wechat-miniprogram.zip
自動チェック
実行日 2026年11月15日完全なレポート →自動チェックに合格しました。これはセキュリティ監査ではありません。エージェントに実行させる前にスクリプトを読んでください。 チェックの仕組み · 点数を上げるための改善点
- ソースリポジトリがリンクされており、アクセス可能tencentcloudbase/cloudbase-ai-toolkit/config/.claude/skills/cloudbase-document-database-in-wechat-miniprogram is public and reachablegithub.com/tencentcloudbase/cloudbase-ai-toolkit/tree/HEAD/c ↗合格
- オープンソースライセンス (OSI)MITspdx.org/licenses/MIT.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit 2026-11-11github.com/tencentcloudbase/cloudbase-ai-toolkit/commits ↗合格
- スクリプトにダウンロード実行や認証情報の窃取がないNo scripts in the skill folder合格
- SKILL.md に隠れた指示がないNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/tencentcloudbase/cloudbase-ai-toolkit/blob/HEAD/c ↗合格
- 事前許可ツールが限定されているNo pre-approved tools; the agent asks before using onegithub.com/tencentcloudbase/cloudbase-ai-toolkit/blob/HEAD/c ↗合格
- SKILL.md が Agent Skills の形式に従っているthe description does not say when to use the skillgithub.com/tencentcloudbase/cloudbase-ai-toolkit/blob/HEAD/c ↗検出事項
SKILL.md
GitHubで表示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.mdbefore 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
_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.
このスキルのファイル
8cloudbase-document-database-in-wechat-miniprogram skillに関する質問
Claude Codeにcloudbase-document-database-in-wechat-miniprogram skillをインストールするには
npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-in-wechat-miniprogram ~/.claude/skills/cloudbase-document-database-in-wechat-miniprogramを実行してください。Claude Codeは~/.claude/skills(すべてのプロジェクト)または.claude/skills(単一プロジェクト)からskillsを読み込み、説明がタスクに一致する場合にskillを使用します。
cloudbase-document-database-in-wechat-miniprogram skillはどのクライアントで使用できますか
Agent Skills形式を読み込むすべてのクライアントで使用できます: Claude Code、Codex、Gemini CLI、claude.ai(ZIPとしてアップロード)。skill内のスクリプトは、クライアントがコード実行を許可した場合にのみ実行されます。
WeChat Mini ProgramでCloudBaseデータベースを初期化するにはどうすればよいですか?
const db = wx.cloud.database(); を使用するか、wx.cloud.database({ env: 'test' }); のように特定の環境を指定してデータベースを初期化できます。
ドキュメントの更新時に _openid フィールドを手動で設定できますか?
いいえ、_openid フィールドはシステムによって管理されているため、作成または更新操作中に手動で設定したり上書きしたりしないでください。
クエリ中に権限エラーが発生した場合はどうすればよいですか?
権限エラーは通常、ユーザーがログアウトしているのではなく、クエリの形式とコレクションのセキュリティルールとの関係が正しくないことを示しています。