No slash command · from trove-dev
Provides AWS Lambda handler patterns with CDK infrastructure conventions, covering handler structure, SQS/SNS parsing, IPC patterns, Powertools logging, and CDK best practices.
Ships in trove-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill ships Trove conventions. Prefer existing project patterns over generic best practices when they conflict.
from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.typing import LambdaContext
logger = Logger()
@logger.inject_lambda_context(log_event=True)
def handler(event: dict, context: LambdaContext) -> dict:
records = parse_event(event)
for record in records:
process_record(record)
return {"statusCode": 200}
def parse_sqs_event(event: dict) -> list[dict]:
return [json.loads(record["body"]) for record in event["Records"]]
def parse_sns_via_sqs(event: dict) -> list[dict]:
messages = []
for record in event["Records"]:
body = json.loads(record["body"])
message = json.loads(body["Message"])
messages.append(message)
return messages
def parse_sns_direct(event: dict) -> list[dict]:
# A Lambda subscribed to the topic directly gets no `body`.
return [json.loads(record["Sns"]["Message"]) for record in event["Records"]]
Check which shape the trigger delivers before parsing. SNS through SQS puts the
SNS envelope in body. A direct subscription puts it under Sns.
Follow the same logging rules as trove-python, plus:
@logger.inject_lambda_context(log_event=True) on handlerslogger.append_keys() for request-scoped contextlogger.exception() in error handlers (captures stack trace for Sentry)extra:
logger.warning("IPC token rejected", extra={"source": source})Inbound: an event that claims to come from the backend is untrusted until its
token matches BACKEND_IPC_TOKEN. Check it before parsing the payload or doing
any work, compare in constant time, and never log the token itself.
import hmac
def ipc_token_valid(presented: str | None) -> bool:
expected = os.environ["BACKEND_IPC_TOKEN"] # injected from Secrets Manager
return presented is not None and hmac.compare_digest(presented, expected)
An HTTP-triggered handler reads it from the Authorization header and returns
401 on a mismatch. A queued event carries it where the backend put it, such as
an SNS message attribute, and a mismatch is logged and dropped, not retried.
Outbound:
async def call_backend(endpoint: str, payload: dict) -> dict:
async with httpx.AsyncClient() as client:
response = await client.post(
f"{BACKEND_URL}/api/ipc/{endpoint}",
json=payload,
headers={"Authorization": f"Bearer {IPC_TOKEN}"},
timeout=30.0,
)
response.raise_for_status()
return response.json()
PythonFunction from @aws-cdk/aws-lambda-python-alphaenvironment prop, secrets via Secrets ManagermemorySize, timeout, and reservedConcurrentExecutionsWhat SKILL.md sets; muted values are Claude Code's defaults
lambda handler; aws lambda; sqs handler; sns handler
Three short reads, in order
aws-lambda, cdk, sqs, sns, powertools, ipc
npx claudepluginhub bravew/trove --plugin trove-dev17 skills in this plugin
/trove-architectDesign the shape before the code: sketch types, signatures, and module structure with not-implemented bodies, agree, then fill in. Scrap the sketch when implementation proves it wrong. Use for non-trivial work where jumping straight to code would lock in the wrong shape./trove-commitGit commit workflow and message conventions. Use when creating, drafting, or reviewing atomic commits with conventional messages./trove-docs-sync-auditRead-only documentation drift audit comparing what the docs claim against what the code does. Covers READMEs, setup guides, API and env docs, changelogs, examples, and generated docs. Use when asked whether docs are stale, missing, or inconsistent after a code change. This is not a code review./trove-explainExplain code, architecture, or data flow at the appropriate level for the audience. Use when someone needs to understand unfamiliar code, a module, or system design./trove-perfDiagnose and fix a measured performance problem against a baseline: measure first, fix, re-measure, and cite the delta with an artifact path. Use for slow endpoints, slow queries, or any "make this faster" backed by a measurement./trove-pythonPython/FastAPI coding conventions and best practices. Auto-activates when working with Python files. Covers async patterns, type hints, SQLAlchemy, Pydantic, logging, and error handling.Other plugins' skills for the same job