SuperAPI AI Directory

cloudbase

Deployment & operations

View repository

Updated 11-03 05:07

About this skill

CloudBase Development Guidelines

Step 0 — Confirm the site (domestic vs international)

CloudBase has two independent account systems: domestic site (domestic, cloud.tencent.com) and international site (international, tencentcloud.com). Environments, consoles, API keys, and login state do not cross over. A wrong-site login usually looks like "logged in, but no environments visible" rather than a clear error — so settle the site before installing MCP, logging in, or binding an env.

Infer it when you can (console domain, envId, an existing error); otherwise ask the user once. Do not guess.

domestic site domestic international site international
Remote MCP (preferred) https://tcb-api.cloud.tencent.com/mcp/v1 https://tcb-api.tencentcloud.com/mcp/v1
Local stdio MCP nothing to set (TCB_SITE is domestic by default) TCB_SITE=intl + TCB_REGION=ap-singapore
tcb CLI default TCB_IS_INTL=true (or tcb config set isIntl true)
Project record .cloudbase/project.json site omitted, or "domestic" "site": "intl", "region": "ap-singapore"
Console tcb.cloud.tencent.com tcb.tencentcloud.com
Default region ap-shanghai ap-singapore
NoSQL / document DB tools available not available
  • Connect remote by default. Both hosts are first-class endpoints: OAuth covers the login and the hostname decides the site, so there is no site parameter to pass. International: https://tcb-api.tencentcloud.com/mcp/v1; domestic: https://tcb-api.cloud.tencent.com/mcp/v1.
  • Use local stdio only when something requires it — an account signing in with a CloudBase API key, one session that must cover both sites (a remote URL is bound to one), or a task that needs a tool the hosted endpoint does not register. Deploying functions or apps is not a reason: that works remotely through the two-step upload. Comparison: references/mcp-setup.md.
  • TCB_IS_INTL (CLI) and TCB_SITE (MCP) are different variable names for different tools. Set the one matching the tool in use; setting the wrong one silently does nothing.
  • On a first run, settle the site once and persist it — the CLI switch is machine-global, the MCP switch is per-client, and only .cloudbase/project.json is project-scoped and readable by MCP after a restart. Follow references/site-onboarding.md; do not re-ask on later sessions.

Details and copy-paste configs: references/mcp-setup.md. CLI specifics: references/tooling-fallback.md. First-run orchestration (trigger/skip, conflict arbitration, MCP-down fallback): references/site-onboarding.md.

Workflow

1. Exploration  →  Read the matching skill completely before writing any code.
                   Search with searchKnowledgeBase(mode="skill"), then Read full SKILL.md.
2. Implementation
   ├── 2a. Resource preparation → Prefer MCP; if MCP tools are missing in THIS session,
   │     configure MCP for next session and use `tcb` CLI now (see tooling-fallback.md)
   └── 2b. Frontend implementation → Write code, install deps, start server, test
3. Close-out  →  Run cloudbase-code-review, fix errors, declare done
                   (after a verified deploy: optionally offer Deployment Share once — see references/deployment-workflow.md §5)

Key constraints: Stage 2a must precede frontend code. Stage 3 is mandatory.

Activation Contract

Routing uses stable skill ids (auth-tool-cloudbase, auth-web-cloudbase, http-api-cloudbase, …) across source, generated artifacts, and installs.

Standalone skill fallback

If only one published skill is exposed:

  • Prefer local relative paths (references/<skill-id>/SKILL.md or sibling skill directories) when those files exist in the workspace.
  • Do not fetch sibling skill markdown from remote raw URLs into the agent context.
  • If a required sibling skill is missing locally, ask the user to install the full CloudBase skills pack or IDE plugin (npx skills add tencentcloudbase/cloudbase-skills). When that fails because git is missing, use the tarball path in references/mcp-setup.md, then continue using local files only.

Follow relative references/... paths from the current skill. If MCP is unavailable in this session, follow references/tooling-fallback.md: configure MCP via references/mcp-setup.md for the next session, and use tcb CLI via the cloudbase-cli skill (read core.md + the matching domain reference — not tcb deploy) to finish login/manage now. If npm/npx are missing, follow the “No npm/npx” section in tooling-fallback.md.

Global rules before action

  • Identify the scenario, then read the matching skill before writing code or calling CloudBase APIs.
  • Prefer semantic sources for toolkit maintenance; express runtime routing in stable skill ids.
  • Prefer MCP or mcporter for management tasks when those tools are available in this session; inspect tool schemas before execution. If they are not available yet, do not stall — use the CLI fallback in references/tooling-fallback.md.
  • Connecting MCP at all (local stdio versus remote), calling tools from the shell with mcporter, the site / region / plugin switches, or a fix to this open-source repo: read cloudbase-mcp.
  • UI tasks: read ui-design first and output the design spec before interface code.
  • Auth tasks: read auth-tool-cloudbase first and enable providers before frontend implementation.
  • Keep auth domains separate: management login uses auth (or tcb login when MCP auth is unavailable); app-side auth uses queryAppAuth / manageAppAuth.

Universal guardrails

  • After 2–3 failed attempts on the same path, stop and reroute (platform skill, runtime, auth domain, permission model, SDK boundary).
  • Always specify EnvId explicitly; do not rely on CLI-selected or implicit env state.
  • When the environment identifier is an alias, nickname, or other short form, do not pass it directly to auth.set_env, SDK init, console URLs, or generated config. First resolve it to the canonical full EnvId with queryEnv(action=list, alias=..., aliasExact=true). If multiple environments match or no exact alias exists, stop and clarify with the user.
  • When writing MCP/tool results to a file, pass serialized text (JSON.stringify(result, null, 2)), not raw objects. If a write tool says content expected a string but received an object, do not retry with the same raw object. Serialize the object first, then retry once with the serialized text, and make sure the retried call actually passes the serialized string rather than the original object.
  • Keep scenario-specific pitfalls in child skills — do not expand this entry file.
  • First frontend deploy must use manageApps(action="deployApp", ...). There is no createApp / updateApp action — first deploy and re-deploy both use deployApp, and a re-deploy reuses the same serviceName. manageHosting is only for incremental updates of projects originally deployed via hosting.

Engineering constitution (applies to every scenario)

These rules override convenience. Full rationale lives in web-development.

  • Prepare backend resources before writing frontend code. Prefer MCP for auth providers, tables, storage domains, and security rules; if MCP tools are missing in this session, use tcb CLI after configuring MCP for the next session (references/tooling-fallback.md).
  • Do NOT use any to bypass type errors. Prefer unknown + type guards / precise interfaces.
  • Self-verify before claiming done. Static (tsc / lint / build / tests) and runtime (agent-browser for user-visible flows). Name gaps explicitly if a layer cannot run.
  • Do not paper over failures. No empty try/catch, no deleting failing tests to go green.
  • ai.createModel(...) / wx.cloud.extend.AI.createModel(provider) takes a GroupName, not a vendor/model id. Legal: "cloudbase", "hunyuan-v3" (legacy plan group, only hy3, being retired), "hunyuan-exp" (older legacy builtin), or "custom-<name>". Model ids go in generateText / streamText model field. See ai-model-web / ai-model-nodejs / ai-model-wechat.
  • Low-capability STOP card: For PostgreSQL / CloudBase PG / app.rdb() / queryPgDatabase / managePgDatabase, route to postgresql-development-cloudbase — do not use NoSQL collection APIs or MySQL tools for that path. For Web auth guards, use auth.getSession() and require data.session; do not use deprecated getLoginState() / auth.getUser() as login proof.

High-priority routing

Scenario Read first Then read Do NOT route to first Must check before action
Minimal Web BaaS demo (fast path) minimal-web-baas-demo web-development, no-sql-web-sdk, postgresql-development cloud-functions, cloudrun, spec-workflow, ui-design BaaS-first Web SDK CRUD, MCP schema only, zero cloud functions unless secrets/cron/rules-cannot-express
Web login / registration / auth UI auth-tool-cloudbase auth-web, web-development cloud-functions, http-api Provider status and publishable key
WeChat mini program + CloudBase miniprogram-development auth-wechat, no-sql-wx-mp-sdk auth-web, web-development Whether the project really uses CloudBase / wx.cloud
Native App / Flutter / React Native http-api-cloudbase auth-tool, postgresql-development auth-web, cloudbase-document-database-web-sdk, web-development SDK boundary, OpenAPI, auth method
Web projects + NoSQL Database web-development no-sql-web-sdk, auth-web relational-database-tool, http-api Login state and database access permission model
CloudBase PostgreSQL / PG postgresql-development-cloudbase auth-tool, auth-web-cloudbase, web-development, miniprogram-development, cloud-storage-web, http-api relational-database-tool, no-sql-web-sdk PG schema, usernamePassword login, backend/RLS permission model. New relational work uses PostgreSQL
Existing MySQL (do not recommend) relational-database-mcp-cloudbase relational-database-web postgresql-development, no-sql-web-sdk Only when the environment already has MySQL. New relational work uses PostgreSQL
Cloud Functions cloud-functions auth-tool, ai-model-nodejs cloudrun-development, auth-web Event vs HTTP function, runtime, scf_bootstrap
CloudRun backend cloudrun-development auth-tool, postgresql-development cloud-functions Container boundary, Dockerfile, CORS
AI Agent (AI agent development) cloudbase-agent cloud-functions, cloudrun-development cloud-functions, cloudrun-development AG-UI protocol, scf_bootstrap, SSE streaming
AI model call (large model call / text generation / image generation / streaming conversation) ai-model-web ai-model-nodejs, ai-model-wechat cloudbase-agent, cloud-functions, cloudrun-development First run the "mandatory pre-call eligibility check":DescribeActivityInfo(Mini Program Growth Program) + DescribeEnvPostpayPackage(Token Credits resource pack)
UI generation ui-design web-development, miniprogram-development cloud-functions Design specification first
AI Model (Web) web-development ai-model-web, ui-design ai-model-wechat, http-api Platform and streaming interaction mode
Resource health inspection / troubleshooting ops-inspector cloud-functions, cloudrun-development ui-design, spec-workflow CLS enabled; use queryEnv(action=metrics) for QPS/CPU (never callCloudApi); time range for logs
Spec workflow / architecture design spec-workflow cloudbase web-development, cloud-functions Requirements, design, tasks confirmed

Routing reminders

  • Web auth failures: usually skipped provider config, not missing frontend snippets.
  • Native App failures: usually Web SDK paths, not missing HTTP API knowledge.
  • Mini program failures: treating wx.cloud like Web auth/SDK.
  • New relational databases use PostgreSQL. MySQL skills apply only when the environment already has a MySQL instance.
  • CloudBase PG failures: falling back to NoSQL or MySQL, skipping username-password readiness, or guessing raw HTTP instead of app.rdb() / documented OpenAPI.
  • AI model failures: usually missing Token Credits / Growth Plan — run DescribeEnvPostpayPackage / DescribeActivityInfo before changing code.

MCP + CLI prerequisite

Prefer CloudBase MCP for management/deploy when tools are loaded in the current session. Setup: references/mcp-setup.md. First-session / unavailable path: references/tooling-fallback.md.

  • Preferred install: npx plugins add TencentCloudBase/cloudbase-plugin -y --scope user. Supported --target IDs: claude-code, cursor, codex, grok, kimi, github-copilot, vscode. See references/mcp-setup.md. When plugins add fails with program not found, use the no-git tarball path in that file.
  • Verify with npx mcporter list | grep cloudbase or the IDE MCP panel. If npm/npx are missing, see references/tooling-fallback.md (install Node LTS or use IDE marketplace MCP). If MCP is missing or not yet visible after config, still proceed: finish install/config, tell the user a restart unlocks MCP next time, and use tcb CLI now via cloudbase-cli domain skills — do not recommend tcb deploy.
  • Prefer device-code login via MCP auth when available; otherwise tcb login. Do not hard-code secrets.

On-demand references

Load only when needed (do not expand this entry):

  • references/tooling-fallback.md — MCP vs tcb CLI decision tree for first session / missing tools
  • references/site-onboarding.md — first-run site onboarding: trigger/skip, persistence, conflict arbitration, MCP-down fallback
  • references/deployment-workflow.md — deploy backend/frontend, manageApps vs hosting, URL/docs updates, optional post-deployment Deployment Share offer (§5)
  • references/console-links.md — console hash paths after creating resources
  • references/scenarios.md — user-need → CloudBase capability mapping
  • references/mcp-setup.md — Plugin install (global default + targets), IDE MCP / mcporter config and auth examples
  • references/activation-map.yaml — canonical routing contract source

Reference index

All packaged reference files (required for skill lint reachability):