cloudrun-development

7
0
Source

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.

Install

mkdir -p .claude/skills/cloudrun-development && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2417" && unzip -o skill.zip -d .claude/skills/cloudrun-development && rm skill.zip

Installs to .claude/skills/cloudrun-development

About this skill

When to use this skill

Use this skill for CloudBase Run backend service development when you need:

  • Long connection capabilities: WebSocket / SSE / server push
  • Long-running or persistent processes: tasks that are not suitable for cloud functions, background jobs
  • Custom runtime environments/system dependencies: custom images, specific system libraries
  • Multi-language/arbitrary frameworks: Java, Go, PHP, .NET, Python, Node.js, etc.
  • Stable external services with elastic scaling: pay-as-you-go, can scale down to 0
  • Private/internal network access: VPC/PRIVATE access, mini-program callContainer internal direct connection
  • AI agent development: develop personalized AI applications based on Function mode CloudRun

Do NOT use for:

  • Simple cloud functions (use cloud function development instead)
  • Frontend-only applications
  • Database schema design (use data-model-creation skill)

How to use this skill (for a coding agent)

  1. Choose the right mode

    • Function mode: Fastest to get started, built-in HTTP/WebSocket/SSE, fixed port 3000, local running supported
    • Container mode: Any language and runtime, requires Dockerfile, local running not supported by tools
  2. Follow mandatory requirements

    • Must listen on PORT environment variable (real port in container)
    • Stateless service: write data externally (DB/storage/cache)
    • No background persistent threads/processes outside requests
    • Minimize dependencies, slim images; reduce cold start and deployment time
    • Resource constraints: Mem = 2 × CPU (e.g., 0.25 vCPU → 0.5 GB)
    • Access control: Only enable public network for Web scenarios; mini-programs prioritize internal direct connection, recommend closing public network
  3. Use tools correctly

    • Read operations: queryCloudRun (list, detail, templates)
    • Write operations: manageCloudRun (init, download, run, deploy, delete, createAgent)
    • Always use absolute paths for targetPath
    • Use force: true for delete operations
  4. Follow the workflow

    • Initialize project → Check/generate Dockerfile (for container mode) → Local run (function mode only) → Configure access → Deploy → Verify

CloudBase Run AI Development Rules

A concise guide for AI assistants and engineering collaboration, providing "when to use, how to use" rules and tool workflows.

1. When to use CloudBase Run (Use Cases)

  • Need long connection capabilities: WebSocket / SSE / server push
  • Need long-running or persistent processes: tasks that are not suitable for cloud functions, background jobs
  • Need custom runtime environments/system dependencies: custom images, specific system libraries
  • Use multi-language/arbitrary frameworks: Java, Go, PHP, .NET, Python, Node.js, etc.
  • Need stable external services with elastic scaling: pay-as-you-go, can scale down to 0
  • Need private/internal network access: VPC/PRIVATE access, mini-program callContainer internal direct connection
  • Need to develop AI agents: develop personalized AI applications based on Function mode CloudRun

2. Mode Selection (Quick Comparison)

  • Function mode: Fastest to get started, built-in HTTP/WebSocket/SSE, fixed port 3000; local running supported by tools
  • Container mode: Any language and runtime, requires Dockerfile; local running not supported by tools

Mode Comparison Checklist

DimensionFunction ModeContainer Mode
Language/FrameworkNode.js (via @cloudbase/functions-framework)Any language/runtime (Java/Go/PHP/.NET/Python/Node.js, etc.)
RuntimeFunction framework loads functions (Runtime)Docker image starts process
PortFixed 3000Application listens on PORT (injected by platform during deployment)
DockerfileNot requiredRequired (and must pass local build)
Local RunningSupported (built-in tools)Not supported (recommend using Docker for debugging)
Typical ScenariosWebSocket/SSE/streaming responses, forms/files, low latency, multiple functions per instance, shared memoryArbitrary system dependencies/languages, migrating existing containerized applications

3. Development Requirements (Must Meet)

  • Must listen on PORT environment variable (real port in container)
  • Stateless service: write data externally (DB/storage/cache)
  • No background persistent threads/processes outside requests
  • Minimize dependencies, slim images; reduce cold start and deployment time
  • Resource constraints: Mem = 2 × CPU (e.g., 0.25 vCPU → 0.5 GB)
  • Access control: Only enable public network for Web scenarios; mini-programs prioritize internal direct connection, recommend closing public network

4. Tools (Plain Language & Read/Write Separation)

  • Read operations (queryCloudRun):
    • list: What services do I have? Can filter by name/type
    • detail: Current configuration, version, access address of a service
    • templates: Ready-to-use starter templates
  • Write operations (manageCloudRun):
    • init: Create local project (optional template)
    • download: Pull existing service code to local
    • run: Run locally (Function mode only, supports normal function and Agent mode)
    • deploy: Deploy local code to CloudRun
    • delete: Delete service (requires explicit confirmation)
    • createAgent: Create AI agent (based on Function mode CloudRun)
  • Important parameters (remember these):
    • targetPath: Local directory (must be absolute path)
    • serverConfig: Deployment parameters (CPU/Mem/instance count/access type/environment variables, etc.)
    • runOptions: Local running port and temporary environment variables (Function mode), supports runMode: 'normal' | 'agent'
    • agentConfig: Agent configuration (agentName, botTag, description, template)
    • Delete must include force: true, otherwise it won't execute

5. Core Workflow (Understand Steps First, Then Examples)

  1. Choose mode

    • Need multi-language/existing container/Docker: choose "Container mode"
    • Need long connection/streaming/low latency/multiple functions coexisting: prioritize "Function mode"
  2. Initialize local project

    • General: Use template init (both Function mode and Container mode can start from templates)
    • Container mode must "check or generate Dockerfile":
      • Node.js minimal example:
        FROM node:18-alpine
        WORKDIR /app
        COPY package*.json ./
        RUN npm ci --omit=dev
        COPY . .
        ENV NODE_ENV=production
        EXPOSE 3000
        CMD ["node","server.js"]
        
      • Python minimal example:
        FROM python:3.11-slim
        WORKDIR /app
        COPY requirements.txt ./
        RUN pip install -r requirements.txt --no-cache-dir
        COPY . .
        ENV PORT=3000
        EXPOSE 3000
        CMD ["python","app.py"]
        
  3. Local running (Function mode only)

    • Automatically use npm run dev/start or entry file via run
  4. Configure access

    • Set OpenAccessTypes (WEB/VPC/PRIVATE) as needed; configure security domain and authentication for Web scenarios
  5. Deploy

    • Specify CPU/Mem/instance count/environment variables, etc. during deploy
  6. Verify

    • Use detail to confirm access address and configuration meet expectations

Example Tool Calls

  1. View templates/services
{ "name": "queryCloudRun", "arguments": { "action": "templates" } }
{ "name": "queryCloudRun", "arguments": { "action": "detail", "detailServerName": "my-svc" } }
  1. Initialize project
{ "name": "manageCloudRun", "arguments": { "action": "init", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc", "template": "helloworld" } }
  1. Download code (optional)
{ "name": "manageCloudRun", "arguments": { "action": "download", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc" } }
  1. Local running (Function mode only)
{ "name": "manageCloudRun", "arguments": { "action": "run", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc", "runOptions": { "port": 3000 } } }
  1. Deploy
{ "name": "manageCloudRun", "arguments": { "action": "deploy", "serverName": "my-svc", "targetPath": "/abs/ws/my-svc", "serverConfig": { "OpenAccessTypes": ["WEB"], "Cpu": 0.5, "Mem": 1, "MinNum": 0, "MaxNum": 5 } } }
  1. Create AI agent (optional)
{ "name": "manageCloudRun", "arguments": { "action": "createAgent", "serverName": "my-agent", "targetPath": "/abs/ws/agents", "agentConfig": { "agentName": "MyAgent", "botTag": "demo", "description": "My agent", "template": "blank" } } }
  1. Run agent (optional)
{ "name": "manageCloudRun", "arguments": { "action": "run", "serverName": "my-agent", "targetPath": "/abs/ws/agents/my-agent", "runOptions": { "port": 3000, "runMode": "agent" } } }

6. Best Practices (Strongly Recommended)

  • Prioritize PRIVATE/VPC or mini-program internal callContainer, reduce public network exposure
  • Web must use CloudBase Web SDK authentication; mini-programs authenticated by platform
  • Secrets via environment variables; separate configuration for multiple environments (dev/stg/prod)
  • Use queryCloudRun.detail to verify configuration and accessibility before and after deployment
  • Image layers reusable, small volume; monitor startup latency and memory usage
  • Agent development: Use @cloudbase/aiagent-framework, supports SSE streaming responses, BotId format is ibot-{name}-{tag}

7. Quick Troubleshooting

  • Access failure: Check OpenAccessTypes/domain/port, whether instance scaled down to 0
  • Deployment failure: Verify Dockerfile/build logs/image volume and CPU/Mem ratio
  • Local running failure: Only Function mode supported; requires package.json dev/start or entry index.js|app.js|server.js
  • Performance jitter: Reduce dependencies and initialization; appropriately increase MinNum; optimize cold start
  • **Agent

Content truncated.

spec-workflow

TencentCloudBase

Standard software engineering workflow for requirement analysis, technical design, and task planning. Use this skill when developing new features, complex architecture designs, multi-module integrations, or projects involving database/UI design.

773

auth-web-cloudbase

TencentCloudBase

CloudBase Web Authentication Quick Guide - Provides concise and practical Web frontend authentication solutions with multiple login methods and complete user management.

30

ai-model-nodejs

TencentCloudBase

Use this skill when developing Node.js backend services or CloudBase cloud functions (Express/Koa/NestJS, serverless, backend APIs) that need AI capabilities. Features text generation (generateText), streaming (streamText), AND image generation (generateImage) via @cloudbase/node-sdk ≥3.16.0. Built-in models include Hunyuan (hunyuan-2.0-instruct-20251111 recommended), DeepSeek (deepseek-v3.2 recommended), and hunyuan-image for images. This is the ONLY SDK that supports image generation. NOT for browser/Web apps (use ai-model-web) or WeChat Mini Program (use ai-model-wechat).

00

cloud-functions

TencentCloudBase

Complete guide for CloudBase cloud functions development - runtime selection, deployment, logging, invocation, and HTTP access configuration.

00

auth-wechat-miniprogram

TencentCloudBase

Complete guide for WeChat Mini Program authentication with CloudBase - native login, user identity, and cloud function integration.

00

data-model-creation

TencentCloudBase

Optional advanced tool for complex data modeling. For simple table creation, use relational-database-tool directly with SQL statements.

00

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318398

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

451339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.