serverless

Implements AWS Lambda functions and event-driven serverless architectures with best practices.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/Dazlarus/karl-code --skill serverless-dazlarus
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: serverless
Source: https://github.com/Dazlarus/karl-code/tree/main/.agents/skills/serverless
Command: npx skills add https://github.com/Dazlarus/karl-code --skill serverless-dazlarus

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires boto3.

What problem does it solve? Writing AWS Lambda functions and event-driven architectures involves many pitfalls: non-idempotent handlers, missing error handling, hardcoded configuration, and incorrect API Gateway or SQS/S3 event integration. This Skill provides proven patterns and code templates for building serverless applications correctly. ## Core Features & Use Cases - Lambda Function Patterns: Idempotent, stateless handler design with environment variable configuration and structured error handling for services like DynamoDB. - Event-Driven Integrations: Ready-to-use code for S3 event triggers, SQS batch message processing, and API Gateway proxy integration with CORS support. - Serverless Framework Configuration: Complete serverless.yml examples defining functions, events, environment variables, and DynamoDB table resources. - Use Case: You need to build an API backed by Lambda that processes uploaded files. Use this Skill to generate the S3 trigger handler, API Gateway routing with CORS headers, and the serverless.yml deployment configuration. ## Quick Start Write an AWS Lambda function triggered by S3 uploads that processes each file and deploys with the Serverless Framework.

Frequently Asked Questions about serverless

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write an AWS Lambda function in Python?▼

Define a lambda_handler function accepting event and context parameters, validate input, process the event, and return a response dict with statusCode and body. Keep the function idempotent and stateless, and read configuration from environment variables.

How to process SQS messages in batches with Lambda?▼

Iterate over event['Records'], parse each record's body as JSON, and process messages individually with per-record error handling. Return failed message IDs so SQS can retry only the failures instead of the entire batch.

How do I add CORS headers to API Gateway Lambda responses?▼

Include Access-Control-Allow-Origin, Access-Control-Allow-Headers, and Access-Control-Allow-Methods headers in every response. Also handle the OPTIONS preflight request by returning a 200 response with the same CORS headers.

When should I not use AWS Lambda or serverless?▼

Avoid Lambda for long-running processes, constant high-volume workloads, and simple API endpoints where containers or EC2 are more cost-effective. Lambda suits event-driven, intermittent workloads with variable traffic.

How do I handle DynamoDB errors in Lambda functions?▼

Catch ClientError exceptions and inspect the error code. Return 429 for ProvisionedThroughputExceededException, 404 for ResourceNotFoundException, and 500 for unexpected errors, with logging at appropriate levels.