skills/emillindfors/cold-start-optimizer/SKILL.md
Provides guidance on reducing Lambda cold start times through binary optimization, lazy initialization, and deployment strategies. Activates when users discuss cold starts or deployment configuration.
npx skillsauth add aiskillstore/marketplace cold-start-optimizerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert at optimizing AWS Lambda cold starts for Rust functions. When you detect Lambda deployment concerns, proactively suggest cold start optimization techniques.
Activate when you notice:
Cargo.toml Configuration:
[profile.release]
opt-level = 'z' # Optimize for size (vs 's' or 3)
lto = true # Link-time optimization
codegen-units = 1 # Single codegen unit for better optimization
strip = true # Strip symbols from binary
panic = 'abort' # Smaller panic handler
Impact: Can reduce binary size by 50-70%, significantly improving cold start times.
Bad Pattern:
// ❌ Initializes everything on cold start
static HTTP_CLIENT: reqwest::Client = reqwest::Client::new();
static DB_POOL: PgPool = create_pool().await; // Won't even compile
#[tokio::main]
async fn main() -> Result<(), Error> {
// Heavy initialization before handler is ready
tracing_subscriber::fmt().init();
init_aws_sdk().await;
warm_cache().await;
run(service_fn(handler)).await
}
Good Pattern:
use std::sync::OnceLock;
// ✅ Lazy initialization - only creates when first used
static HTTP_CLIENT: OnceLock<reqwest::Client> = OnceLock::new();
fn get_client() -> &'static reqwest::Client {
HTTP_CLIENT.get_or_init(|| {
reqwest::Client::builder()
.timeout(Duration::from_secs(10))
.build()
.unwrap()
})
}
#[tokio::main]
async fn main() -> Result<(), Error> {
// Minimal initialization
tracing_subscriber::fmt()
.without_time()
.init();
run(service_fn(handler)).await
}
Audit Dependencies:
cargo tree
cargo bloat --release
Reduce Features:
[dependencies]
# ❌ BAD: Pulls in everything
tokio = "1"
# ✅ GOOD: Only what you need
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
# ✅ Disable default features when possible
serde = { version = "1", default-features = false, features = ["derive"] }
Build for ARM64:
cargo lambda build --release --arm64
Deploy with ARM64:
cargo lambda deploy --memory 512 --arch arm64
Benefits:
For critical functions with strict latency requirements:
# CloudFormation/SAM
ProvisionedConcurrencyConfig:
ProvisionedConcurrentExecutions: 2
# Or via AWS CLI
aws lambda put-provisioned-concurrency-config \
--function-name my-function \
--provisioned-concurrent-executions 2
Trade-off: Costs more but eliminates cold starts.
use std::sync::OnceLock;
static AWS_CONFIG: OnceLock<aws_config::SdkConfig> = OnceLock::new();
static S3_CLIENT: OnceLock<aws_sdk_s3::Client> = OnceLock::new();
async fn get_s3_client() -> &'static aws_sdk_s3::Client {
S3_CLIENT.get_or_init(|| {
let config = AWS_CONFIG.get_or_init(|| {
tokio::runtime::Handle::current()
.block_on(aws_config::load_from_env())
});
aws_sdk_s3::Client::new(config)
})
}
async fn handler(event: LambdaEvent<Request>) -> Result<Response, Error> {
// Only initialize if needed
let client = if event.payload.needs_api_call {
Some(get_http_client())
} else {
None
};
// Process without client if not needed
process(event.payload, client).await
}
filter @type = "REPORT"
| stats avg(@initDuration), max(@initDuration), count(*) by bin(5m)
# Measure binary size
ls -lh target/lambda/bootstrap/bootstrap.zip
# Test cold start locally
cargo lambda watch
cargo lambda invoke --data-ascii '{"test": "data"}'
When you see Lambda deployment code:
Proactively suggest cold start optimizations when you detect Lambda configuration or initialization patterns.
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.