Help us improve
Share bugs, ideas, or general feedback.
Provides AWS Lambda integration patterns for TypeScript functions with cold start optimization using NestJS or raw TypeScript approaches, API Gateway/ALB configuration.
npx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit-typescriptHow this skill is triggered — by the user, by Claude, or both
Slash command
/developer-kit-typescript:aws-lambda-typescript-integrationThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Patterns for creating high-performance AWS Lambda functions in TypeScript with optimized cold starts.
Provides AWS Lambda patterns for Python functions using Chalice or raw Python, with cold start optimization and API Gateway/ALB integration for serverless apps.
Builds production-ready AWS serverless applications with Lambda functions, API Gateway, DynamoDB, SQS/SNS event patterns, SAM/CDK deployment, and cold start optimization.
Provides AWS CloudFormation templates and workflows for Lambda functions, layers, API Gateway integration, event sources, cold start optimization, monitoring, validation, and deployment. Use for Lambda infrastructure on AWS.
Share bugs, ideas, or general feedback.
Patterns for creating high-performance AWS Lambda functions in TypeScript with optimized cold starts.
Two approaches for TypeScript Lambda:
Both support API Gateway and ALB integration.
| Approach | Cold Start | Bundle Size | Best For | Complexity |
|---|---|---|---|---|
| NestJS | < 500ms | Larger (100KB+) | Complex APIs, enterprise apps, DI needed | Medium |
| Raw TypeScript | < 100ms | Smaller (< 50KB) | Simple handlers, microservices, minimal deps | Low |
my-nestjs-lambda/
├── src/
│ ├── app.module.ts
│ ├── main.ts
│ ├── lambda.ts # Lambda entry point
│ └── modules/
│ └── api/
├── package.json
├── tsconfig.json
└── serverless.yml
my-ts-lambda/
├── src/
│ ├── handlers/
│ │ └── api.handler.ts
│ ├── services/
│ └── utils/
├── dist/ # Compiled output
├── package.json
├── tsconfig.json
└── template.yaml
See the References section for detailed implementation guides. Quick examples:
NestJS Handler:
// lambda.ts
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import serverlessExpress from '@codegenie/serverless-express';
import { Context, Handler } from 'aws-lambda';
import express from 'express';
import { AppModule } from './src/app.module';
let cachedServer: Handler;
async function bootstrap(): Promise<Handler> {
const expressApp = express();
const adapter = new ExpressAdapter(expressApp);
const nestApp = await NestFactory.create(AppModule, adapter);
await nestApp.init();
return serverlessExpress({ app: expressApp });
}
export const handler: Handler = async (event: any, context: Context) => {
if (!cachedServer) {
cachedServer = await bootstrap();
}
return cachedServer(event, context);
};
Raw TypeScript Handler:
// src/handlers/api.handler.ts
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda';
export const handler = async (
event: APIGatewayProxyEvent,
context: Context
): Promise<APIGatewayProxyResult> => {
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from TypeScript Lambda!' })
};
};
TypeScript cold start depends on bundle size and initialization code. Key strategies:
See Raw TypeScript Lambda for detailed patterns.
Create clients at module level and reuse:
// GOOD: Initialize once, reuse across invocations
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
const dynamoClient = new DynamoDBClient({ region: process.env.AWS_REGION });
export const handler = async (event: APIGatewayProxyEvent) => {
// Use dynamoClient - already initialized
};
// src/config/env.config.ts
export const env = {
region: process.env.AWS_REGION || 'us-east-1',
tableName: process.env.TABLE_NAME || '',
debug: process.env.DEBUG === 'true',
};
// Validate required variables
if (!env.tableName) {
throw new Error('TABLE_NAME environment variable is required');
}
Keep package.json minimal:
{
"dependencies": {
"aws-lambda": "^3.1.0",
"@aws-sdk/client-dynamodb": "^3.450.0"
},
"devDependencies": {
"typescript": "^5.3.0",
"esbuild": "^0.19.0"
}
}
Return proper HTTP codes with structured errors:
export const handler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
try {
const result = await processEvent(event);
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(result)
};
} catch (error) {
console.error('Error processing request:', error);
return {
statusCode: 500,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ error: 'Internal server error' })
};
}
};
Use structured logging for CloudWatch Insights:
const log = (level: string, message: string, meta?: object) => {
console.log(JSON.stringify({
level,
message,
timestamp: new Date().toISOString(),
...meta
}));
};
log('info', 'Request processed', { requestId: context.awsRequestId });
Serverless Framework:
service: my-typescript-api
provider:
name: aws
runtime: nodejs20.x
functions:
api:
handler: dist/handler.handler
events:
- http:
path: /{proxy+}
method: ANY
AWS SAM:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
ApiFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: dist/
Handler: handler.handler
Runtime: nodejs20.x
Events:
ApiEvent:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
Pre-deploy checks:
npm test - verify all tests passnpm run build - confirm TypeScript compiles without errorsserverless invoke local or sam local invoke - test locallyPost-deploy verification:
serverless invoke or aws lambda invoke - verify handler executesFor complete deployment configurations including CI/CD, see Serverless Deployment.
@types/aws-lambda for proper event typingcontext.getRemainingTimeInMillis() for long operationsFor detailed guidance on specific topics:
Input: Create a TypeScript Lambda REST API using NestJS for a todo application
Process:
nest new@codegenie/serverless-express, aws-lambdalambda.ts entry point with Express adapterserverless.yml with API Gateway eventsValidation:
serverless invoke local -f api - verify handler worksOutput: NestJS project with REST API, DynamoDB integration, deployment config
Input: Create a minimal TypeScript Lambda function with optimal cold start
Process:
Validation:
sam local invoke - test locally before deployingdu -sh dist/Output: Minimal TypeScript Lambda, bundle < 50KB, cold start < 100ms
Input: Configure CI/CD for TypeScript Lambda with SAM
Process:
Validation:
npm test successfullysam validate passes in pipelineOutput: GitHub Actions workflow, multi-stage pipeline, test automation
Version: 1.0.0