/aws-lambda-java-integration
Provides AWS Lambda integration patterns for Java with cold start optimization. Use when deploying Java functions to AWS Lambda, choosing between Micronaut and Raw Java approaches, optimizing cold starts below 1 second, configuring API Gateway or ALB integration, or implementing
$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill aws-lambda-java-integration --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/aws-lambda-java-integration
Context preview
The summary Claude sees to decide when to auto-load this skill.
Provides AWS Lambda integration patterns for Java with cold start optimization. Use when deploying Java functions to AWS Lambda, choosing between Micronaut and Raw Java approaches, optimizing cold starts below 1 second, configuring API Gateway or ALB integration, or implementing
SKILL.md
aws-lambda-java-integration.SKILL.mdname: aws-lambda-java-integration
description: Provides AWS Lambda integration patterns for Java with cold start optimization. Use when deploying Java functions to AWS Lambda, choosing between Micronaut and Raw Java approaches, optimizing cold starts below 1 second, configuring API Gateway or ALB integration, or implementing serverless Java applications. Triggers include "create lambda java", "deploy java lambda", "micronaut lambda aws", "java lambda cold start", "aws lambda java performance", "java serverless framework".
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
AWS Lambda Java Integration
Patterns for creating high-performance AWS Lambda functions in Java with optimized cold starts.
Overview
This skill provides complete patterns for AWS Lambda Java development, covering two main approaches:
1. **Micronaut Framework** - Full-featured framework with AOT compilation, dependency injection, and cold start < 1s 2. **Raw Java** - Minimal overhead approach with cold start < 500ms
Both approaches support API Gateway and ALB integration with production-ready configurations.
When to Use
- Deploying Java functions to AWS Lambda
- Optimizing cold starts below 1 second
- Choosing between Micronaut and Raw Java approaches
- Configuring API Gateway or ALB integration
- Setting up CI/CD pipelines for Java Lambda
Instructions
1. Choose Your Approach
| Approach | Cold Start | Best For | Complexity | |----------|------------|----------|------------| | Micronaut | < 1s | Complex apps, DI needed, enterprise | Medium | | Raw Java | < 500ms | Simple handlers, minimal overhead | Low |
**Validate**: Confirm the approach fits your use case before proceeding.
2. Project Structure
my-lambda-function/
├── build.gradle (or pom.xml)
├── src/main/java/com/example/Handler.java
└── serverless.yml (or template.yaml)
**Validate**: Verify project structure matches the template.
3. Implementation Examples
Micronaut Handler
@FunctionBean("my-function")
public class MyFunction implements Function<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
private final MyService service;
public MyFunction(MyService service) {
this.service = service;
}
@Override
public APIGatewayProxyResponseEvent apply(APIGatewayProxyRequestEvent request) {
// Process request
return new APIGatewayProxyResponseEvent()
.withStatusCode(200)
.withBody("{\"message\": \"Success\"}");
}
}Raw Java Handler
public class MyHandler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
private static final MyService service = new MyService();
@Override
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent request, Context context) {
return new APIGatewayProxyResponseEvent()
.withStatusCode(200)
.withBody("{\"message\": \"Success\"}");
}
}**Validate**: Run `sam local invoke` to verify handler works before deployment.
Core Patterns
Connection Management
// Initialize once, reuse across invocations
private static final DynamoDbClient dynamoDb = DynamoDbClient.builder()
.region(Region.US_EAST_1)
.build();
// Avoid: Creating clients in handler (slow on every invocation)Error Handling
@Override
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent request, Context context) {
try {
return successResponse(process(request));
} catch (ValidationException e) {
return errorResponse(400, e.getMessage());
} catch (Exception e) {
context.getLogger().log("Error: " + e.getMessage());
return errorResponse(500, "Internal error");
}
}Best Practices
Configuration
- **Memory**: Start with 512MB, adjust based on profiling
- **Timeout**: Micronaut 10-30s, Raw Java 5-10s
- **Runtime**: Java 17 or 21 for best performance
Packaging
- Use Gradle Shadow Plugin or Maven Shade Plugin
- Exclude unnecessary dependencies
Monitoring
- Enable X-Ray tracing for performance analysis
- Use CloudWatch Insights to track cold vs warm starts
Deployment Options
Serverless Framework
service: my-java-lambda
provider:
name: aws
runtime: java21
memorySize: 512
timeout: 10
package:
artifact: build/libs/function.jar
functions:
api:
handler: com.example.Handler
events:
- http:
path: /{proxy+}
method: ANY**Validate**: Run `serverless deploy` with `--stage dev` first.
AWS SAM
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: build/libs/function.jar
Handler: com.example.Handler
Runtime: java21
MemorySize: 512
Timeout: 10
Events:
ApiEvent:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY**Validate**: Run `sam validate` before deploying.
Constraints and Warnings
Java-Specific Constraints
- **Reflection**: Minimize use; prefer AOT compilation (Micronaut)
- **Classpath scanning**: Slows cold start; use explicit configuration
- **Large frameworks**: Spring Boot adds significant cold start overhead
Common Pitfalls
1. **Initialization in handler** - Causes repeated work on warm invocations 2. **Oversized JARs** - Include only required dependencies 3. **Insufficient memory** - Java needs more memory than Node.js/Python 4. **No timeout handling** - Always set appropriate timeouts
References
For detailed guidance on specific topics:
- **[Micronaut Lambda](references/micronaut-lambda.md)** - Complete Micronaut setup, AOT configuration, DI optimization
- **[Raw Java Lambda](references/raw-java-lambda.md)** - Minimal handler patterns, singleton caching, JAR packaging
- **[Serverless Deplo
Read more
name: aws-lambda-java-integration description: Provides AWS Lambda integration patterns for Java with cold start optimization. Use when deploying Java functions to AWS Lambda, choosing between Micronaut and Raw Java approaches, optimizing cold starts below 1 second, configuring API Gateway or ALB integration, or implementing serverless Java applications. Triggers include "create lambda java", "deploy java lambda", "micronaut lambda aws", "java lambda cold start", "aws lambda java performance", "java serverless framework". allowed-tools: Read, Write, Edit, Bash, Glob, Grep
AWS Lambda Java Integration
Patterns for creating high-performance AWS Lambda functions in Java with optimized cold starts.
Overview
This skill provides complete patterns for AWS Lambda Java development, covering two main approaches:
1. **Micronaut Framework** - Full-featured framework with AOT compilation, dependency injection, and cold start < 1s 2. **Raw Java** - Minimal overhead approach with cold start < 500ms
Both approaches support API Gateway and ALB integration with production-ready configurations.
When to Use
- Deploying Java functions to AWS Lambda
- Optimizing cold starts below 1 second
- Choosing between Micronaut and Raw Java approaches
- Configuring API Gateway or ALB integration
- Setting up CI/CD pipelines for Java Lambda
Instructions
1. Choose Your Approach
| Approach | Cold Start | Best For | Complexity | |----------|------------|----------|------------| | Micronaut | < 1s | Complex apps, DI needed, enterprise | Medium | | Raw Java | < 500ms | Simple handlers, minimal overhead | Low |
**Validate**: Confirm the approach fits your use case before proceeding.
2. Project Structure
my-lambda-function/ ├── build.gradle (or pom.xml) ├── src/main/java/com/example/Handler.java └── serverless.yml (or template.yaml)
**Validate**: Verify project structure matches the template.
3. Implementation Examples
Micronaut Handler
@FunctionBean("my-function")
public class MyFunction implements Function<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
private final MyService service;
public MyFunction(MyService service) {
this.service = service;
}
@Override
public APIGatewayProxyResponseEvent apply(APIGatewayProxyRequestEvent request) {
// Process request
return new APIGatewayProxyResponseEvent()
.withStatusCode(200)
.withBody("{\"message\": \"Success\"}");
}
}Raw Java Handler
public class MyHandler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
private static final MyService service = new MyService();
@Override
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent request, Context context) {
return new APIGatewayProxyResponseEvent()
.withStatusCode(200)
.withBody("{\"message\": \"Success\"}");
}
}**Validate**: Run `sam local invoke` to verify handler works before deployment.
Core Patterns
Connection Management
// Initialize once, reuse across invocations
private static final DynamoDbClient dynamoDb = DynamoDbClient.builder()
.region(Region.US_EAST_1)
.build();
// Avoid: Creating clients in handler (slow on every invocation)Error Handling
@Override
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent request, Context context) {
try {
return successResponse(process(request));
} catch (ValidationException e) {
return errorResponse(400, e.getMessage());
} catch (Exception e) {
context.getLogger().log("Error: " + e.getMessage());
return errorResponse(500, "Internal error");
}
}Best Practices
Configuration
- **Memory**: Start with 512MB, adjust based on profiling
- **Timeout**: Micronaut 10-30s, Raw Java 5-10s
- **Runtime**: Java 17 or 21 for best performance
Packaging
- Use Gradle Shadow Plugin or Maven Shade Plugin
- Exclude unnecessary dependencies
Monitoring
- Enable X-Ray tracing for performance analysis
- Use CloudWatch Insights to track cold vs warm starts
Deployment Options
Serverless Framework
service: my-java-lambda
provider:
name: aws
runtime: java21
memorySize: 512
timeout: 10
package:
artifact: build/libs/function.jar
functions:
api:
handler: com.example.Handler
events:
- http:
path: /{proxy+}
method: ANY**Validate**: Run `serverless deploy` with `--stage dev` first.
AWS SAM
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: build/libs/function.jar
Handler: com.example.Handler
Runtime: java21
MemorySize: 512
Timeout: 10
Events:
ApiEvent:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY**Validate**: Run `sam validate` before deploying.
Constraints and Warnings
Java-Specific Constraints
- **Reflection**: Minimize use; prefer AOT compilation (Micronaut)
- **Classpath scanning**: Slows cold start; use explicit configuration
- **Large frameworks**: Spring Boot adds significant cold start overhead
Common Pitfalls
1. **Initialization in handler** - Causes repeated work on warm invocations 2. **Oversized JARs** - Include only required dependencies 3. **Insufficient memory** - Java needs more memory than Node.js/Python 4. **No timeout handling** - Always set appropriate timeouts
References
For detailed guidance on specific topics:
- **[Micronaut Lambda](references/micronaut-lambda.md)** - Complete Micronaut setup, AOT configuration, DI optimization
- **[Raw Java Lambda](references/raw-java-lambda.md)** - Minimal handler patterns, singleton caching, JAR packaging
- **[Serverless Deplo
Showing the first part of this file.
Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI.
Repo: giuseppe-trisciuoglio/developer-kit
Other skills on developer-kit.
- /chunking-strategy
Provides chunking strategies for RAG systems. Generates chunk size recommendations (256-1024 tokens), overlap percentages (10-20%), and semantic boundary detection methods. Validates semantic coherence and evaluates retrieval precision/recall metrics. Use when building
Open skill - /prompt-engineering
Provides workflows to write, debug, and optimize prompts for LLMs, including few-shot example selection, chain-of-thought structuring, system prompt design, and template composition. Use when the user asks to write or improve a prompt, wants help with few-shot examples,
Open skill - /rag
Implements document chunking, embedding generation, vector storage, and retrieval pipelines for Retrieval-Augmented Generation systems. Use when building RAG applications, creating document Q&A systems, or integrating AI with knowledge bases.
Open skill - /aws-cloudformation-auto-scaling
Provides AWS CloudFormation patterns for Auto Scaling including EC2, ECS, and Lambda. Use when creating Auto Scaling groups, launch configurations, launch templates, scaling policies, lifecycle hooks, and predictive scaling. Covers template structure with Parameters, Outputs,
Open skill - /aws-cloudformation-bedrock
Provides AWS CloudFormation patterns for Amazon Bedrock resources including agents, knowledge bases, data sources, guardrails, prompts, flows, and inference profiles. Use when creating Bedrock agents with action groups, implementing RAG with knowledge bases, configuring vector
Open skill - /aws-cloudformation-cloudfront
Provides AWS CloudFormation patterns for CloudFront distributions, origins (ALB, S3, Lambda@Edge, VPC Origins), CacheBehaviors, Functions, SecurityHeaders, parameters, Outputs and cross-stack references. Use when creating CloudFront distributions with CloudFormation, configuring
Open skill

