Cloudbase Document Database Web Sdk logo

Cloudbase Document Database Web Sdk

OrganizationPopular
TencentCloudBase
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.

Overview

PublisherTencentCloudBase
RepositoryCloudBase-AI-Toolkit
Skill namecloudbase-document-database-web-sdk
Stars
1.1K
Forks
141
Bundled files
7
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 7 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by TencentCloudBase on GitHub. Read the source before you install it.

Installation

Install the Cloudbase Document Database Web Sdk AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/TencentCloudBase/CloudBase-AI-Toolkit.git /tmp/CloudBase-AI-Toolkit
mkdir -p .claude/skills
cp -r /tmp/CloudBase-AI-Toolkit/config/source/skills/cloudbase-document-database-web-sdk .claude/skills/cloudbase-document-database-web-sdk
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cloudbase Document Database Web Sdk in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cloudbase Document Database Web Sdk on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cloudbase Document Database Web Sdk is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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 queryEnv(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.
    • 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.js already has cloudbase.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 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.
  • Misreading the return shape of 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.
  • 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 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().
  • 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 / db instance.
  • 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

javascript
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

  1. Start from the auth model

    • If the page relies on logged-in user identity, read the Web auth skill before writing database code.
  2. Keep browser code browser-native

    • Use app.database() and collection references.
    • Do not mix in MCP management flows or SQL mental models.
  3. Respect security rules

    • Collection rules can reject requests before data is read.
    • If the requirement is simple owner-only write access, READONLY can be enough.
    • If the requirement is “app-level admin can edit/delete all, editor only own”, use a CUSTOM rule. A validated CMS pattern is get('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_roles keyed by uid is acceptable.
    • If the task fails with permission issues, inspect the rule model rather than assuming the query syntax is wrong.
  4. 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 / deleted or surfaced code / message.
  5. Persist IDs from create operations correctly

    • For Web SDK .add(...), the newly created document ID is result._id.
    • Do not look for the ID under result.id, result.data, or other driver-specific fields.

Quick examples

Simple query

javascript
const result = await db.collection("todos")
  .where({ completed: false })
  .get();

Create and capture document ID

javascript
const result = await db.collection("posts").add({
  title: "New article",
  content: "...",
  createdAt: new Date()
});

const articleId = result._id;

Ordered pagination

javascript
const result = await db.collection("posts")
  .orderBy("createdAt", "desc")
  .skip(20)
  .limit(10)
  .get();

Field selection

javascript
const result = await db.collection("users")
  .field({ name: true, email: true, _id: false })
  .get();

Best practices

  1. Define collection-level types or model wrappers in the app code.
  2. Use meaningful collection naming conventions.
  3. Select only required fields.
  4. Add indexes for frequent filters or sort keys.
  5. Pair frontend CRUD with explicit permission design.
  6. Use pagination instead of unbounded reads.

Error handling

javascript
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.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Cloudbase Document Database Web Sdk AI skill do?

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.

Why use Cloudbase Document Database Web Sdk on TypingMind?

Because you install it once and use it with any model. Cloudbase Document Database Web Sdk is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cloudbase Document Database Web Sdk in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/TencentCloudBase/CloudBase-AI-Toolkit/tree/main/config/source/skills/cloudbase-document-database-web-sdk. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Cloudbase Document Database Web Sdk?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cloudbase Document Database Web Sdk?

As many as you like. As long as a model supports skills, you can use Cloudbase Document Database Web Sdk with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cloudbase Document Database Web Sdk AI skill free?

Yes. It is published on GitHub by TencentCloudBase under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇