aws-lambda
AWS Lambda Python conventions: handler structure, Powertools logging/tracing/metrics, input validation, error handling, batch partial failures, idempotency…
Skill by mabrosim
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mabrosim-aws-lambda
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: cloud, data, security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/aws-lambda
What's inside
- Skill name
aws-lambda- Description
- AWS Lambda Python conventions: handler structure, Powertools logging/tracing/metrics, input validation, error handling, batch partial failures, idempotency, secrets, cold start, SDK timeouts and retries, response format. Load when generating, reviewing, or refactoring Lambda functions or data pipeline ingestion handlers.
- License
- MIT
- Instructions
- 249 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (1)
- SKILL.md
SKILL.md (first lines)
# AWS Lambda
Conventions for AWS Lambda functions in Python.
## Related Patterns
For ingestion, ETL, and serialisation patterns that use Lambda handlers, also read:
- `../../catalogs/data-pipeline-patterns.md`
---
## General Rules
- Target the `python3.12` or `python3.13` runtime. Prefer `arm64` (Graviton) for
lower price per GB-second unless a native dependency ships x86-only wheels.
- Keep handlers thin — business logic in separate, unit-testable modules.
- Set memory and timeout explicitly. API-backed handlers must finish within the API
Gateway integration timeout (29 s default for REST APIs).
- Use Powertools for AWS Lambda (Python) v3 for logging, tracing, metrics, parsing,
batch, idempotency, and parameters instead of hand-rolled equivalents.
---
## Handler Structure
Later snippets assume `import json`, `import os`, `import boto3`, and the
`LambdaContext` import below.
```python
from aws_lambda_powertools import Logger, Metrics, Tracer
from aws_lambda_powertools.metrics import MetricUnit
from aws_lambda_powertools.utilities.typing import LambdaContext
logger = Logger() # service from POWERTOOLS_SERVICE_NAME; structured JSON
tracer = Tracer() # needs X-Ray active tracing
metrics = Metrics() # namespace from POWERTOOLS_METRICS_NAMESPACE
@logger.inject_lambda_context
@tracer.capture_lambda_handler
@metrics.log_metrics
def handler(event: dict, context: LambdaContext) -> dict:
# 1. Parse and validate input
# 2. Call business logic
# 3. Return structured response
metrics.add_metric(name="RecordsProcessed", unit=MetricUnit.Count, value=1)
...
```
- Install the extras the code uses (`aws-lambda-powertools[tracer,parser]`) or
attach the Powertools Lambda layer.
- Without Powertools, use stdlib `logging` with the function's log format set to
JSON. Never `print`.
---
## Input Validation
- Validate every event at the boundary with a pydantic v2 model via Powertools
`parser`; never index raw event keys deep in business logic.
- Return `400` for invalid API input; for queue/stream sources let the error fail
the record (see Batch Processing).
- For multi-route APIs use `event_handler.APIGatewayRestResolver` /
`APIGatewayHttpResolver` instead of hand-parsing the proxy event.
```python
from aws_lambda_powertools.utilities.parser import envelopes, parse
from pydantic import BaseModel, ValidationError
class OrderRequest(BaseModel):
order_id: str
quantity: int
def handler(event: dict, context: LambdaContext) -> dict:
try:
req = parse(event=event, model=OrderRequest, envelope=envelopes.ApiGatewayEnvelope)
except ValidationError:
req = None
if req is None: # the envelope returns None, not ValidationError, for a null body
return {"statusCode": 400, "body": json.dumps({"error": "invalid request"})}
...
```
---
## Error Handling
- Catch specific exceptions; let unexpected ones propagate.
- Status codes matter only for API Gateway and function URLs. For async, SQS,
Kinesis, DynamoDB Streams, and EventBridge sources, **raise** so Lambda retries
and routes to the DLQ / on-failure destination — returning an error dict marks
the event as processed.
- In API handlers, log with `logger.exception(...)` and return a generic `500`
body; never return `str(e)` — it leaks internal details to the caller.
---
## Batch Processing
For SQS, Kinesis, and DynamoDB Streams, report per-record failures instead of
failing the whole batch: enable `ReportBatchItemFailures` on the event source
mapping and use Powertools `batch`.
```python
from aws_lambda_powertools.utilities.batch import (
BatchProcessor, EventType, process_partial_response,
)
from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord
processor = BatchProcessor(event_type=EventType.SQS)
def record_handler(record: SQSRecord) -> None:
... # raise to mark only this record as failedFrom mabrosim/aet-content-pack, MIT.
More from mabrosim/aet-content-pack
- 0.561score
databricks-notebook-testing
mabrosim
Test and assess coverage for Databricks Python-source notebooks, supporting modules, and PySpark transformations.
SkillAFreshness: AClaude Code +9 - 0.561score
numpy
mabrosim
numpy ndarray rules and patterns: reshaping, vectorized conditionals, crossings, extrema, sign/clamp, assembly, scalar extraction.
SkillAFreshness: AClaude Code +9 - 0.561score
pyspark
mabrosim
PySpark rules and patterns: DataFrame API, partitioning, Delta Lake, performance, Spark API conventions.
SkillAFreshness: AClaude Code +9 - 0.561score
databricks-notebook
mabrosim
Databricks PySpark notebook (Python-source-format) structure and style: notebook header/cell contract, cell ordering, docstring steps, fail-fast validation…
SkillAFreshness: AClaude Code +9 - 0.561score
pandas
mabrosim
pandas data-processing rules and patterns, plus pandas↔numpy bridges: datetime indexing, partitioned I/O, cleaning, feature engineering, gap filling, filtering.
SkillAFreshness: AClaude Code +9 - 0.561score
tensorflow
mabrosim
TensorFlow 2.x / Keras patterns and solutions: model building, training loops, classification, regression, NLP, inference serving, Databricks deep learning.
SkillAFreshness: AClaude Code +9 - 0.559score
visualization
mabrosim
Visualization patterns and solutions: matplotlib, seaborn, financial signal and volatility charts, time-series decomposition and forecast plots, anomaly…
SkillAFreshness: AClaude Code +9 - 0.556score
data-pipeline
mabrosim
Data pipeline patterns: ingestion, ETL, serialisation, partitioned reads/writes, file conversion, parallel batch processing, Lambda-triggered ingestion.
SkillAFreshness: AClaude Code +9 - 0.555score
financial-timeseries
mabrosim
Financial time-series rules and patterns: OHLC resampling, look-ahead-safe windowing, TA indicators (RSI, PPO, CMO, Bollinger, MACD, PSAR), signal encoding…
SkillAFreshness: AClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 12, 2026 (17 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/mabrosim/aet-content-pack
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from mabrosim
- 0.561score
databricks-notebook-testing
mabrosim
Test and assess coverage for Databricks Python-source notebooks, supporting modules, and PySpark transformations.
SkillAFreshness: AClaude Code +9 - 0.561score
numpy
mabrosim
numpy ndarray rules and patterns: reshaping, vectorized conditionals, crossings, extrema, sign/clamp, assembly, scalar extraction.
SkillAFreshness: AClaude Code +9 - 0.561score
pyspark
mabrosim
PySpark rules and patterns: DataFrame API, partitioning, Delta Lake, performance, Spark API conventions.
SkillAFreshness: AClaude Code +9 - 0.561score
databricks-notebook
mabrosim
Databricks PySpark notebook (Python-source-format) structure and style: notebook header/cell contract, cell ordering, docstring steps, fail-fast validation…
SkillAFreshness: AClaude Code +9 - 0.561score
pandas
mabrosim
pandas data-processing rules and patterns, plus pandas↔numpy bridges: datetime indexing, partitioned I/O, cleaning, feature engineering, gap filling, filtering.
SkillAFreshness: AClaude Code +9 - 0.561score
tensorflow
mabrosim
TensorFlow 2.x / Keras patterns and solutions: model building, training loops, classification, regression, NLP, inference serving, Databricks deep learning.
SkillAFreshness: AClaude Code +9
Cite this page
aws-lambda skill. Agent Mart. https://agentmart.dev/skills/mabrosim-aws-lambda (last updated 2026-10-24)