giuseppe-trisciuoglio/developer-kit/aws-lambda-typescript-integration
Claude Code and agent skill by giuseppe-trisciuoglio/developer-kit
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Provides AWS Lambda integration patterns for TypeScript with cold start optimization. Use when creating or deploying TypeScript Lambda functions, choosing between NestJS framework and raw TypeScript approaches, optimizing cold starts, configuring API Gateway or ALB integration, or implementing serverless TypeScript applications. Triggers include "create lambda typescript", "deploy typescript lambda", "nestjs lambda aws", "raw typescript lambda", "aws lambda typescript performance".
Install
npx vskill@latest install giuseppe-trisciuoglio/developer-kit/aws-lambda-typescript-integrationSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as giuseppe-trisciuoglio/developer-kit/aws-lambda-typescript-integration.
AWS Lambda TypeScript Integration
Patterns for creating high-performance AWS Lambda functions in TypeScript with optimized cold starts.
Overview
Two approaches for TypeScript Lambda:
- NestJS Framework - Dependency injection, modular architecture, larger bundle (100KB+)
- Raw TypeScript - Minimal overhead, smaller bundle (<50KB), maximum control
Both support API Gateway and ALB integration.
When to Use
- Creating new Lambda functions in TypeScript
- Optimizing cold start performance
- Choosing between NestJS and minimal TypeScript
- Configuring API Gateway or ALB integration
- Setting up CI/CD for TypeScript Lambda
Instructions
1. Choose Your Approach
| 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 |
2. Project Structure
NestJS Structure
Raw TypeScript Structure
3. Implementation Examples
See the References section for detailed implementation guides. Quick examples:
NestJS Handler:
Raw TypeScript Handler:
Core Concepts
Cold Start Optimization
TypeScript cold start depends on bundle size and initialization code. Key strategies:
- Lazy Loading - Defer heavy imports until needed
- Tree Shaking - Remove unused code from bundle
- Minification - Use esbuild or terser for smaller bundles
- Instance Caching - Cache initialized services between invocations
See Raw TypeScript Lambda for detailed patterns.
Connection Management
Create clients at module level and reuse:
Environment Configuration
Best Practices
Memory and Timeout Configuration
- Memory: Start with 512MB for NestJS, 256MB for raw TypeScript
- Timeout: Set based on cold start + expected processing time
- NestJS: 10-30 seconds for cold start buffer
- Raw TypeScript: 3-10 seconds typically sufficient
Dependencies
Keep package.json minimal:
Error Handling
Return proper HTTP codes with structured errors:
Logging
Use structured logging for CloudWatch Insights:
Deployment Options
Quick Start
Serverless Framework:
AWS SAM:
Deployment Validation
Pre-deploy checks:
- Run
npm test- verify all tests pass - Run
npm run build- confirm TypeScript compiles without errors - Verify bundle size < 50MB (unzipped)
- Run
serverless invoke localorsam local invoke- test locally
Post-deploy verification:
- Run
serverless invokeoraws lambda invoke- verify handler executes - Test API endpoint via curl or Postman
- Check CloudWatch logs for errors
- Verify cold start time meets SLA
For complete deployment configurations including CI/CD, see Serverless Deployment.
Constraints and Warnings
Lambda Limits
- Deployment package: 250MB unzipped maximum (50MB zipped)
- Memory: 128MB to 10GB
- Timeout: 15 minutes maximum
- Concurrent executions: 1000 default (adjustable)
- Environment variables: 4KB total size
TypeScript-Specific Considerations
- Bundle size: TypeScript compiles to JavaScript; use bundlers to minimize size
- Cold start: Node.js 20.x offers best performance
- Dependencies: Use Lambda Layers for shared dependencies
- Native modules: Must be compiled for Amazon Linux 2
Common Pitfalls
- Importing heavy libraries at module level - Defer to lazy loading if not always needed
- Not bundling dependencies - Include all production dependencies in the package
- Missing type definitions - Install
@types/aws-lambdafor proper event typing - No timeout handling - Use
context.getRemainingTimeInMillis()for long operations
Security Considerations
- Never hardcode credentials; use IAM roles and environment variables
- Input Validation for Event Data: All incoming event data (API Gateway request bodies, S3 event objects, SQS message bodies) is untrusted external content; always validate and sanitize before processing to prevent injection attacks
- Content Sanitization: When processing S3 objects or SQS message payloads, treat the content as untrusted third-party data; apply appropriate validation, schema checks, and sanitization before acting on it
- Validate all input data
- Use least privilege IAM policies
- Enable CloudTrail for audit logging
- Sanitize logs to avoid leaking sensitive data
References
For detailed guidance on specific topics:
- [NestJS Lambda](references/nestjs-lambda.md) - Complete NestJS setup, dependency injection, Express/Fastify adapters
- [Raw TypeScript Lambda](references/raw-typescript-lambda.md) - Minimal handler patterns, bundling, tree shaking
- [Serverless Config](references/serverless-config.md) - Serverless Framework and SAM configuration
- [Serverless Deployment](references/serverless-deployment.md) - CI/CD pipelines, environment management
- [Testing](references/testing.md) - Jest, integration testing, SAM Local
Examples
Example 1: Create a NestJS REST API
Input: Create a TypeScript Lambda REST API using NestJS for a todo application
Process:
- Initialize NestJS project with
nest new - Install Lambda dependencies:
@codegenie/serverless-express,aws-lambda - Create
lambda.tsentry point with Express adapter - Configure
serverless.ymlwith API Gateway events - Deploy with Serverless Framework
Validation:
- Run
serverless invoke local -f api- verify handler works - Check bundle size < 250MB
- Test deployed endpoint returns 200 OK
Output: NestJS project with REST API, DynamoDB integration, deployment config
Example 2: Create a Raw TypeScript Lambda
Input: Create a minimal TypeScript Lambda function with optimal cold start
Process:
- Set up TypeScript project with esbuild
- Create handler with proper AWS types
- Configure minimal dependencies
- Set up SAM or Serverless deployment
- Optimize bundle size with tree shaking
Validation:
- Run
sam local invoke- test locally before deploying - Verify bundle < 50KB with
du -sh dist/ - Confirm cold start < 100ms via CloudWatch
Output: Minimal TypeScript Lambda, bundle < 50KB, cold start < 100ms
Example 3: Deploy with GitHub Actions
Input: Configure CI/CD for TypeScript Lambda with SAM
Process:
- Create GitHub Actions workflow
- Set up Node.js environment
- Run tests with Jest
- Bundle with esbuild
- Deploy with SAM
Validation:
- Verify CI pipeline runs
npm testsuccessfully - Confirm
sam validatepasses in pipeline - Check CloudFormation stack created successfully
Output: GitHub Actions workflow, multi-stage pipeline, test automation
Version
Version: 1.0.0
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/developer-kit-typescript/skills/aws-lambda-typescript-integration/SKILL.md
Popularity
- Repository stars
- 298
- Repository forks
- 35
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/giuseppe-trisciuoglio/developer-kit/aws-lambda-typescript-integration)