用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ffsshhttiikk/opencode-agents-skills --skill serverless命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | serverless |
| description | Serverless computing architecture |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"developer, devops-engineer","category":"devops"} |
# Lambda handler
import json
import boto3
def lambda_handler(event, context):
# Parse the event
http_method = event['httpMethod']
path = event['path']
# Business logic
if http_method == 'GET' and path == '/users':
return {
'statusCode': 200,
'body': json.dumps({'users': []}),
'headers': {'Content-Type': 'application/json'}
}
return {
'statusCode': 404,
'body': json.dumps({'error': 'Not found'})
}
# Lambda layers for dependencies
# Layer structure:
# python/lib/python3.11/site-packages/
# serverless.yml
service: my-serverless-app
provider:
name: aws
runtime: python3.11
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-1'}
environment:
TABLE_NAME: !Ref UsersTable
STRIPE_KEY: ${env:STRIPE_KEY}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
Resource: !GetAtt UsersTable.Arn
functions:
users:
handler: handler.get_users
events:
- http:
path: /users
method: get
cors: true
- http:
path: /users/{userId}
method: get
// Azure Function with triggers
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
const name = (req.query.name || (req.body && req.body.name));
if (name) {
context.res = {
status: 200,
body: { message: `Hello, ${name}` }
};
} else {
context.res = {
status: 400,
body: { error: "Please pass a name" }
};
}
};
// bindings.json
{
"bindings": [
{
"name": "req",
"type": "httpTrigger",
"direction": "in",
"authLevel": "function"
},
{
"name": "$return",
"type": "http",
"direction": "out"
}
]
}
// Cloud Function 2nd Gen
const { CloudEvent, CloudFunction } = require('@google-cloud/functions-framework');
exports.processEvent = CloudEvent(async (cloudEvent) => {
const data = cloudEvent.data;
console.log('Event ID:', cloudEvent.id);
console.log('Event Type:', cloudEvent.type);
console.log('Data:', data);
// Process the event
await processData(data);
return { success: true };
});
// HTTP Function
exports.httpFunction = async (req, res) => {
const name = req.query.name || req.body.name || 'World';
res.send(`Hello, ${name}!`);
};
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ S3 │────►│ Lambda │────►│ DynamoDB │
│ (Upload) │ │ (Process) │ │ (Store) │
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐
│ SNS │
│ (Notify) │
└─────────────┘
# AWS DynamoDB access
import boto3
from boto3.dynamodb.conditions import Key
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('users')
def get_user(user_id):
response = table.get_item(Key={'user_id': user_id})
return response.get('Item')
def query_users_by_org(org_id):
response = table.query(
KeyConditionExpression=Key('org_id').eq(org_id)
)
return response['Items']