Agent skill · software engineering · secondsky

cloudflare-workers-performance

Cloudflare Workers performance optimization with CPU, memory, caching, bundle size. Use for slow workers, high latency, cold starts, or encountering CPU limits, memory issues, timeout errors.

Why this skill is useful

Provides specific performance optimization techniques and code examples for Cloudflare Workers that the AI wouldn't reliably generate on its own.

What it needs

About 3k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.

What this skill does

Cloudflare Workers Performance Optimization Techniques for maximizing Worker performance and minimizing latency. Quick Wins Critical Rules 1. Stay under CPU limits - 10ms (free), 30ms (paid), 50ms (unbound) 2. Minimize cold starts - Keep bundles < 1MB, avoid dynamic imports 3. Use Cache API - Cache responses at the edge 4. Stream large payloads - Don't buffer entire responses 5. Batch operations - Combine multiple KV/D1 calls Top 10 Performance Errors Error Symptom Fix ------- --------- ----- CPU limit exceeded Worker terminated Optimize hot paths, use streaming Cold start latency First request slow Reduce bundle size, avoid top-level await Memory pressure Slow GC, timeouts Stream data, avoid large arrays KV latency Slow reads Use Cache API, batch reads D1 slow queries High latency Add indexes, optimize SQL Large bundles Slow cold starts Tree-shake, code split Blocking operations Request timeouts Use Promise.all, streaming Unnecessary cloning Memory spike Only clone when needed Missing cache Repeated computation Implement caching layer Sync operations CPU spikes Use async alternatives CPU Optimization Profile Hot Paths Optimize JSON Operations Memory Optimization Avoid Large Arrays Caching Strategies Multi-Layer Cache Bundle Optimization When to Load References Load specific references based on the task: Optimizing CPU usage? → Load references/cpu-optimization.md Memory issues? → Load references/memory-optimization.md Implementing caching? → Load references/caching-strategies.md Reducing bundle size? → Load references/bundle-optimization.md Cold start problems? → Load references/cold-starts.md Templates Template Purpose Use When ---------- --------- ---------- templates/performance-middleware.ts Performance monitoring Adding timing/profiling templates/caching-layer.ts Multi-layer caching Implementing cache templates/optimized-worker.ts Performance patterns Starting optimized worker Scripts Script Purpose Command -------- --------- --------- scripts/benchmark.sh Load …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills secondsky/cloudflare-workers-performance

View the source on GitHub

Browse the @skills marketplace