Skill v1.0.0
currentLLM-judged scan90/100version: "1.0.0" name: serverless-function-tuner description: Tune existing serverless functions for efficiency — memory right-sizing per function, timeout discipline, cold-start mitigation without waste, provisioned-concurrency audit, and event-batching configuration. Use this skill whenever the user already runs Lambda/Cloud Functions/Azure Functions and shares function configs or invocation metrics, asks why functions are slow or over-provisioned, or mentions provisioned concurrency costs. Part of Lean Agentic AI Skills; emits lean-findings.json.
Serverless Function Tuner
Subject type: emit subject.type: "compute-fleet" in findings.
Producer skill. Input: function configs (memory, timeout, concurrency settings), invocation metrics (duration, memory used, invocation counts, cold-start rates). Output: lean-findings.json.
vm-to-serverless-advisor decides whether a workload belongs in functions; this skill tunes functions that already exist. Serverless removed idle servers but introduced its own waste dial: every function carries a memory setting somebody guessed at launch, and memory × duration is exactly what's billed and burned.
Signatures
- Memory oversizing — configured memory far above measured max-memory-used (the metrics report both). High: billing unit is GB-seconds, so unused headroom is charged on every invocation. Fix: right-size to measured usage + sensible headroom; note the CPU coupling honestly (on most platforms CPU scales with memory, so downsizing can lengthen duration — tune to the cost-duration curve, measured with a power-tuning run, not to memory alone).
- Timeout set to platform maximum — 15-minute ceilings on functions completing in seconds; a hang burns the full window. Medium-high. Fix: timeout = observed p99 duration × small multiplier.
- Provisioned concurrency running always — warm capacity 24/7 for traffic that peaks 4 hours a day. High: this is the idle-server pattern reintroduced. Evidence: provisioned vs utilized concurrency curves. Fix: scheduled or autoscaled provisioned concurrency; or accept measured cold-start rates where the latency SLO allows.
- Cold-start over-mitigation — keep-warm ping crons firing every few minutes across many functions (paying invocations to avoid invocations). Medium. Fix: measure the actual cold-start rate first; snapshot/init optimizations (smaller packages, lazy imports) before synthetic traffic.
- Fat deployment packages — large bundles/layers inflating cold-start and storage; unused dependencies shipped per function. Medium. Pairs with js-bundle-audit mechanics for Node functions.
- Unbatched event sources — queue/stream triggers at batch size 1 where the handler is batch-safe. Medium-high: per-invocation overhead × event volume. Fix: raise batch size/window with the latency trade-off named.
- Retry storms on failure — default retry policies multiplying failed work; no DLQ, no backoff. Medium. Fix: bounded retries + DLQ (the serverless cousin of agentic-loop-auditor's retry budgets).
- Chatty function chains — functions invoking functions synchronously, each hop billed and cold-startable. Medium; fix: consolidate or orchestrate via the platform's workflow service where it reduces total compute.
Cost signal (countable)
Cost driver: GB-seconds per invocation × invocation volume (plus provisioned-concurrency GB-hours where enabled). All terms countable from platform metrics; observed quotes them, direction stays qualitative except where a power-tuning run supplies measured before/after — those measured deltas are quotable.
Honesty rules
Memory-downsizing recommendations require the memory-used metric AND the duration curve — cutting memory can raise cost via longer duration; the platform's power-tuning tools (state the tool for the user's platform) give the measured answer. Cold-start SLO impact is the user's latency budget, not your assumption.
Not this skill's job
Whether the workload should be serverless at all (vm-to-serverless-advisor), the code inside the handler (db-efficiency-audit, prompt-carbon-optimizer as applicable), event-driven architecture design (architecture advisors).