name: aliyun-fc-serverless
kind: tool-skill
version: 1.0.0
tags:
- domain: tools
- subtype: aliyun-fc-serverless
- level: expert
description: 阿里云函数计算FC:Serverless函数开发、触发器配置、事件驱动。Use when building serverless applications with Aliyun Function Compute. Triggers: '函数计算', 'FC', 'Serverless', '阿里云函数'. Works with: Claude Code, Codex, OpenCode, Cursor, Cline, OpenClaw, Kimi.
license: MIT
metadata:
author: theNeoAI lucas_hsueh@hotmail.com
Aliyun Function Compute Expert
Decision Framework
| Use Case | Trigger Type | Notes |
|---|
| API | HTTP Trigger | Direct invocation |
| File Processing | OSS Trigger | On upload/event |
| Scheduled Tasks | Timer Trigger | Cron expression |
| Data Pipeline | Event Bridge | Complex events |
| Image Processing | CDN Callback | Edge events |
Thinking Patterns
| Pattern | When to Use | Approach |
|---|
| First-Principles | Novel problems | Break down to fundamentals |
| Pattern Matching | Known scenarios | Apply proven templates |
| Constraint Optimization | Resource limits | Maximize within bounds |
| Systems Thinking | Complex interactions | Consider holistic impact |
§ 2 · What This Skill Does
- 函数开发 — 编写FC函数
- 触发器 — 事件驱动
- 监控 — 日志和调用
§ 3 · Platform Support
[URL]: https://raw.githubusercontent.com/theneoai/awesome-skills/main/skills/tools/cn-cloud/aliyun/aliyun-fc-serverless.md
§ 4 · Pricing
| 计费项 | 价格 |
|---|
| 调用次数 | ¥0.2/百万次 |
| 执行时间 | ¥0.000111046/GB-秒 |
| 流量 | 免费 |
§ 5 · Supported Runtimes
| 语言 | 运行时 |
|---|
| Python | Python 3.9/3.10 |
| Node.js | Node.js 16/18/20 |
| Java | Java 11/17 |
| PHP | PHP 8.1 |
| Go | Go 1.x |
§ 6 · Standards & Reference
6.1 Python函数示例
import json
def handler(event, context):
logger = context.logger
logger.info("Function started")
body = json.loads(event)
result = {"status": "success", "data": body}
return {"statusCode": 200, "body": json.dumps(result)}
6.2 触发器配置
| 配置项 | 说明 |
|---|
| 触发方式 | 同步/异步 |
| InvocationRole | 触发器角色 |
| 过滤规则 | 事件过滤 |
§ 7 · Risk Disclaimer
| 风险 | 级别 | 建议 |
|---|
| 超时 | 🟡 | 设置合理超时时间 |
| 并发限制 | 🟡 | 了解配额 |
| 冷启动 | 🟡 | 使用预付费实例 |
9.1 图片处理
User: "上传图片到OSS后自动压缩"
Expert:
- 创建函数处理图片
- 配置OSS触发器(上传触发)
- 使用Pillow处理图片
- 输出到另一个OSS bucket
代码示例:
def handler(event, context):
from PIL import Image
import oss2
9.2 定时任务
User: "每天凌晨备份数据库"
Expert:
- 创建函数执行备份
- 配置Timer触发器
- Cron表达式:
0 0 2 * * *(每天2点)
- 使用RDS SDK备份到OSS
9.3 API网关集成
User: "暴露函数为HTTP API"
Expert:
- 创建HTTP触发器
- 配置路由:GET /api/users
- 可选:配置JWT鉴权
- 获取公网访问地址
§ 8 · Workflow
Phase 1: Discovery & Assessment
| Done | Phase completed |
| Fail | Criteria not met |
Objective: Fully understand the problem context and requirements.
| Done | All tasks completed |
| Fail | Tasks incomplete |
Key Activities:
- Context Gathering — Collect relevant background information and data
- Stakeholder Mapping — Identify all affected parties and their needs
- Requirements Definition — Document explicit and implicit requirements
- Constraint Analysis — Identify limitations, boundaries, and dependencies
✓ Done Criteria:
- [✓] Problem statement clearly defined and documented
- [✓] All stakeholders identified and engaged
- [✓] Success metrics established and agreed upon
- [✓] Constraints documented and acknowledged
✗ Fail Criteria:
- [✗] Requirements remain ambiguous or undefined
- [✗] Critical stakeholders excluded from process
- [✗] Success criteria not measurable
- [✗] Constraints ignored or violated
Phase 2: Analysis & Strategy
| Done | Phase completed |
| Fail | Criteria not met |
Objective: Develop a comprehensive solution strategy.
| Done | All tasks completed |
| Fail | Tasks incomplete |
Key Activities:
- Root Cause Analysis — Identify underlying issues (5 Whys, Fishbone)
- Option Generation — Develop multiple solution alternatives
- Risk Assessment — Evaluate potential risks and mitigation strategies
- Resource Planning — Define required resources, timeline, and budget
✓ Done Criteria:
- [✓] Root causes identified and validated
- [✓] At least 3 solution options evaluated with trade-offs
- [✓] Risks assessed with mitigation plans
- [✓] Resources and timeline committed
✗ Fail Criteria:
- [✗] Addressing symptoms, not root causes
- [✗] Only one solution considered
- [✗] Risks ignored or underestimated
- [✗] Insufficient resources allocated
Phase 3: Implementation & Execution
| Done | Phase completed |
| Fail | Criteria not met |
Objective: Execute the chosen solution with quality and efficiency.
| Done | All tasks completed |
| Fail | Tasks incomplete |
Key Activities:
- Detailed Planning — Create actionable implementation plan
- Progress Tracking — Monitor milestones and deliverables
- Quality Assurance — Validate outputs meet standards
- Communication — Keep stakeholders informed
✓ Done Criteria:
- [✓] All planned activities completed
- [✓] Stakeholders informed at each milestone
- [✓] Quality checkpoints passed
- [✓] Documentation current and complete
✗ Fail Criteria:
- [✗] Activities rushed or skipped
- [✗] Stakeholders surprised by changes
- [✗] Quality issues discovered late
- [✗] Documentation missing or outdated
Phase 4: Review & Optimization
| Done | Phase completed |
| Fail | Criteria not met |
Objective: Validate results and capture learnings.
| Done | All tasks completed |
| Fail | Tasks incomplete |
Key Activities:
- Outcome Evaluation — Measure against success criteria
- Feedback Collection — Gather stakeholder input
- Lessons Learned — Document insights and improvements
- Knowledge Transfer — Share findings with organization
✓ Done Criteria:
- [✓] Success metrics achieved or understood
- [✓] Feedback incorporated for future work
- [✓] Lessons documented and shared
- [✓] Knowledge artifacts created
✗ Fail Criteria:
- [✗] Success criteria not measured
- [✗] Feedback ignored or dismissed
- [✗] Same mistakes likely to recur
- [✗] Knowledge lost or siloed
§ 9 · Scenario Examples
Scenario 1: Initial Consultation
Context:
A new client or stakeholder needs expert guidance on a aliyun fc serverless matter.
User Input:
"I'm new to this area and need help understanding [specific problem]. Where should I start?"
Expert Response:
Welcome! I'm here to help you navigate this aliyun fc serverless challenge effectively. Let me start by understanding your situation better.
1. Assessment Questions:
- What is your current level of experience with this topic?
- What are your immediate goals or deadlines?
- Do you have any specific constraints (budget, resources, timeline)?
- Who else is involved in this project?
2. Initial Guidance:
Based on typical patterns, I recommend we start with:
- Phase 1: Assessment — Clearly define what success looks like
- Phase 2: Strategy — Develop a tailored approach
- Phase 3: Execution — Implement with proper checkpoints
3. Next Steps:
Please share more details about your specific situation, and I'll provide targeted recommendations.
Scenario 2: Complex Problem Solving
Context:
An urgent, complex aliyun fc serverless issue requires immediate expert intervention.
User Input:
"We have a critical situation: [describe urgent problem]. We need a solution within [timeframe]."
Expert Response:
I understand the urgency. Let's work through this systematically to ensure we don't miss critical elements.
1. Triage (First 5 minutes):
[Urgency Assessment]
- Impact Level: [Critical/High/Medium/Low]
- Time Critical: [Yes/No]
- Reversibility: [Reversible/Irreversible]
2. Immediate Stabilization:
If this is a "bleeding" situation, immediate actions:
- [Stabilization action 1]
- [Stabilization action 2]
- [Communication to stakeholders]
3. Root Cause Analysis:
Once stabilized, let's understand what caused this:
[5 Whys Analysis]
Why did this happen? → [Answer]
Why did [Answer]? → [Answer]
Continue until root cause identified...
4. Solution Development:
Based on root cause, here are 3 options:
| Option | Approach | Risk | Effort | Timeline |
|---|
| A | Quick fix | High | Low | 1 day |
| B | Balanced | Medium | Medium | 1 week |
| C | Complete | Low | High | 1 month |
Recommendation: [Specific recommendation with rationale]
Scenario 3: Strategic Planning
Context:
Long-term aliyun fc serverless strategy development for sustained excellence.
User Input:
"We want to build world-class capability in aliyun fc serverless. What's our roadmap?"
Expert Response:
Building world-class capability is a journey. Here's a strategic framework:
Phase 1: Foundation (Months 1-3)
Goals:
- Establish baseline assessment
- Define capability maturity model
- Identify quick wins
Key Activities:
□ Comprehensive assessment
□ Best practice research
□ Team skill mapping
□ Quick win identification
Milestone: Foundation Report + Quick Win Implementation
Phase 2: Acceleration (Months 4-9)
Goals:
- Implement core systems
- Upskill team members
- Establish metrics and KPIs
Key Activities:
□ System implementation
□ Training programs
□ Process standardization
□ Performance tracking
Milestone: Operational Excellence Framework
Phase 3: Optimization (Months 10-18)
Goals:
- Continuous improvement culture
- Advanced methodology adoption
- Innovation integration
Key Activities:
□ Maturity assessment
□ Advanced techniques
□ Innovation pipeline
□ Knowledge management
Milestone: World-Class Capability Certification
Success Metrics:
| Dimension | Baseline | 6 Months | 12 Months | 18 Months |
|---|
| Efficiency | X% | +20% | +40% | +60% |
| Quality | X defects | -30% | -50% | -70% |
| Speed | X days | -25% | -40% | -50% |
| Innovation | 0/year | 2/year | 5/year | 10/year |
Investment Required:
- Human Capital: [FTE estimates]
- Financial: [Budget ranges]
- Timeline: [Phased commitment]
Risk Mitigation:
🔴 High Risk: [Risk] → Mitigation: [Action]
🟡 Medium Risk: [Risk] → Mitigation: [Action]
🟢 Low Risk: [Risk] → Mitigation: [Action]
Scenario 4: Quality Assurance & Review
Context:
Project or deliverable requires quality verification and optimization.
User Input:
"Can you review our [deliverable] and help us improve quality before final delivery?"
Expert Response:
Absolutely. Let me conduct a comprehensive quality review using established frameworks.
1. Quality Checklist:
2. Gap Analysis:
| Aspect | Current | Target | Gap | Priority |
|---|
| Completeness | 80% | 100% | 20% | High |
| Accuracy | 90% | 100% | 10% | High |
| Usability | 70% | 95% | 25% | Medium |
3. Improvement Plan:
- Immediate fixes (Today): [List]
- Short-term (This week): [List]
- Long-term (Next month): [List]
4. Final Validation:
Before sign-off, ensure:
- ✓ All acceptance criteria met
- ✓ Stakeholder approval obtained
- ✓ Handover documentation ready
§ 10 · Edge Cases
| 场景 | 解决方案 |
|---|
| 冷启动慢 | 使用_custom runtime_或预留实例 |
| 大文件处理 | 使用OSS直接处理 |
| 长时任务 | 使用异步调用+消息队列 |
| 依赖过大 | 使用层(Layers)管理依赖 |
§ 11 · Performance Optimization
| 优化项 | 方法 |
|---|
| 内存 | 合理配置,避免过大 |
| 并发 | 配置实例并发度 |
| 预热 | 使用预付费实例 |
| 依赖 | 使用层减小包体积 |
§ 12 · Scope & Limitations
In Scope:
- Function Compute function development
- Trigger configuration (HTTP, OSS, Timer, etc.)
- Performance optimization
- Cold start handling
- Integration with other Aliyun services
Out of Scope:
- Complex microservices architecture
- Long-running processes (>10 min)
- Stateful applications
- GPU-intensive workloads
§ 14 · Quality Verification
→ See references/standards.md §7.10 for full checklist
§ 20 · Case Studies
Success Story 1: Transformation
Challenge: Legacy system limitations
Results: 40% performance improvement, 50% cost reduction
Success Story 2: Innovation
Challenge: Market disruption
Results: New revenue stream, competitive advantage
Anti-Patterns
| Pattern | Avoid | Instead |
|---|
| Generic | Vague claims | Specific data |
| Skipping | Missing validations | Full verification |