Provides AWS Lambda Java integration patterns optimizing cold starts under 1s with Micronaut or raw Java, including API Gateway/ALB configurations for serverless apps.
From developer-kit-javanpx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit-javaThis skill is limited to using the following tools:
references/micronaut-lambda.mdreferences/raw-java-lambda.mdreferences/serverless-deployment.mdreferences/testing-lambda.mdSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Patterns for creating high-performance AWS Lambda functions in Java with optimized cold starts.
This skill provides complete patterns for AWS Lambda Java development, covering two main approaches:
Both approaches support API Gateway and ALB integration with production-ready configurations.
| 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.
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.
@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\"}");
}
}
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.
// 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)
@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");
}
}
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.
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.
For detailed guidance on specific topics:
Input:
Create a Java Lambda function using Micronaut to handle user REST API
Process:
Output:
Input:
My Java Lambda has 3 second cold start, how do I optimize it?
Process:
Output:
Input:
Configure CI/CD for Java Lambda with SAM
Process:
Output:
Version: 1.0.0