postgresql-development-cloudbase
Use when building, debugging, or evaluating CloudBase PostgreSQL / CloudBase PG / PG mode apps, including Postgres schema setup, queryPgDatabase/managePgDatabase, JS SDK v3 app.rdb() CRUD/RPC, PG HTTP API fallback, RLS-style permissions, username-password auth, and Web CMS/admin CRUD flows backed by…
Install / Use
npx skills add TencentCloudBase/CloudBase-AI-Toolkit --skill postgresql-development-cloudbaseInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Data & AnalyticsSupported Platforms
Our assessment of postgresql-development-cloudbase
postgresql-development-cloudbase scores 93/100 on our quality scale, 133rd of 510 Data & Analytics skills we index (top 27%).
Its SKILL.md is 32 KB long, well organised into 18 sections with 5 code examples: a thorough specification that gives an agent plenty to work with.
With 1,124 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 9 days ago, so postgresql-development-cloudbase is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
postgresql-development-cloudbase compared with similar skills
All 4 of these similar skills score higher than postgresql-development-cloudbase; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| postgresql-development-cloudbase (this skill)by TencentCloudBase | 93 | 1.1k | 9d ago | SKILL.md |
| claude-memby thedotmack | 100 | 95.5k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 89.8k | 18d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.4k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 85.4k | today | MCP Server |
Frequently asked questions
- How do I install postgresql-development-cloudbase?
- Run
npx skills add TencentCloudBase/CloudBase-AI-Toolkit --skill postgresql-development-cloudbase. The install tabs above show the steps for each supported agent. - Which AI agents does postgresql-development-cloudbase work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is postgresql-development-cloudbase safe to use?
- It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is postgresql-development-cloudbase still maintained?
- The repository was last updated 9 days ago, so postgresql-development-cloudbase is actively maintained.
Skill content
View source on GitHubname: postgresql-development-cloudbase description: "Use when building, debugging, or evaluating CloudBase PostgreSQL / CloudBase PG / PG mode apps, including Postgres schema setup, queryPgDatabase/managePgDatabase, JS SDK v3 app.rdb() CRUD/RPC, PG HTTP API fallback, RLS-style permissions, username-password auth, and Web CMS/admin CRUD flows backed by CloudBase PG." version: 2.34.8 alwaysApply: false
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 PostgreSQL Development
Activation Contract
Use this first when
- The task says CloudBase PG, PostgreSQL, Postgres, PG mode, RLS, JS SDK v3 PostgreSQL,
app.rdb(),queryPgDatabase, ormanagePgDatabase. - A Web app or CMS must persist business data in CloudBase PostgreSQL instead of NoSQL or MySQL.
Then also read
- Access-pattern design or slow-query work ->
../postgresql-best-practices-cloudbase/SKILL.md - Web auth provider readiness ->
../auth-tool-cloudbase/SKILL.md - Web login implementation ->
../auth-web-cloudbase/SKILL.md - General Web implementation and verification ->
../web-development/SKILL.md - Browser storage upload ->
../cloud-storage-web/SKILL.md - Raw HTTP API details only when SDK coverage is blocked ->
../http-api-cloudbase/SKILL.md - PG reference index ->
references/index.md - PG mode overview ->
references/pg-mode-overview.md - Auth / GRANT / RLS details ->
references/auth-and-rls.md - End-to-end PG app closure ->
references/app-workflow.md - PG storage details — MUST read before writing any bucket / upload / URL code ->
references/storage-pg.md - HTTP API fallback ->
references/http-api.md - Troubleshooting ->
references/troubleshooting.md
Do NOT use first
relational-database-mcp-cloudbase/queryMysqlDatabase/manageMysqlDatabase: those are MySQL-oriented.cloudbase-document-database-web-sdk/ collection APIs for business data that must live in CloudBase PG.
Required Flow
🚨 CRITICAL: PG mode API is NOT the same as NoSQL
CloudBase PG (app.rdb(), app.storage.from('bucket')) uses different API method names than CloudBase NoSQL (app.database(), app.uploadFile()). Low-capability models often paste legacy NoSQL/auth snippets from training; reject that path immediately. If this task is PG-backed, do not write app.database(), db.collection(...), app.uploadFile(), getLoginState(), or route guards based on auth.getUser(). Use app.rdb(), PG storage v3, and auth.getSession() instead. If you are used to writing .where(), .orderBy(), .count() from other ORMs or NoSQL — stop and read the table below.
| ❌ Do NOT use these (NoSQL / ORM habits) | ✅ Use these in PG mode |
|------------------------------------------|------------------------|
| .where({ field: value }) | .match({ field: value }) or .eq("field", value) |
| .where("field", "ilike", "%v%") | .ilike("field", "%v%") |
| .orderBy("field", { ascending: false }) | .order("field", { ascending: false }) |
| .count() | .select("*", { count: "exact" }) — count is in response |
| .offset(n) | .range(from, to) |
| app.uploadFile() (legacy NoSQL upload) | app.storage.from('bucket').upload(key, file) |
| app.getTempFileURL() (legacy NoSQL URL) | app.storage.from('bucket').createSignedUrl(key, expiresIn) |
| app.storage.from() (no bucket name) | app.storage.from('bucket') — must pass bucket name |
If you find yourself typing .where() or .orderBy() or .count() — stop and use the correct method from the right column.
- First, confirm this environment actually has PostgreSQL provisioned. Call
queryEnv(action="info", envId=...)and read the derivedEnvInfo.RuntimeBackendsblock ({ postgresql, nosql, mysql }) along withEnvInfo.RuntimeMode. It is only safe to apply this skill's PG-specific guidance whenRuntimeBackends.postgresql === true(equivalently,EnvInfo.PostgreSQLis non-empty AND/OREnvInfo.Metacontainspostgresql=enable).- PG mode is a new-environment mode selected when creating a CloudBase environment with PostgreSQL. Do not try to "upgrade" a legacy environment in place; create/select a PG-mode environment instead.
- If
RuntimeBackends.postgresql === false, STOP — this is a legacy NoSQL-only env: switch tocloudbase-document-database-web-sdkfor browser data andcloud-storage-web(withapp.uploadFile()) for uploads. Do not writeapp.rdb()code, do not enable RLS, do not create a pgstore bucket here. - If both
postgresqlandnosqlaretrue(the common case in a PG environment), they coexist. Apply this skill to NEW business data the task asks you to put in PG (e.g. articles / role tables explicitly described as PG). Existing NoSQL collections, the bucket reported inEnvInfo.Storages[], and anymanagePermissions(resourceType="noSqlDatabase")rules continue to govern the legacy NoSQL data — do NOT migrate or rewrite them unless the task explicitly asks. RuntimeBackends.mysql === falseis the only hard "do not use" signal: when MySQL is absent, do not usemanageMysqlDatabase/queryMysqlDatabaseand do not consult therelational-database-mcp-cloudbaseskill; those are MySQL-specific and have nothing to do with CloudBase PG.- Note: in a PG env,
EnvInfo.Storages[]is the legacy NoSQL bucket. It still works for legacyapp.uploadFile()flows but is NOT a usable pgstore bucket — never reuse it as the<bucket>segment inapp.storage.from('<bucket>').upload('<key>', file).
Creating a PG-mode environment
If step 0 shows
RuntimeBackends.postgresql === falseand you need PostgreSQL, create a new environment with PG enabled:
- Via MCP:
manageEnv(action="create", alias="my-env", packageId="baas_personal", resources=["storage","function","postgresql"], confirm="yes")— optionalregion(e.g.region="ap-shanghai") selects where the environment is created; it works as theX-TC-Regionrequest context, so do not putRegioninto the request body. Omit it to use the current session region (site default:ap-shanghaidomestic,ap-singaporeintl); if you pass it, repeat it on the confirming call.- Via CLI:
tcb env create --alias my-env --package baas_personal --postgresql --region ap-shanghai --yes- Via Console: Create environment
-
Inspect the existing app surfaces first:
src/lib/backend.*,src/lib/auth.*,src/lib/*service.*, route guards, and the handlers bound to existing forms. -
Check PG state through MCP: use
queryPgDatabasefor schema/read-only inspection andmanagePgDatabasefor DDL/DML. Do not switch to MySQL tools. For the complete route map, readreferences/index.md. -
Understand PG roles before writing code: Publishable Key maps to
anon; a logged-in user's access token maps toauthenticated; API Key maps toservice_roleand bypasses RLS. Never expose API Key /service_rolecredentials in frontend code. Seereferences/auth-and-rls.md. -
Use schema management (
managePgDatabase) before writing CRUD code. Schema DDL (CREATE / ALTER / DROP / TRUNCATE) must go through the versioned migration workflow — never default toexecutefor table creation. Then apply GRANT + RLS (viaexecuteor the same migration SQL bundle) before browser access. The minimum SQL bundle is:CREATE TABLE,GRANT SELECT/INSERT/UPDATE/DELETE TO authenticated,GRANT USAGE, SELECT ON SEQUENCE ... TO authenticatedwhen usingserial/bigserial,ALTER TABLE ... ENABLE ROW LEVEL SECURITY, andCREATE POLICY ... USING / WITH CHECK. Seereferences/auth-and-rls.mdfor the full template.Default schema-change workflow (local file first, then remote history):
- Choose
migrationVersion= 14-digit UTC timestampYYYYMMDDHHMMSSandmigrationName= snake_case (e.g.add_users). - Write local file
cloudbase/migrations/<migrationVersion>_<migrationName>.sqlwith the DDL (and optional rollback SQL in comments or a paired file). This path must match CloudBase CLIMIGRATIONS_DIR(tcb db pg migration *). If an older workspace still has rootmigrations/, move those files intocloudbase/migrations/before mixed MCP+CLI use. - Optional preview:
managePgDatabase(action=planMigration, migrationName=..., migrationVersion=..., sql=...). - Apply:
managePgDatabase(action=applyMigration, migrationName=..., migrationVersion=..., sql=..., confirm=true)— reuse the same version/name as the local file. If the local file is missing, MCP auto-writescloudbase/migrations/<version>_<name>.sql; if an existing file's content differs fromsql, apply fails closed (LOCAL_MIGRATION_FILE_MISMATCH) and does not Push. MCP waits for the async task by default (up to 10 minutes, same as CLI); override withtaskPollTimeoutMsor setwaitForTask=falseif the host tool-call timeout is short. - Verify:
managePgDatabase(action=listMigrations)and confirm the remote history records the samemigrationVersion. - Then write frontend CRUD / RLS checks.
Out-of-order / backfill versions: Prefer a
migrationVersionstrictly newer thanLatestVersion. If you must apply a version older than Latest (branch merge / cherry-pick), passincludeAll=trueonplanMigration/applyMigration— same as CLItcb db pg migration up --include-all. Do not use this for routine work.If applyMigration returns
MIGRATION_TASK_TIMEOUTorMIGRATION_TASK_PENDING: the task may still be running (large DDL / lock waits). CalldescribeMigrationTask(taskId=...)first for Status/Phase/Reason, thenlistMigrations. Do not re-push the samemigrationVersion, and do not fall back toexecuteuntil the task is terminal and list confirms the version never landed.Other migration actions:
managePgDatabase(action=migrationDetail, migrationVersion=...)— inspect a single migrationmanagePgDatabase(action=fetchMigration)— pull remote history SQL intocloudbase/migrations/(CLItcb db pg migration fetchparity). OptionalmigrationVersionfor one file; omit for full history. Existing local files are skipped unlessforce=true(overwrite / checksum realign). Prefer this over hand-copying SQL frommigrationDetailto avoid checksum drift.managePgDatabase(action=repairMigration, migrationVersion=..., migrationName=..., repairStatus=..., repairReason=...)— repair history records
executeis for DML and ops SQL, not default DDL: usemanagePgDatabase(action=execute, confirm=true)forINSERT/UPDATE/DELETE, and forGRANT/CREATE POLICY/ storage RLS when those are not part of a migration. If you attempt schema DDL viaexecute, the tool soft-blocks withDDL_USE_APPLY_MIGRATIONunless you explicitly setallowDdlViaExecute=true(escape hatch only).🚨 CRITICAL: Inspect table existence and column names before CREATE TABLE.
CREATE TABLE IF NOT EXISTSsilently skips when the table already exists, even if the column names are wrong. Always callqueryPgDatabase(action="sql", sql="SELECT column_name, data_type FROM information_schema.columns WHERE table_name='xxx'")first to check whether the table exists and what exact column names it uses. If the table already exists with mismatched column names (e.g.user_idinstead ofuid), you must either:ALTER TABLEto add/rename/drop columns (viaapplyMigrationwith a new version), orDROP TABLE IF EXISTS ... CASCADEand recreate viaapplyMigration(only when data loss is acceptable, e.g. disposable/evaluation environments).
- Choose
Truncated for display — read the full file on GitHub.
Related Skills
claude-mem
95.5kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
89.8kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
74.4kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
85.4k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
