Standalone Install Note
If this environment only installed the current skill, start from the CloudBase main entry and use the published cloudbase/references/... paths for sibling skills.
- CloudBase main entry:
https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md
- Current skill raw source:
https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloudrun-development/SKILL.md
Keep local references/... paths for files that ship with the current skill directory. When this file points to a sibling skill such as auth-tool or web-development, use the standalone fallback URL shown next to that reference.
CloudBase Run Development
Activation Contract
Use this first when
- The task is to initialize, run, deploy, inspect, or debug a CloudBase Run service.
- The request needs a long-lived HTTP service, SSE, WebSocket, custom system dependencies, or container-style deployment.
- The task is to create or run an Agent service on CloudBase Run.
Read before writing code if
- You still need to choose between Function mode and Container mode.
- The prompt mentions
queryCloudRun, manageCloudRun, Dockerfile, service domains, or public/private access.
Then also read
- Cloud functions instead of CloudRun ->
../cloud-functions/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloud-functions/SKILL.md)
- Agent SDK and AG-UI specifics ->
../cloudbase-agent/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloudbase-agent/SKILL.md)
- Web authentication for browser callers ->
../auth-web/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-web/SKILL.md)
Do NOT use for
- Simple Event Function or HTTP Function workflows that fit the function model better.
- Frontend-only projects with no backend service.
- Database-schema design tasks.
Common mistakes / gotchas
- Choosing CloudRun when the request only needs a normal cloud function.
- Forgetting to listen on the platform-provided
PORT.
- Treating CloudRun as stateful app hosting and storing important state on local disk.
- Assuming local run is available for Container mode.
- Opening public access by default when the scenario only needs private or mini-program internal access.
Minimal checklist
- Choose Function mode or Container mode explicitly.
- Confirm whether the service should be public, VPC-only, or mini-program internal.
- Keep the service stateless and externalize durable data.
- Use absolute paths for every local project path.
Overview
Use CloudBase Run when the task needs a deployed backend service rather than a short-lived serverless function.
When CloudRun is a better fit
- Long connections: WebSocket, SSE, server push
- Long-running request handling or persistent service processes
- Custom runtime environments or system libraries
- Arbitrary languages or frameworks
- Stable external service endpoints with elastic scaling
- AI Agent deployment on Function mode CloudRun
Mode selection
| Dimension |
Function mode |
Container mode |
| Best for |
Fast start, Node.js service patterns, built-in framework, Agent flows |
Existing containers, arbitrary runtimes, custom system dependencies |
| Port model |
Framework-managed local mode, deployed service still follows platform rules |
App must listen on injected PORT |
| Dockerfile |
Not required |
Required |
| Local run through tools |
Supported |
Not supported |
| Typical use |
Streaming APIs, low-latency backend, Agent service |
Custom language stack, migrated container app |
How to use this skill (for a coding agent)
Choose mode first
- Function mode -> quickest path for HTTP/SSE/WebSocket or Agent scenarios
- Container mode -> use when Docker/custom runtime is a real requirement
Follow mandatory runtime rules
- Listen on
PORT
- Keep the service stateless
- Put durable data in DB/storage/cache
- Keep dependencies and image size small
- Respect resource ratio guidance:
Mem = 2 × CPU
Use the correct tools
- Read operations ->
queryCloudRun
- Write operations ->
manageCloudRun
- Delete requires explicit confirmation and
force: true
- Always use absolute
targetPath
Follow the deployment sequence
- Initialize or download code
- For Container mode, verify Dockerfile
- Local run when available
- Configure access model
- Deploy and verify detail output
Tool routing
Read operations
queryCloudRun(action="list") -> list services
queryCloudRun(action="detail") -> inspect one service and its latest deploy status when available
queryCloudRun(action="templates") -> see available starters
queryCloudRun(action="getDeployLog") -> retrieve the latest deploy log or a specified buildId
Write operations
manageCloudRun(action="init") -> create local project
manageCloudRun(action="download") -> pull remote code
manageCloudRun(action="run") -> local run for Function mode
manageCloudRun(action="deploy") -> deploy local project
manageCloudRun(action="delete") -> delete service
manageCloudRun(action="createAgent") -> create Agent service
Access guidance
- Web/public scenarios -> enable WEB access intentionally and pair it with the right auth flow.
- Mini Program -> prefer internal direct connection and avoid unnecessary public exposure.
- Private/VPC scenarios -> keep public access off unless the product requirement clearly needs it.
Quick examples
Initialize
{ "action": "init", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc" }
Local run (Function mode)
{ "action": "run", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc", "runOptions": { "port": 3000 } }
Deploy
{
"action": "deploy",
"serverName": "my-svc",
"targetPath": "/abs/ws/my-svc",
"serverConfig": {
"OpenAccessTypes": ["PUBLIC"],
"Cpu": 0.5,
"Mem": 1,
"MinNum": 1,
"MaxNum": 5
}
}
Valid OpenAccessTypes values: OA (办公网访问), PUBLIC (公网访问), MINIAPP (小程序访问), VPC (VPC访问). Use PUBLIC for web applications that need public HTTPS access.
MinNum: 1 is the recommended default when you want to reduce cold-start latency. If the user explicitly prefers lower cost and accepts more cold starts, explain the tradeoff and let them reduce MinNum to 0.
Best practices
- Prefer PRIVATE/VPC or mini-program internal access when possible.
- Use environment variables for secrets and per-environment configuration.
- Verify configuration before and after deployment with
queryCloudRun(action="detail").
- Keep startup work small to reduce cold-start impact.
- For Agent scenarios, use the Agent SDK skill for protocol and adapter details instead of duplicating them here.
Troubleshooting hints
- Access failure -> check access type, domain setup, and whether the instance scaled to zero.
- Deployment failure -> inspect Dockerfile, build logs, and CPU/memory ratio.
- Local run failure -> remember only Function mode is supported by local-run tools.
- Performance issues -> reduce dependencies, optimize initialization, and tune minimum instances.
1---2name: cloudrun-development3description: CloudBase Run backend development rules (Function mode/Container mode). Use this skill when deploying backend services that require long connections, multi-language support, custom environments, or AI agent development.4version: 2.23.115alwaysApply: false6metadata:7 source: https://skillmd.com/skills/om-scogo/cloudrun-development8---910## Standalone Install Note1112If this environment only installed the current skill, start from the CloudBase main entry and use the published `cloudbase/references/...` paths for sibling skills.1314- CloudBase main entry: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.md`15- Current skill raw source: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloudrun-development/SKILL.md`1617Keep local `references/...` paths for files that ship with the current skill directory. When this file points to a sibling skill such as `auth-tool` or `web-development`, use the standalone fallback URL shown next to that reference.1819# CloudBase Run Development2021## Activation Contract2223### Use this first when2425- The task is to initialize, run, deploy, inspect, or debug a CloudBase Run service.26- The request needs a long-lived HTTP service, SSE, WebSocket, custom system dependencies, or container-style deployment.27- The task is to create or run an Agent service on CloudBase Run.2829### Read before writing code if3031- You still need to choose between Function mode and Container mode.32- The prompt mentions `queryCloudRun`, `manageCloudRun`, Dockerfile, service domains, or public/private access.3334### Then also read3536- Cloud functions instead of CloudRun -> `../cloud-functions/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloud-functions/SKILL.md`)37- Agent SDK and AG-UI specifics -> `../cloudbase-agent/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloudbase-agent/SKILL.md`)38- Web authentication for browser callers -> `../auth-web/SKILL.md` (standalone fallback: `https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-web/SKILL.md`)3940### Do NOT use for4142- Simple Event Function or HTTP Function workflows that fit the function model better.43- Frontend-only projects with no backend service.44- Database-schema design tasks.4546### Common mistakes / gotchas4748- Choosing CloudRun when the request only needs a normal cloud function.49- Forgetting to listen on the platform-provided `PORT`.50- Treating CloudRun as stateful app hosting and storing important state on local disk.51- Assuming local run is available for Container mode.52- Opening public access by default when the scenario only needs private or mini-program internal access.5354### Minimal checklist5556- Choose Function mode or Container mode explicitly.57- Confirm whether the service should be public, VPC-only, or mini-program internal.58- Keep the service stateless and externalize durable data.59- Use absolute paths for every local project path.6061## Overview6263Use CloudBase Run when the task needs a deployed backend service rather than a short-lived serverless function.6465### When CloudRun is a better fit6667- Long connections: WebSocket, SSE, server push68- Long-running request handling or persistent service processes69- Custom runtime environments or system libraries70- Arbitrary languages or frameworks71- Stable external service endpoints with elastic scaling72- AI Agent deployment on Function mode CloudRun7374## Mode selection7576| Dimension | Function mode | Container mode |77| --- | --- | --- |78| Best for | Fast start, Node.js service patterns, built-in framework, Agent flows | Existing containers, arbitrary runtimes, custom system dependencies |79| Port model | Framework-managed local mode, deployed service still follows platform rules | App must listen on injected `PORT` |80| Dockerfile | Not required | Required |81| Local run through tools | Supported | Not supported |82| Typical use | Streaming APIs, low-latency backend, Agent service | Custom language stack, migrated container app |8384## How to use this skill (for a coding agent)85861. **Choose mode first**87 - Function mode -> quickest path for HTTP/SSE/WebSocket or Agent scenarios88 - Container mode -> use when Docker/custom runtime is a real requirement89902. **Follow mandatory runtime rules**91 - Listen on `PORT`92 - Keep the service stateless93 - Put durable data in DB/storage/cache94 - Keep dependencies and image size small95 - Respect resource ratio guidance: `Mem = 2 × CPU`96973. **Use the correct tools**98 - Read operations -> `queryCloudRun`99 - Write operations -> `manageCloudRun`100 - Delete requires explicit confirmation and `force: true`101 - Always use absolute `targetPath`1021034. **Follow the deployment sequence**104 - Initialize or download code105 - For Container mode, verify Dockerfile106 - Local run when available107 - Configure access model108 - Deploy and verify detail output109110## Tool routing111112### Read operations113114- `queryCloudRun(action="list")` -> list services115- `queryCloudRun(action="detail")` -> inspect one service and its latest deploy status when available116- `queryCloudRun(action="templates")` -> see available starters117- `queryCloudRun(action="getDeployLog")` -> retrieve the latest deploy log or a specified `buildId`118119### Write operations120121- `manageCloudRun(action="init")` -> create local project122- `manageCloudRun(action="download")` -> pull remote code123- `manageCloudRun(action="run")` -> local run for Function mode124- `manageCloudRun(action="deploy")` -> deploy local project125- `manageCloudRun(action="delete")` -> delete service126- `manageCloudRun(action="createAgent")` -> create Agent service127128## Access guidance129130- **Web/public scenarios** -> enable WEB access intentionally and pair it with the right auth flow.131- **Mini Program** -> prefer internal direct connection and avoid unnecessary public exposure.132- **Private/VPC scenarios** -> keep public access off unless the product requirement clearly needs it.133134## Quick examples135136### Initialize137138```json139{ "action": "init", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc" }140```141142### Local run (Function mode)143144```json145{ "action": "run", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc", "runOptions": { "port": 3000 } }146```147148### Deploy149150```json151{152 "action": "deploy",153 "serverName": "my-svc",154 "targetPath": "/abs/ws/my-svc",155 "serverConfig": {156 "OpenAccessTypes": ["PUBLIC"],157 "Cpu": 0.5,158 "Mem": 1,159 "MinNum": 1,160 "MaxNum": 5161 }162}163```164165**Valid `OpenAccessTypes` values**: `OA` (办公网访问), `PUBLIC` (公网访问), `MINIAPP` (小程序访问), `VPC` (VPC访问). Use `PUBLIC` for web applications that need public HTTPS access.166167`MinNum: 1` is the recommended default when you want to reduce cold-start latency. If the user explicitly prefers lower cost and accepts more cold starts, explain the tradeoff and let them reduce `MinNum` to `0`.168169## Best practices1701711. Prefer PRIVATE/VPC or mini-program internal access when possible.1722. Use environment variables for secrets and per-environment configuration.1733. Verify configuration before and after deployment with `queryCloudRun(action="detail")`.1744. Keep startup work small to reduce cold-start impact.1755. For Agent scenarios, use the Agent SDK skill for protocol and adapter details instead of duplicating them here.176177## Troubleshooting hints178179- **Access failure** -> check access type, domain setup, and whether the instance scaled to zero.180- **Deployment failure** -> inspect Dockerfile, build logs, and CPU/memory ratio.181- **Local run failure** -> remember only Function mode is supported by local-run tools.182- **Performance issues** -> reduce dependencies, optimize initialization, and tune minimum instances.