← ClaudeAtlas

cold-start-optimizerlisted

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.
aiskillstore/marketplace · ★ 329 · DevOps & Infrastructure · score 82
Install: claude install-skill aiskillstore/marketplace
# Cold Start Optimizer Skill 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. ## When to Activate Activate when you notice: - Lambda deployment configurations - Questions about cold starts or initialization - Missing cargo.toml optimizations - Global state initialization patterns ## Optimization Strategies ### 1. Binary Size Reduction **Cargo.toml Configuration**: ```toml [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. ### 2. Lazy Initialization **Bad Pattern**: ```rust // ❌ 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**: ```rust use std::sync::OnceLock; // ✅ Lazy initialization - only creates when first used static HTTP_CLIENT: OnceLock<reqwest::Client> = Once