Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 78% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 42% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 67% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 97% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 53% | 0% |
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/js-sdk.app.database(), db.collection(), .where(), .watch(), pagination, aggregation, or geolocation queries in a Web frontend.../auth-web-cloudbase/SKILL.md../web-development/SKILL.md../cloudbase-document-database-in-wechat-miniprogram/SKILL.mdwx.cloud.database().envQuery(action="info", envId=...) and read EnvInfo.RuntimeBackends. If postgresql === true AND the task asks for a new business table to live in PG, switch to the postgresql-development-cloudbase skill for that table: it goes through app.rdb(), uses PG row-level security (CREATE POLICY), and uploads via app.storage.from('<bucket>').upload('<key>', file) against an explicitly-created pgstore bucket.When to write SDK code (use this skill):
db.collection().add(), .get(), .update()index.js already has cloudbase.init())When to use MCP tools instead:
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.
wx.cloud.database() or Node SDK patterns in browser code.CUSTOM security rule to take effect immediately after you call managePermissions(updateResourcePermission). The backend caches rule evaluators for 2–5 minutes; first writes after a rule change may silently fail or be rejected with DATABASE_PERMISSION_DENIED even 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 reading result.code / result.message on every write and by doing a get() round-trip on the just-written _id; do not treat a resolved promise as success. See security-rules.md → "Propagation And Verification" for the full pattern.db.collection(...).add(...). In the CloudBase Web SDK, the created document ID is exposed at top-level result._id, not result.id, result.data.id, or result.insertedId.READONLY. A validated pattern is a CUSTOM rule that reads role from user_roles by auth.uid and combines it with doc.authorId == auth.uid, while frontend writes can stay on .doc(id).update() / .doc(id).remove().app / db instance.This skill covers browser-side document database usage via @cloudbase/js-sdk.
Use it for:
watch()javascriptimport cloudbase from "@cloudbase/js-sdk"; const app = cloudbase.init({ env: "your-env-id" }); const db = app.database(); const _ = db.command;
Important rules:
./crud-operations.md./complex-queries.md./pagination.md./aggregation.md./realtime.md./geolocation.md./security-rules.mdapp.database() and collection references.READONLY can be enough.CUSTOM rule. A validated CMS pattern is get('database.user_roles.' + auth.uid).role == 'admin' || doc.authorId == auth.uid..doc(id).update() / .doc(id).remove()._id == auth.uid. In this CMS pattern, user_roles keyed by uid is acceptable.updated / deleted or surfaced code / message..add(...), the newly created document ID is result._id.result.id, result.data, or other driver-specific fields.javascriptconst result = await db.collection("todos") .where({ completed: false }) .get();
javascriptconst result = await db.collection("posts").add({ title: "New article", content: "...", createdAt: new Date() }); const articleId = result._id;
javascriptconst result = await db.collection("posts") .orderBy("createdAt", "desc") .skip(20) .limit(10) .get();
javascriptconst result = await db.collection("users") .field({ name: true, email: true, _id: false }) .get();
javascripttry { 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.
Other measured skills in the registry, with their headline benchmark lift.