cloudbase-document-database-web-sdk skill
✓ DoğrulandıCloudBase JS SDK kullanarak ajanların web uygulamalarında NoSQL CRUD işlemleri, karmaşık sorgular ve gerçek zamanlı veri senkronizasyonu gerçekleştirmesini sağlar.
- GitHub yıldızları
- 1.164
- Dosyalar
- 9
- Son commit
- 11 Kas 2026
- Lisans
- MIT
- İzin verilen araçlar
- —
cloudbase-document-database-web-sdk skill ne işe yarar?
cloudbase-document-database-web-sdk bir agent skill'dir. CloudBase JS SDK kullanarak ajanların web uygulamalarında NoSQL CRUD işlemleri, karmaşık sorgular ve gerçek zamanlı veri senkronizasyonu gerçekleştirmesini sağlar.
Özet, skill'in SKILL.md dosyasından oluşturuldu.
cloudbase-document-database-web-sdk skilli hakkında
Web uygulamaları geliştiren geliştiriciler, NoSQL belge veri tabanı işlemlerini doğrudan frontend kodları içinde uygulamak için bu SKILL'i kullanabilirler. Bu SKILL, veri koleksiyonlarını yönetmek için @cloudbase/js-sdk kullanarak tarayıcı tarafı JavaScript yazmak veya düzenlemekle görevlendirilen ajanlar için tasarlanmıştır. SKILL; standart CRUD görevlerini, karmaşık sorguları, sayfalamayı ve veri toplama işlemlerinin yanı sıra watch metodu aracılığıyla gerçek zamanlı senkronizasyonu kolaylaştırır.
Bir ajandan uygulama mantığını uygulaması veya mevcut web projesi dosyalarını değiştirmesi istendiğinde, doğru SDK uygulamalarını üretebilmesi için bu SKILL'i yüklemesi gerekir. CloudBase JS SDK'ya dayanır ve güvenlik kurallarına uyulmasını sağlamak için kimlik doğrulama durumlarıyla dikkatli bir koordinasyon gerektirir. Bu SKILL özellikle tarayıcı tabanlı ortamlar içindir; sunucu tarafı bulut fonksiyonları, Mini Program geliştirme veya SQL tabanlı PostgreSQL işlemleri için kullanılmamalıdır.
Bir agent bununla neler yapabilir
- 1Frontend CRUD işlemlerini uygulamaBir ajan, belirli bir koleksiyondaki belgeleri eklemek, getirmek, güncellemek veya silmek için JavaScript kodu yazabilir.
- 2Gerçek zamanlı veri dinleyicileri kurmaBir geliştirici, watch metodunu kullanarak bir web arayüzünde canlı veri güncellemelerini uygulaması için bir yapay zekaya talimat verebilir.
- 3Sayfalanmış veri akışları geliştirmeBir ajan, skip ve limit komutlarını kullanarak büyük veri kümelerini yönetilebilir parçalar halinde getirmek için mantık oluşturabilir.
Skill'in SKILL.md dosyasından yazılmıştır. Her kullanım durumu oradaki bir alıntı ile kontrol edilir.
cloudbase-document-database-web-sdk skill nasıl kurulur
Her komut, skill klasörünü istemcinin skills dizinine kopyalar. Yüklemek için istemciyi yeniden başlatın veya yeni bir oturum başlatın.cloudbase-document-database-web-sdk skill'ini Claude Code uygulamasına kur
~/.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-sdkcloudbase-document-database-web-sdk skill'ini Claude Code (project) uygulamasına kur
.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-sdkcloudbase-document-database-web-sdk skill'ini Codex uygulamasına kur
~/.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-sdkcloudbase-document-database-web-sdk skill'ini Gemini CLI uygulamasına kur
~/.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-sdkcloudbase-document-database-web-sdk skill'ini Claude.ai uygulamasına kur
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
Otomatik kontroller
Çalıştırıldı 15 Kas 2026Tam rapor →Otomatik kontrollerimizi geçti. Bu bir güvenlik denetimi değil: bir ajanın çalıştırmasına izin vermeden önce betikleri okuyun. Kontroller nasıl çalışır · Daha fazla puan için nelerin düzeltileceği
- Kaynak deposu bağlantılı ve erişilebilirtencentcloudbase/cloudbase-ai-toolkit/config/.claude/skills/cloudbase-document-database-web-sdk is public and reachablegithub.com/tencentcloudbase/cloudbase-ai-toolkit/tree/HEAD/c ↗Geçti
- Açık kaynak lisansı (OSI)MITspdx.org/licenses/MIT.html ↗Geçti
- Son bir yıl içinde commit veya sürüm mevcutLast commit 2026-11-11github.com/tencentcloudbase/cloudbase-ai-toolkit/commits ↗Geçti
- Betiklerde indir-çalıştır veya kimlik bilgisi hırsızlığı yokNo scripts in the skill folderGeçti
- SKILL.md içinde gizli talimat yokNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/tencentcloudbase/cloudbase-ai-toolkit/blob/HEAD/c ↗Geçti
- Önceden izin verilen araçlar sınırlıNo pre-approved tools; the agent asks before using onegithub.com/tencentcloudbase/cloudbase-ai-toolkit/blob/HEAD/c ↗Geçti
- SKILL.md, Agent Skills biçimine uyuyorthe description does not say when to use the skillgithub.com/tencentcloudbase/cloudbase-ai-toolkit/blob/HEAD/c ↗Bulgu
SKILL.md
GitHub'da görüntüleSibling 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.
Bu becerideki dosyalar
9cloudbase-document-database-web-sdk skill soruları
cloudbase-document-database-web-sdk skill'ini Claude Code uygulamasına nasıl kurarım?
npx degit TencentCloudBase/CloudBase-AI-Toolkit/config/.claude/skills/cloudbase-document-database-web-sdk ~/.claude/skills/cloudbase-document-database-web-sdk komutunu çalıştırın. Claude Code, skill'leri ~/.claude/skills (tüm projeler) veya .claude/skills (tek proje) konumundan yükler ve açıklaması görevle eşleştiğinde skill'i kullanır.
cloudbase-document-database-web-sdk skill'ini hangi istemciler kullanabilir?
Agent Skills biçimini okuyan her istemci: Claude Code, Codex, Gemini CLI ve claude.ai (ZIP olarak yükleyin). Skill içindeki betikler yalnızca istemcinin kod çalıştırmaya izin verdiği yerlerde çalışır.
Web SDK kullanarak yeni oluşturulan bir belgenin ID'sini nasıl alabilirim?
Yeni oluşturulan belge ID'si, yanıtın en üst seviyedeki result._id özelliğinde bulunur.
SDK kodu yazmak yerine ne zaman MCP araçlarını kullanmalıyım?
Uygulama düzeyindeki frontend mantığını uygulamak yerine, CloudBase kaynaklarını yönetmek veya izinleri ayarlamak gibi yönetimsel görevler için MCP araçlarını kullanın.
Bu SKILL'i CloudBase içindeki PostgreSQL işlemleri için kullanabilir miyim?
Hayır, eğer görev PostgreSQL, CloudBase PG veya app.rdb() içeriyorsa, bunun yerine postgresql-development-cloudbase SKILL'ini kullanmalısınız.