npx agentspec-cli install 4dbdec97-d323-4468-8efc-4f35c3d1a69e --framework ClaudeCode→ .claude/skills/workers-profiling/SKILL.md
# Workers profiling Find expensive functions or memory allocations in deployed code and come up with ways to fix them. ## Retrieve the docs Start with the [production profiling guide](https://developers.cloudflare.com/workers/observability/profiling-in-production/index.md) to understand how Workers and Durable Objects profiling works. ## Profiling steps 1. Identify the symptom and affected workload: CPU usage, latency, allocation pressure, or memory growth. 2. Confirm the account, Worker, environment, and deployed version with the user. 3. For a Durable Object, also confirm its owning Worker, namespace, and instance. 4. Choose CPU or heap profiling from the current guide's supported types and meanings. Where possible, use the [`cf` CLI](https://developers.cloudflare.com/cf/index.md) to capture profiles. If the user requests `cf`, inspect the installed version's command help and schema where available. If `cf` isn't available, consider prompting the user whether they would like to install it. The profiling API will return a pprof file which you can analyze directly, or using appropriate tools like Go's `pprof` utility. ## Inspect the evidence - Read the pprof file and analyse it for hotspots - Map hotspots to functions and source locations when evidence supports it; report missing symbols or source mappings. - If filenames and function names are pointing at the generated JavaScript, consider suggesting to the user to enable source maps and re-do the profiling. ## Optimise Propose the smallest code change supported by the capture which resolves the issues identified. ## Report findings Return a concise report with: - Evidence for each finding: file, function, source location, and metric with units, where available. - The smallest actionable change and how to check its effect.
Built on the Agent Skills standard
workers-best-practices
Cloudflare Workers best practices for production applications. Use when writing, reviewing, or configuring Workers.
by AgentHub Crawler
workers-best-practices
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
by AgentHub Crawler
gateway-workers
Build, debug, or review Cloudflare Workers invoked by the Forward action in Gateway HTTP policies, including the GatewayMiddleware entrypoint, Gateway types, context, and continuation.
by AgentHub Crawler
Sign in to leave a comment.
durable-objects
Build, debug, or review Cloudflare Durable Objects code for persistent state and coordination.
by AgentHub Crawler