Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问clear审计通过

cloudbase-document-database-web-sdkcloudbase document 数据库 WEB SDK

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

17,082

周安装

691

GitHub Stars

50

下载量

5,362
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cloudbase-document-database-web-sdk(cloudbase document 数据库 WEB SDK)
来源仓库:https://github.com/tencentcloudbase/skills
仓库路径:skills/cloudbase-document-database-web-sdk
安装命令:
npx skills add https://github.com/tencentcloudbase/skills --skill cloudbase-document-database-web-sdk
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/tencentcloudbase/skills --skill cloudbase-document-database-web-sdk

简介

CloudBase 文档数据库 Web SDK,用于查询、创建、更新和删除 Web 应用程序中的数据。

  • 支持 CRUD 操作、使用运算符(gt、gte、lt、lte、eq、neq、in、nin)的复杂查询以及用于过滤、排序和字段选择的方法链接
  • 包括通过跳过/限制进行分页、聚合管道、地理位置查询以及与 watch() 侦听器的实时数据同步
  • 在数据库操作之前需要使用环境 ID 初始化 SDK 并进行身份验证;默认最多返回 100 条记录(最多 1000 条)
  • 强调集合的类型定义、安全规则配置以及通过返回代码检查对所有数据库调用进行错误处理

SKILL.md

Standalone Install Note

If this environment only installed the current skill, start from the CloudBase main entry and use the published cloudbase/references/... paths for sibling skills.

  • CloudBase main entry: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md
  • Current skill raw source: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/no-sql-web-sdk/SKILL.md

Keep local references/... paths for files that ship with the current skill directory. When this file points to a sibling skill such as auth-tool or web-development, use the standalone fallback URL shown next to that reference.

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/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-web/SKILL.md)
  • General Web app structure -> ../web-development/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/web-development/SKILL.md)
  • Mini Program database code -> ../no-sql-wx-mp-sdk/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/no-sql-wx-mp-sdk/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.

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

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.

  1. Keep browser code browser-native

- Use app.database() and collection references. - Do not mix in MCP management flows or SQL mental models.

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

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

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

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

  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

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.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.84%
按下载量换算1,546

Cursor

20.43%
按下载量换算1,095

trae

16.88%
按下载量换算905

Codex

12.13%
按下载量换算650

codebuddy

8.1%
按下载量换算434

trae-cn

3.2%
按下载量换算172

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills