TencentCloudBase/CloudBase-AI-Toolkit/config/source/skills/cloudbase-document-database-web-sdk/SKILL.md
cloudbase-document-database-web-sdk
Use CloudBase document database Web SDK only for confirmed NoSQL collection work. Query, create, update, and delete document data; if the task mentions PostgreSQL / CloudBase PG / app.rdb(), route to postgresql-development instead.
- Source repository stars
- 1,082
- Declared platforms
- 0
- Static risk flags
- 2
- Last source update
- 2026-08-28
- Source checked
- 2026-08-28
Decision brief
What it does: where it fits
Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/TencentCloudBase/CloudBase-AI-Toolkit --skill "config/source/skills/cloudbase-document-database-web-sdk"Inspect the Agent Skill "cloudbase-document-database-web-sdk" from https://github.com/TencentCloudBase/CloudBase-AI-Toolkit/blob/43b60e5cdee1bae336a00ed3a8cc7e5b85ae5dca/config/source/skills/cloudbase-document-database-web-sdk/SKILL.md at commit 43b60e5cdee1bae336a00ed3a8cc7e5b85ae5dca. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Sibling skills (local only)
Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.
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. - 02
CloudBase Document Database Web SDK
When to write SDK code (use this skill): - The task explicitly asks to "modify code" or "use SDK" - The task asks to implement app/frontend logic - The task mentions specific SDK methods like db.collection().add(), .get(), .update() - The context shows an existing Web project wi…
A browser or Web app must read or write CloudBase document database data through @cloudbase/js-sdk.The request mentions app.database(), db.collection(), .where(), .watch(), pagination, aggregation, or geolocation queries in a Web frontend.The task is clearly browser-side, but you still need to decide between Web SDK, Mini Program SDK, or backend access. - 03
Activation Contract
When to write SDK code (use this skill): - The task explicitly asks to "modify code" or "use SDK" - The task asks to implement app/frontend logic - The task mentions specific SDK methods like db.collection().add(), .get(), .update() - The context shows an existing Web project wi…
A browser or Web app must read or write CloudBase document database data through @cloudbase/js-sdk.The request mentions app.database(), db.collection(), .where(), .watch(), pagination, aggregation, or geolocation queries in a Web frontend.The task is clearly browser-side, but you still need to decide between Web SDK, Mini Program SDK, or backend access. - 04
Use this first when
A browser or Web app must read or write CloudBase document database data through @cloudbase/js-sdk.
A browser or Web app must read or write CloudBase document database data through @cloudbase/js-sdk.The request mentions app.database(), db.collection(), .where(), .watch(), pagination, aggregation, or geolocation queries in a Web frontend.- A browser or Web app must read or write CloudBase document database data through @cloudbase/js-sdk. - The request mentions app.database(), db.collection(), .where(), .watch(), pagination, aggregation, or geolocation q… - 05
Read before writing code if
The task is clearly browser-side, but you still need to decide between Web SDK, Mini Program SDK, or backend access.
The task is clearly browser-side, but you still need to decide between Web SDK, Mini Program SDK, or backend access.The request touches login state, collection permissions, or realtime updates.- The task is clearly browser-side, but you still need to decide between Web SDK, Mini Program SDK, or backend access. - The request touches login state, collection permissions, or realtime updates.
Permission review
Static risk signals and limitations
Network access
The documentation includes network, browsing, or remote request actions.
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.Reads files
The documentation asks the agent to read local files, directories, or repositories.
Read the right companion reference file for the specific operation.Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 94/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 1,082 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- TencentCloudBase/CloudBase-AI-Toolkit
- Skill path
- config/source/skills/cloudbase-document-database-web-sdk/SKILL.md
- Commit
- 43b60e5cdee1bae336a00ed3a8cc7e5b85ae5dca
- License
- MIT
- Collected
- 2026-08-28
- Default branch
- main
View the original SKILL.md
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 Web SDK
Activation Contract
Use this first when
- A browser or Web app must read or write CloudBase document database data through
@cloudbase/js-sdk. - The request mentions
app.database(),db.collection(),.where(),.watch(), pagination, aggregation, or geolocation queries in a Web frontend.
Read before writing code if
- The task is clearly browser-side, but you still need to decide between Web SDK, Mini Program SDK, or backend access.
- The request touches login state, collection permissions, or realtime updates.
Then also read
- Web login and caller identity ->
../auth-web-cloudbase/SKILL.md - General Web app structure ->
../web-development/SKILL.md - Mini Program database code ->
../cloudbase-document-database-in-wechat-miniprogram/SKILL.md
Do NOT use for
- Mini Program code using
wx.cloud.database(). - Server-side or cloud-function database access.
- SQL / MySQL database operations.
- Pure resource-permission administration with no browser SDK code.
- NEW business tables that the task explicitly asks to put in CloudBase PostgreSQL (CloudBase PG). Before applying this skill, call
envQuery(action="info", envId=...)and readEnvInfo.RuntimeBackends. Ifpostgresql === trueAND the task asks for a new business table to live in PG, switch to thepostgresql-development-cloudbaseskill for that table: it goes throughapp.rdb(), uses PG row-level security (CREATE POLICY), and uploads viaapp.storage.from('<bucket>').upload('<key>', file)against an explicitly-created pgstore bucket.- Existing NoSQL collections in the same env keep using THIS skill — PG and NoSQL coexist in CloudBase PG environments. The rule is "follow the task / existing surface", not "PG env forbids NoSQL".
SDK Code vs MCP Tools
When to write SDK code (use this skill):
- The task explicitly asks to "modify code" or "use SDK"
- The task asks to implement app/frontend logic
- The task mentions specific SDK methods like
db.collection().add(),.get(),.update() - The context shows an existing Web project with SDK initialization (e.g.,
index.jsalready hascloudbase.init())
When to use MCP tools instead:
- The task asks to manage CloudBase resources (create collection, set permissions, etc.)
- The task involves admin/management operations without writing app code
- The task mentions tools like
writeNoSqlDatabaseContent,managePermissions, etc.
Key distinction: If the user says "使用 JS SDK 执行 XX 操作" (use JS SDK to perform XX operation) or "修改代码" (modify code), write SDK code in the project files. Do not use MCP database write tools for app-level data operations.
Common mistakes / gotchas
- Querying before the user is signed in when the collection rules require identity.
- Using
wx.cloud.database()or Node SDK patterns in browser code. - Initializing CloudBase lazily with dynamic imports instead of a shared synchronous app instance.
- Treating security rules as result filters rather than request validators.
- Expecting a
CUSTOMsecurity rule to take effect immediately after you callmanagePermissions(updateResourcePermission). The backend caches rule evaluators for 2–5 minutes; first writes after a rule change may silently fail or be rejected withDATABASE_PERMISSION_DENIEDeven when the expression is correct. Either (a) wait a few minutes and retry the same write before assuming the rule is wrong, or (b) verify the rule is live by readingresult.code/result.messageon every write and by doing aget()round-trip on the just-written_id; do not treat a resolved promise as success. Seesecurity-rules.md→ "Propagation And Verification" for the full pattern. - Misreading the return shape of
db.collection(...).add(...). In the CloudBase Web SDK, the created document ID is exposed at top-levelresult._id, notresult.id,result.data.id, orresult.insertedId. - For CMS-style collections that need app-level admin users to edit/delete all records while editors can only edit/delete their own records, do not oversimplify the rule to
READONLY. A validated pattern is aCUSTOMrule that reads role fromuser_rolesbyauth.uidand combines it withdoc.authorId == auth.uid, while frontend writes can stay on.doc(id).update()/.doc(id).remove(). - Forgetting pagination or indexes for larger collections.
Minimal checklist
- Confirm this is browser-side document database work.
- Initialize CloudBase once and reuse the same
app/dbinstance. - Verify auth expectations before CRUD.
- Read the right companion reference file for the specific operation.
Overview
This skill covers browser-side document database usage via @cloudbase/js-sdk.
Use it for:
- CRUD in a Web app
- complex queries and pagination
- aggregation
- realtime listeners with
watch() - geolocation queries
Canonical initialization
import cloudbase from "@cloudbase/js-sdk";
const app = cloudbase.init({
env: "your-env-id"
});
const db = app.database();
const _ = db.command;
Important rules:
- Sign in before querying if the collection rules require identity.
- Keep a single shared app/database instance.
- Do not hide initialization inside ad-hoc async loaders unless the framework truly requires it.
Quick routing
- CRUD ->
./crud-operations.md - Complex queries ->
./complex-queries.md - Pagination ->
./pagination.md - Aggregation ->
./aggregation.md - Realtime listeners ->
./realtime.md - Geolocation ->
./geolocation.md - Security rules ->
./security-rules.md
Working rules for a coding agent
-
Start from the auth model
- If the page relies on logged-in user identity, read the Web auth skill before writing database code.
-
Keep browser code browser-native
- Use
app.database()and collection references. - Do not mix in MCP management flows or SQL mental models.
- Use
-
Respect security rules
- Collection rules can reject requests before data is read.
- If the requirement is simple owner-only write access,
READONLYcan be enough. - If the requirement is “app-level admin can edit/delete all, editor only own”, use a
CUSTOMrule. A validated CMS pattern isget('database.user_roles.' + auth.uid).role == 'admin' || doc.authorId == auth.uid. - For that CMS pattern, frontend writes can stay on
.doc(id).update()/.doc(id).remove(). - Reuse whichever role collection already exists and can be addressed by
_id == auth.uid. In this CMS pattern,user_roleskeyed by uid is acceptable. - If the task fails with permission issues, inspect the rule model rather than assuming the query syntax is wrong.
-
Return user-friendly errors
- Database errors must become readable UI or application errors, not silent failures.
- For writes, do not treat a resolved promise as success by default. Check write result fields such as
updated/deletedor surfacedcode/message.
-
Persist IDs from create operations correctly
- For Web SDK
.add(...), the newly created document ID isresult._id. - Do not look for the ID under
result.id,result.data, or other driver-specific fields.
- For Web SDK
Quick examples
Simple query
const result = await db.collection("todos")
.where({ completed: false })
.get();
Create and capture document ID
const result = await db.collection("posts").add({
title: "New article",
content: "...",
createdAt: new Date()
});
const articleId = result._id;
Ordered pagination
const result = await db.collection("posts")
.orderBy("createdAt", "desc")
.skip(20)
.limit(10)
.get();
Field selection
const result = await db.collection("users")
.field({ name: true, email: true, _id: false })
.get();
Best practices
- Define collection-level types or model wrappers in the app code.
- Use meaningful collection naming conventions.
- Select only required fields.
- Add indexes for frequent filters or sort keys.
- Pair frontend CRUD with explicit permission design.
- Use pagination instead of unbounded reads.
Error handling
try {
const result = await db.collection("todos").get();
console.log(result.data);
} catch (error) {
console.error("Database error:", error);
}
When the SDK returns an operation result, check error indicators and translate them into readable application behavior.
Frequently asked questions
What to verify before installation and use
What does the cloudbase-document-database-web-sdk source document cover?
Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.
How do I install cloudbase-document-database-web-sdk?
The source record exposes this install command: npx skills add https://github.com/TencentCloudBase/CloudBase-AI-Toolkit --skill "config/source/skills/cloudbase-document-database-web-sdk". Inspect the command and pinned source before running it.
Which permission-related actions were detected?
Static rules flagged network, read-files in the source; the page lists the matching lines and excerpts.
Alternatives
Compare before choosing
coreyhaines31/marketingskills
ab-testing
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
garrytan/gbrain
bulk-ingestion
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
app-store-optimization
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
migrate-vstest-to-mtp
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing