cloud-functions
Complete guide for CloudBase cloud functions development - runtime selection, deployment, logging, invocation, and HTTP access configuration.
Install
mkdir -p .claude/skills/cloud-functions && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4885" && unzip -o skill.zip -d .claude/skills/cloud-functions && rm skill.zipInstalls to .claude/skills/cloud-functions
About this skill
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.
Read before writing code if
- The request mentions runtime, HTTP function,
scf_bootstrap, function logs, or function deployment.
Then also read
- Auth setup or provider-related backend work ->
../auth-tool/SKILL.md - AI in functions ->
../ai-model-nodejs/SKILL.md
Do NOT use for
- CloudRun container services or Web authentication UI implementation.
Common mistakes / gotchas
- Picking the wrong function type and trying to compensate later.
- Mixing Event Function code shape (
exports.main(event, context)) with HTTP Function code shape (req/reson port 9000). - 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.
- Forgetting that runtime cannot be changed after creation.
- Using cloud functions as the first solution for Web login.
- Forgetting that HTTP Functions do NOT auto-install dependencies — always include
node_modules. - Forgetting to add
app.use(express.json())or equivalent body parsing middleware for POST/PUT requests. - Leaving HTTP handlers without sending a response (causes request timeout).
- Not returning proper HTTP status codes (400, 401, 405) for error cases.
Minimal checklist
- Read Cloud Functions Execution Checklist before deployment or runtime changes.
Overview
Use this skill when developing, deploying, and managing CloudBase cloud functions. CloudBase supports two types of cloud functions:
- Event Functions (普通云函数): Traditional serverless functions triggered by events (SDK calls, timers)
- HTTP Functions (HTTP 云函数): Web service functions triggered by HTTP requests, supporting multiple languages
Writing mode at a glance
- If the request is for a normal CloudBase function triggered by SDK calls, timers, or other events, write an Event Function with
exports.main = async (event, context) => {}. - If the request is for an HTTP endpoint, REST API, SSE, or WebSocket service, write an HTTP Function that listens on port
9000and handlesreq/res. - If the user mentions HTTP access for an existing Event Function, keep the Event Function code shape and add gateway access separately.
When to use this skill
Use this skill for cloud function operations when you need to:
- Create and deploy Event Functions (Node.js)
- Create and deploy HTTP Functions (Node.js/Python/Go/Java)
- Understand runtime limitations and selection
- Query function logs and monitor execution
- Invoke cloud functions from applications
- Configure HTTP access for cloud functions
- Implement SSE (Server-Sent Events) or WebSocket
Do NOT use for:
- CloudRun backend services (use
cloudrun-developmentskill) - Complex container-based services (use
cloudrun-developmentskill) - Database operations (use database skills)
How to use this skill (for a coding agent)
-
Choose the right function type
- Event Function: For SDK calls, scheduled tasks, event-driven scenarios
- HTTP Function: For Web APIs, REST services, SSE/WebSocket, multi-language support
- If the prompt says "HTTP 云函数", use the HTTP Function model first; if it says "触发器云函数" or omits HTTP, default to the Event Function model.
-
Understand runtime limitations
- Runtime CANNOT be changed after function creation
- Must select correct runtime during initial creation
- If runtime needs to change, must delete and recreate function
-
Write code AND deploy — do not stop after writing files
- CRITICAL: After writing function code, you MUST also deploy it using
manageFunctions. Creating files locally without deploying is incomplete. - Use
manageFunctions(action="createFunction")to create AND deploy in one step - Provide
functionRootPathas the parent directory of the function folder (e.g.,/project/cloudfunctions/not/project/cloudfunctions/myFunction/) - Preferred MCP Tools: Use
queryFunctionsfor reads,manageFunctions(action="createFunction")for creation, andmanageFunctions(action="updateFunctionCode")for code updates - Legacy compatibility: If older prompts mention
createFunction/updateFunctionCode, map them to themanageFunctionsactions above - CLI: Use
tcb fn deploy(Event) ortcb fn deploy --httpFn(HTTP) only as a fallback when MCP tools are unavailable - In agent / non-interactive runs, never default to CLI login flows for deployment; keep the flow on
manageFunctions - For HTTP functions, create or update them through
manageFunctionswithfunc.type="HTTP"as the primary path - HTTP Functions require
scf_bootstrapfile in the function directory - Provide correct
functionRootPath(parent directory of function folder)
- CRITICAL: After writing function code, you MUST also deploy it using
-
Query logs properly
- Use
queryFunctions(action="listFunctionLogs")for log list (basic info) - Use
queryFunctions(action="getFunctionLogDetail")with RequestId for detailed logs - Legacy compatibility: Treat
getFunctionLogs/getFunctionLogDetailas the twoqueryFunctionsactions above - Note time range limitations (max 1 day interval)
- Use
-
Handle legacy tool names safely
- Prefer the converged entrances:
queryFunctions,manageFunctions,queryGateway,manageGateway - If old names appear in historical docs or prompts, convert them before acting:
getFunctionList->queryFunctionscreateFunction->manageFunctions(action="createFunction")updateFunctionCode->manageFunctions(action="updateFunctionCode")updateFunctionConfig->manageFunctions(action="updateFunctionConfig")getFunctionLogs->queryFunctions(action="listFunctionLogs")getFunctionLogDetail->queryFunctions(action="getFunctionLogDetail")manageFunctionTriggers->manageFunctions(action="createFunctionTrigger"|"deleteFunctionTrigger")readFunctionLayers->queryFunctions(action="listLayers"|"listLayerVersions"|"getLayerVersionDetail"|"listFunctionLayers")writeFunctionLayers->manageFunctions(action="createLayerVersion"|"deleteLayerVersion"|"attachLayer"|"detachLayer"|"updateFunctionLayers")createFunctionHTTPAccess->manageGateway(action="createAccess")
- Prefer the converged entrances:
Function Types Comparison
| Feature | Event Function (普通云函数) | HTTP Function (HTTP 云函数) |
|---|---|---|
| Trigger | Event-driven (SDK, timer) | HTTP request |
| Entry Point | exports.main = async (event, context) => {} | Web Server (Express/Flask/Gin etc.) |
| Port | No port required | Must listen on port 9000 |
| Bootstrap | Not required | Requires scf_bootstrap |
| Connection | Short connection | Supports long connection |
| Languages | Node.js only | Node.js, Python, Go, Java |
| Protocols | N/A | HTTP, SSE, WebSocket |
| Use Cases | Event processing, scheduled tasks | Web APIs, REST services, real-time streaming |
Core Knowledge - Event Functions
Runtime Environment
⚠️ CRITICAL: Runtime cannot be modified after function creation
Once a cloud function is created with a specific runtime, the runtime cannot be changed. If you need a different runtime:
- Delete the existing function
- Create a new function with the desired runtime
Supported Node.js Runtimes:
Nodejs18.15(Default, Recommended)Nodejs16.13Nodejs14.18Nodejs12.16Nodejs10.15Nodejs8.9
Runtime Selection Guidelines:
- Use
Nodejs18.15for new projects (default, most modern) - Choose older versions only if dependencies require specific Node.js versions
- Consider security updates and support lifecycle
- Test thoroughly with selected runtime before deployment
Event Function Structure
Event functions require:
-
Function Directory: Contains function code
- Must have
index.js(or specified entry file) - Must export handler:
exports.main = async (event, context) => {} - Include
package.jsonwith dependencies
- Must have
-
Function Root Path: Parent directory containing function directories
- Example: If function is at
/project/cloudfunctions/myFunction/ functionRootPathshould be/project/cloudfunctions/- Important: Do NOT include function name in root path
- Example: If function is at
-
Entry Point: Default is
index.jswithexports.main- Can be customized via
handlerparameter
- Can be customized via
Event Function Deployment
Creating New Functions:
Use manageFunctions(action="createFunction") (see MCP tool documentation for full parameter list):
- Important: Always specify
func.runtimeexplicitly (defaults toNodejs18.15) - Provide
functionRootPathas parent directory of function folders (absolute path) - Use
force=trueto overwrite existing function - Legacy compatibility: If an older prompt says
createFunction, keep the same payload but send it throughmanageFunctions
Updating Function Code:
Use manageFunctions(action="updateFunctionCode"):
- ⚠️ Note: Only updates code, cannot change runtime
- If runtime needs to change, delete and recreate function
- Legacy compatibility: If an older prompt says
updateFunctionCode, map it to thismanageFunctionsaction
Deployment Best Practices:
- Always specify runtime explicitly when creating functions
- Use absolute paths for
functionRootPath - Don't upload node_modules - dependencies installed automatically
- Test locally before deployment when possible
- Use environment variables for configuration, not hardcoded values
Core Knowledge - HTTP Functions
HTTP Function Overview
HTTP Functions are optimized for Web service scenarios, supporting standard HTTP request/response patterns.
**HTTP Function codi
Content truncated.
More by TencentCloudBase
View all skills by TencentCloudBase →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.
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."
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.
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.
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.
pdf-to-markdown
aliceisjustplaying
Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.
Related MCP Servers
Browse all serversDeploy, monitor, and manage cloud based DBMS and cloud database management tasks on Tencent CloudBase with AI-powered to
Deploy, monitor, and manage full-stack apps on Tencent CloudBase—tools for cloud environments, databases, functions, hos
Effortlessly deploy static sites with EdgeOne Pages—an easy, scalable alternative to Amazon website hosting for fast, re
Integrate with Google Drive and GCloud Storage via Google Cloud Platform for seamless access to Compute Engine, BigQuery
Send customizable push notifications for websites using Ntfy, a web push service for cloud messages and real-time task a
Easily manage serverless functions with Alibaba Cloud Function Compute, enabling multi-language runtime, custom domains,
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.