cloud-functions
Provides a comprehensive guide for managing CloudBase Event and HTTP functions.
Install
mkdir -p .claude/skills/cloud-functions && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4885" && unzip -o skill.zip -d .claude/skills/cloud-functions && rm skill.zipInstalls to .claude/skills/cloud-functions
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
CloudBase function runtime guide for building, deploying, and debugging your own Event Functions or HTTP Functions. This skill should be used when users need application runtime code on CloudBase, not when they are merely calling CloudBase official platform APIs.Key capabilities
- →Automates cloud function deployment workflows
- →Configures function invocation environments
- →Debugs runtime environment and function logs
- →Manages HTTP trigger/gateway exposure
How it works
Interfaces with CloudBase build and runtime APIs to sync local code with the cloud deployment environment.
Inputs & outputs
When to use cloud-functions
- →Deploy an HTTP-triggered cloud function
- →Debug function runtime logs
- →Configure function invocation environment
About this skill
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.
Cross-cutting protocols (required before code changes or deployments):
- Change Safety Protocol:
../cloudbase-platform/references/protocols/change-safety-protocol.md - Deployment Gate:
../cloudbase-platform/references/protocols/deployment-gate.md - Sensitive Runtime Data Protection:
../cloudbase-platform/references/protocols/sensitive-runtime-data-protection.md
Cloud Functions Development
Activation Contract
Use this first when
- The task is to create, update, deploy, inspect, or debug a CloudBase Event Function or HTTP Function that serves application runtime logic.
- The request mentions function runtime, function logs,
scf_bootstrap, function triggers, or function gateway exposure.
Read before writing code if
- You still need to decide between Event Function and HTTP Function.
- The task mentions
manageFunctions,queryFunctions,manageGateway, or legacy function-tool names. - The task might require
callCloudApias a fallback for logs or gateway setup. - An HTTP Function will call CloudBase resources through
@cloudbase/node-sdkor@cloudbase/manager-node-> read./references/http-function-credentials.md. HTTP Functions must use explicit credentials; do not rely on the Event Function passwordless runtime path.
Exception only (do not read by default)
- Migrating an existing app that already uses classic TCP DB clients (
DATABASE_URL/ Prisma /mysql2/pg/ Redis) → read./references/vpc-and-tcp-database.mdvia./references.md. New business CRUD must prefer CloudBase native SDK (app.database()/app.rdb()) or MCP SQL tools instead of TCP.
Then also read
- Detailed reference routing ->
./references.md - Auth setup or provider-related backend work ->
../auth-tool-cloudbase/SKILL.md - CloudBase Integration Center generated WeChat Pay or Official Account functions ->
../cloudbase-wechat-integration/SKILL.md(official docs:https://docs.cloudbase.net/integration/introduce.md) - AI in functions ->
../ai-model-nodejs/SKILL.md - Long-lived container services or Agent runtimes ->
../cloudrun-development/SKILL.md - Calling CloudBase official platform APIs from a client or script ->
../http-api-cloudbase/SKILL.md
Do NOT use for
- CloudRun container services.
- Web authentication UI implementation.
- Database-schema design or general data-model work.
- CloudBase official platform API clients or raw HTTP integrations that only consume platform endpoints.
- Creating Integration Center instances through guessed APIs. For WeChat Pay or Official Account generated functions, use
cloudbase-wechat-integrationfor the business contract and this skill only for function operations. - Tasks that the CloudBase JS SDK can handle directly — simple data reads/writes, leaderboards, file uploads, real-time queries. Reach for the matching SDK surface before writing a function:
db.collection(...).get/add/updateonly for confirmed NoSQL collections, andapp.rdb().from(...)for CloudBase PG tables. Functions add deployment complexity, CORS configuration, and HTTP gateway binding that the SDK eliminates entirely.
Common mistakes / gotchas
-
Picking the wrong function type and trying to compensate later.
-
Confusing official CloudBase API client work with building your own HTTP function.
-
Mixing Event Function code shape (
exports.main(event, context)) with HTTP Function code shape (req/reson port9000). -
Treating HTTP Access as the implementation model for HTTP Functions. HTTP Access is a gateway configuration for Event Functions, not the HTTP Function runtime model.
-
Assuming
db.collection("name").add(...)will create a missing document-database collection automatically. Collection creation is a separate management step. -
Baking static content into the deployment package — media files, user uploads, or assets that change on their own cadence. The package is uploaded on every deploy and a function package has a hard size ceiling, so large or independently-changing content makes every deploy slower and can push the package over the limit.
- Media files (
*.mp4, large images, fonts) — go to cloud storage, referenced by URL, not into the package. - User uploads written to the function's local filesystem — the function is ephemeral and
/tmpis small and not shared. Uploads go to cloud storage. - Frequently-updated static resources bundled in — every change forces a full function redeploy. Serve them from cloud storage so the function only redeploys when the code changes.
- Media files (
-
Forgetting that runtime cannot be changed after creation.
-
Using cloud functions as the first answer for Web login.
-
Forgetting that HTTP Functions must ship
scf_bootstrap, listen on port9000, and include dependencies. -
Assuming an HTTP Function can use CloudBase SDKs without explicit credentials. The default temporary credential path is not reliable for HTTP Functions and credential rotation can break a running service. Use a CloudBase server API Key or Tencent Cloud key pair for
@cloudbase/node-sdk; use a Tencent Cloud key pair for@cloudbase/manager-node. Seereferences/http-function-credentials.md. -
Forgetting how an HTTP Function is meant to be reached. A call with no credential fails
401 MISSING_CREDENTIALS; a call that carries one but is not allowed fails403 EXCEED_AUTHORITY. For browser, game or app clients, add a gateway route (manageGateway(action="createRoute", auth: false)) instead of widening the function security rule — in PostgreSQL environments that rule lives in an environment-wideauthz.user.regodocument, so editing it overwrites the policy for the whole environment. Seereferences/http-functions.md. -
Reading an
InsufficientBalanceinvoke failure as an account problem. A cloud function answers HTTP 410 with this code and the code reads as a short account balance, but what runs out is the environment's resource points — drawn down before any account balance and not restored by a top-up. The four causes (trial points exhausted / plan points exhausted / plan expired / account in arrears) need four different answers, only the last of which involves topping up, so diagnose withmanageEnv(action="usage")plus the account balance before advising. See../cloud-api-operations/references/recipes/credits-exhaustion.md. -
Mismatching the
scf_bootstrapNode.js binary path with the function runtime (e.g. using/var/lang/node18/bin/nodebut settingruntime: "Nodejs16.13"). -
For Custom Image HTTP Functions: forgetting that TCR, the CloudApp build, and SCF must be in the same region; using
:latestinstead of a unique tag; or confusing the request-driven port-9000image model with a long-lived CloudRun container that listens on the injectedPORT. -
Assuming MCP covers the whole image pipeline.
manageFunctionscovers SCF image deploy (Stage B) viaruntime: "CustomImage"+imageConfig, but the CloudApp custom build → TCR push (Stage A) is a raw Tencent Cloud API path — confirm action names and parameters from official docs before anycallCloudApifallback. -
Making code or configuration changes without first following the Change Safety Protocol (
cloudbase-platform/references/protocols/change-safety-protocol.md). -
Exposing functions publicly or deploying without first completing the checks in
cloudbase-platform/references/protocols/deployment-gate.md. -
Returning
req.headers,process.env,event, orcontextwholesale — gateways may injectx-cloudbase-context(base64 temporary credentials). Never echo that header or dump credential env vars to clients. Follow../cloudbase-platform/references/protocols/sensitive-runtime-data-protection.md. -
Using a bare layer name (e.g.
common) across environments. SCF LayerName is an account-scoped shared namespace: same name → shared version sequence. Create new layers with fixed format{layerName}_{当前envId}(e.g.common_cloud1-d9ghadgak3edf6b36). Pass the full name aslayerName— do not invent automatic suffixes. Treat MCP layerwarningsas soft advisories (operation still succeeds). Details:./references/operations-and-config.md. -
Long-running MCP image deployments must complete the full workflow: When using
manageFunctionswithdeployFunctionfor a realcloudorlocaldeployment, preferwait=falseto avoid blocking a single Tool Call for an extended period. If the tool returns ataskId, do not end the workflow, report success, or ask the user to wait while the status isrunning. Automatically callqueryFunctions(action="getFunctionDeployStatus", taskId="...")and continue polling according to the reported progress until the status becomessucceededorfailed. Only after reaching a reasonable polling limit may you report that the deployment is still in progress; include thetaskId, current stage, and latest progress. On success, report the image URI or build ID, function status, and Gateway URL. On failure, report the failed stage, error code, request ID, and diagnostic guidance. If the status isexpired, explain that the local task record exceeded its retention window; the cloud deployment may still be running, so callgetFunctionDetailto confirm the actual cloud-side status instead of treating it as a failure. -
Passing a self-managed CAM role as the execution role to "reduce the function's permissions". A custom role does not make a function read less data — collection security rules do that (
managePermissionsactionupdateResourcePermission, withpermission="CUSTOM"and asecurityRule).
Content truncated.
When not to use it
- →Calling official CloudBase platform APIs
- →Managing non-CloudBase serverless functions
Prerequisites
Limitations
- →Exclusive to CloudBase infrastructure
- →Requires proper environment configuration to run
How it compares
It separates runtime application logic development from platform-level service calls.
Compared to similar skills
cloud-functions side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| cloud-functions (this skill) | 1 | 5mo | Review | Intermediate |
| flow-nexus-platform | 6 | 8mo | Review | Beginner |
| netlify-deploy | 7 | 9mo | Review | Beginner |
| azure-static-web-apps | 4 | 10mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by TencentCloudBase
View all by TencentCloudBase →You might also like
flow-nexus-platform
ruvnet
Comprehensive Flow Nexus platform management - authentication, sandboxes, app deployment, payments, and challenges
netlify-deploy
openai
Deploy web projects to Netlify using the Netlify CLI (`npx netlify`). Use when the user asks to deploy, host, publish, or link a site/repo on Netlify, including preview and production deploys.
azure-static-web-apps
github
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development, configuring staticwebapp.config.json, adding Azure Functions APIs to SWA, or setting up GitHub Actions CI/CD for Static Web Apps.
web-development
TencentCloudBase
Web frontend project development rules. Use this skill when developing web frontend pages, deploying static hosting, and integrating CloudBase Web SDK.
apollo-deploy-integration
jeremylongshore
Deploy Apollo.io integrations to production. Use when deploying Apollo integrations, configuring production environments, or setting up deployment pipelines. Trigger with phrases like "deploy apollo", "apollo production deploy", "apollo deployment pipeline", "apollo to production".
publish-package-cicd
joelhooks
CI/CD publishing workflow for npm packages using Changesets + npm Trusted Publishers (OIDC). Use when setting up automated npm publishing for monorepos, configuring GitHub Actions for releases, troubleshooting workspace:* protocol resolution issues, fixing "Cannot find module" errors in published packages, or debugging npm OIDC authentication. Covers Bun + Turborepo + Changesets + npm Trusted Publishers with workspace protocol resolution.