leoyeai/agent-master-skills/cloud-functions
Claude Code and agent skill by leoyeai/agent-master-skills
- community
Checking that the SKILL.md file is still in the repository.
Complete guide for CloudBase cloud functions development - supports both Event Functions (Node.js) and HTTP Functions (multi-language Web services). Covers runtime selection, deployment, logging, invocation, scf_bootstrap, SSE, WebSocket, and HTTP access configuration.
Install
npx vskill@latest install leoyeai/agent-master-skills/cloud-functionsSKILL.md
Cloud Functions Development
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
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
- 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
- Deploy functions correctly
- MCP Tool: Use
createFunctionwithtype: "Event"ortype: "HTTP" - CLI: Use
tcb fn deploy(Event) ortcb fn deploy --httpFn(HTTP) - HTTP Functions require
scf_bootstrapfile in the function directory - Provide correct
functionRootPath(parent directory of function folder)
- Query logs properly
- Use
getFunctionLogsfor log list (basic info) - Use
getFunctionLogDetailwith RequestId for detailed logs - Note time range limitations (max 1 day interval)
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.15` for 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
- 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
- Entry Point: Default is
index.jswithexports.main
- Can be customized via
handlerparameter
Event Function Deployment
Creating New Functions:
Use createFunction tool (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
Updating Function Code:
Use updateFunctionCode tool:
- ⚠️ Note: Only updates code, cannot change runtime
- If runtime needs to change, delete and recreate function
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.
Key Characteristics:
- Must listen on port 9000 (platform requirement)
- Requires
scf_bootstrapstartup script - Supports multiple languages: Node.js, Python, Go, Java
- Supports HTTP, SSE, WebSocket protocols
scf_bootstrap Startup Script
⚠️ CRITICAL: HTTP Functions require `scf_bootstrap` file
| Requirement | Description | |
|---|---|---|
| File name | Must be exactly scf_bootstrap (no extension) | |
| Permission | Must have execute permission (chmod +x scf_bootstrap) | |
| Port | Must start server on port 9000 | |
| Line endings | Must use LF (Unix), not CRLF (Windows) |
Examples:
HTTP Function Structure & Example
Node.js Example (Express):
HTTP Function Deployment
MCP Tool:
CLI:
⚠️ Notes:
- Function type cannot be changed after creation
- HTTP Functions do NOT auto-install dependencies; include
node_modulesor use layers
Invoking HTTP Functions
Method 1: HTTP API (with Access Token)
⚠️ Must include `webfn=true` parameter
Method 2: HTTP Access Service (Custom Domain)
Use createFunctionHTTPAccess MCP tool to configure HTTP access:
| Method | Auth Required | Use Case | |
|---|---|---|---|
HTTP API (?webfn=true) | Yes (Bearer Token) | Server-to-server | |
| HTTP Access Service | Optional | Browser, public APIs |
SSE & WebSocket Support
SSE (Server-Sent Events): Enabled by default, for server-to-client streaming (AI chat, progress updates).
WebSocket: Enable via protocolType: "WS" in createFunction. For bidirectional real-time communication.
| Limit | Value | |
|---|---|---|
| Idle timeout | 10 - 7200 seconds | |
| Max message size | 256KB |
Function Logs
Querying Logs:
Primary Method: Use getFunctionLogs and getFunctionLogDetail tools (see MCP tool documentation).
Alternative Method (Plan B): If tools unavailable, use callCloudApi:
- Get Log List - Use
GetFunctionLogsaction:
- Get Log Details - Use
GetFunctionLogDetailaction (requires LogRequestId from step 1):
Log Query Limitations:
Offset + Limitcannot exceed 10000StartTimeandEndTimeinterval cannot exceed 1 day- Use pagination for large time ranges
Log Query Best Practices:
- Query logs within 1-day windows
- Use RequestId for specific invocation debugging
- Combine list and detail queries for comprehensive debugging
- Check logs after deployment to verify function behavior
Invoking Event Functions
From Web Applications:
From Mini Programs:
From Node.js Backend:
From HTTP API:
Use CloudBase HTTP API to invoke event functions:
- Endpoint:
https://{envId}.api.tcloudbasegateway.com/v1/functions/{functionName} - Requires authentication token (Bearer Token)
- See
http-apiskill for details
HTTP Access Configuration (for Event Functions)
HTTP Access vs HTTP API:
- HTTP API: Uses CloudBase API endpoint with authentication token
- HTTP Access: Creates direct HTTP/HTTPS endpoint for standard REST API access without SDK
Creating HTTP Access:
Primary Method: Use createFunctionHTTPAccess tool (see MCP tool documentation).
Alternative Method (Plan B): If tool unavailable, use callCloudApi with CreateCloudBaseGWAPI:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cloudbase/references/cloud-functions/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/leoyeai/agent-master-skills/cloud-functions)