aws-lambda-typescript

A guide for writing AWS Lambda functions in TypeScript, a language that adds type checking to JavaScript.

In plain words
What is it for?
It helps write handlers, separate business logic, bundle code with esbuild, use the AWS SDK and Powertools, handle errors, and improve Node.js Lambda performance.
Why use it?
It helps keep Lambda code structured, correctly typed, testable, and efficient when it runs in AWS.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/eliecer2000/kiro-bootstrap/aws-lambda-typescript
Any agent
npx skills add eliecer2000/kiro-bootstrap --skill aws-lambda-typescript
Clone the repo
git clone --depth 1 https://github.com/eliecer2000/kiro-bootstrap

Made for: Claude Code, Codex.

Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,332 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00043 $0.03332
Opus 5 $0.00022 $0.01666
Sonnet 5 $0.00009 $0.00666
Haiku 4.5 $0.00004 $0.00333

Measured 2d ago against content hash f81dab6dd444, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

aws-lambda-typescript scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/aws-lambda-typescript/SKILL.md · 416 lines

How it starts

The opening of the file, as written. The whole thing — 416 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AWS Lambda TypeScript

Skill para desarrollo de funciones Lambda en TypeScript: handlers, bundling con esbuild, AWS SDK v3, Powertools, tipado estricto, manejo de errores, testing y mejores prácticas de rendimiento.

Principios fundamentales

  • Un handler, una responsabilidad. Evitar Lambdas monolíticos.
  • Separar lógica de negocio del handler. El handler solo parsea el evento, invoca la lógica y formatea la respuesta.
  • Usar AWS Lambda Powertools para TypeScript: Logger, Tracer, Metrics, Idempotency, Parameters.
  • AWS SDK v3 obligatorio (modular, tree-shakeable). Nunca usar SDK v2.
  • Tipado estricto: strict: true en tsconfig, no usar any.
  • Inicializar clientes AWS fuera del handler (reutilización en warm starts).

Estructura de proyecto recomendada

functions/
├── mi-funcion/
│   ├── handler.ts          # Entry point del Lambda
│   ├── service.ts          # Lógica de negocio
│   ├── repository.ts       # Acceso a datos
│   ├── types.ts            # Interfaces y tipos
│   └── errors.ts           # Errores custom
├── shared/
│   ├── middleware.ts
│   ├── constants.ts
│   └── types.ts
├── tests/
│   ├── unit/
│   │   ├── service.test.ts
│   │   └── handler.test.ts
│   └── integration/
│       └── api.test.ts
├── tsconfig.json
├── package.json
└── vitest.config.ts

Handler con Powertools (patrón recomendado)

import { Logger } from '@aws-lambda-powertools/logger';
import { Tracer } from '@aws-lambda-powertools/tracer';
import { Metrics, MetricUnit } from '@aws-lambda-powertools/metrics';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocumentClient, QueryCommand, PutCommand } from '@aws-sdk/lib-dynamodb';
import type { APIGatewayProxyEventV2, APIGatewayProxyResultV2, Context } from 'aws-lambda';

const logger = new Logger({ serviceName: 'mi-servicio' });
const tracer = new Tracer({ serviceName: 'mi-servicio' });
const metrics = new Metrics({ namespace: 'MiApp', serviceName: 'mi-servicio' });

// Clientes AWS fuera del handler (warm start reuse)
const ddbClient = tracer.captureAWSv3Client(new DynamoDBClient({}));
const docClient = DynamoDBDocumentClient.from(ddbClient);
const TABLE_NAME = process.env.TABLE_NAME!;

export const handler = async (
  event: APIGatewayProxyEventV2,
  context: Context
): Promise<APIGatewayProxyResultV2> => {
  logger.addContext(context);

  try {
    const method = event.requestContext.http.method;
    const path = event.rawPath;

    if (method === 'GET' && path === '/items') {
      return await listItems();
    }
    if (method === 'POST' && path === '/items') {
      return await createItem(JSON.parse(event.body ?? '{}'));
    }

    return { statusCode: 404, body: JSON.stringify({ error: { code: 'NOT_FOUND', message: 'Route not found' } }) };
  } catch (error) {
    logger.error('Unexpected error', { error });
    return { statusCode: 500, body: JSON.stringify({ error: { code: 'INTERNAL_ERROR', message: 'Internal server error' } }) };
  }
};

Read the full file on GitHub · 416 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 416 lines · 43 tokens per session scan A f81dab6dd444

Subscribe to this mod's changes

aws-lambda-typescript is a skill published in the GitHub repository eliecer2000/kiro-bootstrap (9 stars, last pushed 5mo ago), licensed MIT. It adds 43 tokens to every session and 3,332 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.