cloudbase-document-database-web-sdk skill
✓ 인증됨CloudBase JS SDK를 사용하여 에이전트가 웹 애플리케이션에서 NoSQL CRUD 작업, 복잡한 쿼리 및 실시간 데이터 동기화를 수행할 수 있도록 합니다.
- GitHub 스타
- 1,164
- 파일
- 9
- 마지막 커밋
- 2026년 11월 11일
- 라이선스
- MIT
- 허용된 도구
- —
cloudbase-document-database-web-sdk skill은 무엇을 하나요?
cloudbase-document-database-web-sdk은(는) agent skill입니다. CloudBase JS SDK를 사용하여 에이전트가 웹 애플리케이션에서 NoSQL CRUD 작업, 복잡한 쿼리 및 실시간 데이터 동기화를 수행할 수 있도록 합니다.
skill의 SKILL.md에서 생성된 요약입니다.
cloudbase-document-database-web-sdk skill 정보
웹 애플리케이션을 구축하는 개발자는 이 SKILL을 사용하여 프론트엔드 코드 내에서 NoSQL 문서 데이터베이스 작업을 직접 구현할 수 있습니다. 이 SKILL은 데이터 컬렉션 관리를 위해 @cloudbase/js-sdk를 사용하여 브라우저 측 JavaScript를 작성하거나 수정하는 작업을 수행하는 에이전트를 위해 설계되었습니다. 표준 CRUD 작업, 복잡한 쿼리, 페이지네이션, 데이터 집계뿐만 아니라 watch 메서드를 통한 실시간 동기화를 지원합니다.
에이전트가 애플리케이션 로직을 구현하거나 기존 웹 프로젝트 파일을 수정하도록 요청받은 경우, 올바른 SDK 구현을 생성하기 위해 이 SKILL을 로드해야 합니다. 이 SKILL은 CloudBase JS SDK를 기반으로 하며, 보안 규칙이 준수되도록 인증 상태와 세심하게 조정해야 합니다. 이 SKILL은 브라우저 기반 환경 전용이며, 서버 측 클라우드 함수, 미니 프로그램 개발 또는 SQL 기반 PostgreSQL 작업에는 사용해서는 안 됩니다.
agent가 수행할 수 있는 작업
- 1프론트엔드 CRUD 작업 구현에이전트가 특정 컬렉션에 문서를 추가, 조회, 업데이트 또는 삭제하는 JavaScript 코드를 작성할 수 있습니다.
- 2실시간 데이터 리스너 설정개발자가 AI에게 watch 메서드를 사용하여 웹 인터페이스에 실시간 데이터 업데이트를 구현하도록 지시할 수 있습니다.
- 3페이지네이션 데이터 피드 개발에이전트가 skip 및 limit 명령을 사용하여 대규모 데이터 세트를 관리 가능한 단위로 가져오는 로직을 생성할 수 있습니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
cloudbase-document-database-web-sdk skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.Claude Code에 cloudbase-document-database-web-sdk skill 설치
~/.claude/skills/cloudbase-document-database-web-sdk/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-web-sdk ~/.claude/skills/cloudbase-document-database-web-sdkClaude Code (project)에 cloudbase-document-database-web-sdk skill 설치
.claude/skills/cloudbase-document-database-web-sdk/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-web-sdk .claude/skills/cloudbase-document-database-web-sdkCodex에 cloudbase-document-database-web-sdk skill 설치
~/.agents/skills/cloudbase-document-database-web-sdk/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-web-sdk ~/.agents/skills/cloudbase-document-database-web-sdkGemini CLI에 cloudbase-document-database-web-sdk skill 설치
~/.gemini/skills/cloudbase-document-database-web-sdk/SKILL.md
$ npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-web-sdk ~/.gemini/skills/cloudbase-document-database-web-sdkClaude.ai에 cloudbase-document-database-web-sdk skill 설치
npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-web-sdk cloudbase-document-database-web-sdk && zip -r cloudbase-document-database-web-sdk.zip cloudbase-document-database-web-sdk # claude.ai → Customize → Skills → + → Create skill → Upload a skill → cloudbase-document-database-web-sdk.zip
자동 검사
2026년 11월 15일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 보안 감사는 아닙니다. 에이전트가 실행하기 전에 스크립트를 읽어 보세요. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능tencentcloudbase/cloudbase-ai-toolkit/config/.claude/skills/cloudbase-document-database-web-sdk 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 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 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".
- Moving existing document data onto PG without changing the client code is pgdoc, not a rewrite to
app.rdb(). Read../postgresql-development-cloudbase/references/pgdoc.md: SDK calls and HTTP paths stay the same, but CUSTOM security rules no longer apply and data is not migrated automatically.
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. - A
get()whose target document is missing fails the request with HTTP 500 — it does not evaluate tofalse, and||does not skip it. If the app cannot guarantee a role document per user, keep the role list in one shared document and testauth.uid in get(`database.admin_registry.lock`).adminsinstead. - 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.
이 스킬의 파일
9cloudbase-document-database-web-sdk skill 질문
Claude Code에 cloudbase-document-database-web-sdk skill을 어떻게 설치하나요?
npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-web-sdk ~/.claude/skills/cloudbase-document-database-web-sdk를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
cloudbase-document-database-web-sdk skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
Web SDK를 사용하여 새로 생성된 문서의 ID를 어떻게 가져오나요?
새로 생성된 문서 ID는 응답의 최상위 result._id 속성에 위치합니다.
SDK 코드를 직접 작성하는 대신 언제 MCP 도구를 사용해야 하나요?
애플리케이션 수준의 프론트엔드 로직을 구현하기보다는 CloudBase 리소스 관리나 권한 설정과 같은 관리 작업에 MCP 도구를 사용하십시오.
CloudBase에서 PostgreSQL 작업을 위해 이 SKILL을 사용할 수 있나요?
아니요, PostgreSQL, CloudBase PG 또는 app.rdb()와 관련된 작업인 경우 postgresql-development-cloudbase SKILL을 사용해야 합니다.