Install
$ agentstack add skill-cosmicstack-labs-mercury-agent-skills-serverless-patterns ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Serverless Patterns
Build scalable serverless applications.
Core Patterns
Function Design
- Single responsibility per function
- Stateless (use external storage for state)
- Idempotent handlers (retry-safe)
- Receive event, process, return/forward
Cold Start Mitigation
| Strategy | Effect | Tradeoff | |----------|--------|----------| | Provisioned Concurrency | Zero cold starts | Cost | | Smaller runtime (Node/Python) | Faster start | Language choice | | Keep-alive ping | Reduce frequency | Extra cost | | Lambda SnapStart (Java) | Fast restore | State constraints | | Lambda@Edge | Regional distribution | 1MB response limit |
Event-Driven Design
Event Types
Events:
- UserRegistered { userId, email, timestamp }
- OrderPlaced { orderId, items, total }
- PaymentProcessed { orderId, amount, status }
- EmailSent { to, template, variables }
SQS + Lambda Pattern
API Gateway → Lambda (producer) → SQS → Lambda (consumer) → DynamoDB
Benefits: decoupling, buffering, retry, dead-letter queue.
API Gateway Patterns
- Request validation at gateway level
- Caching for GET endpoints (TTL per route)
- WAF for rate limiting and IP blocks
- Custom domain with ACM certificate
- Usage plans for API keys
Frameworks
- SAM (AWS) — YAML/YML, local testing
- Serverless Framework — Multi-cloud, plugins
- CDK (AWS) — Full programming languages
- Terraform — If already using for other infra
- Chalice (Python) — Flask-like, AWS only
Best Practices
- Function timeout: max 30s for APIs, 15min for background
- Memory: allocate more = more CPU (for compute-heavy, use 1.7GB+)
- Monitor: Duration, Invocations, Error count, Throttles
- Logs: structured JSON to CloudWatch
- Security: least-privilege IAM roles per function
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: cosmicstack-labs
- Source: cosmicstack-labs/mercury-agent-skills
- License: MIT
- Homepage: https://skills.mercuryagent.sh
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.