workers-profiling — Claude Code skill: profile Workers CPU and memory
Skill for analyzing CPU and memory usage in deployed Cloudflare Workers and Durable Objects. Finds expensive functions and proposes code optimizations.
npx skills add cloudflare/skills --skill workers-profiling -a claude-codeWhat workers-profiling does
The skill walks you through profiling: identify the symptom (high CPU, latency, memory pressure), capture a pprof profile using the cf CLI or API, analyze hotspots in functions and allocations. It maps findings back to source code, and if source maps are missing, suggests enabling them and re-profiling.
Once evidence is clear, the skill proposes the smallest actionable code change that resolves the issue and explains how to verify the fix. Works with Workers and Durable Objects; requires access to deployed code and Cloudflare account permissions to read profiles.
Report includes evidence for each finding—file, function, source location, and metrics—plus the minimal change and how to measure its effect.
What it helps with
- find functions consuming CPU in production
- detect memory leaks in Durable Objects
- identify where code allocates the most memory
- optimize code using real profiling data
- trace latency in deployed Workers
Example prompts for the agent
- Profile CPU for this Worker, find hotspots and suggest optimization
- Capture a heap profile from the Durable Object and show where memory grows
- Analyze the pprof file, identify the most expensive functions and rewrite them
How to install workers-profiling
1Skills CLI (Vercel)
npx skills add cloudflare/skills --skill workers-profiling -a claude-code2Manually: put the files in place
~/.claude/skills/workers-profiling/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/workers-profiling/
1Skills CLI (Vercel)
npx skills add cloudflare/skills --skill workers-profiling -a codex2Manually: put the files in place
.agents/skills/workers-profiling/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add cloudflare/skills --skill workers-profiling -a cursor2Manually: put the files in place
.cursor/skills/workers-profiling/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install cloudflare/skills workers-profiling2Manually: put the files in place
.github/skills/workers-profiling/SKILL.md1Skills CLI (Vercel)
npx skills add cloudflare/skills --skill workers-profiling -a gemini-cli2Platform CLI
gemini skills install https://github.com/cloudflare/skills --path skills/workers-profilingManually: put the files in place
.devin/skills/workers-profiling/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add cloudflare/skills --skill workers-profiling -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set18
The whole set →Similar
Questions about workers-profiling
How do I install workers-profiling in Claude Code?
Run npx skills add cloudflare/skills --skill workers-profiling -a claude-code; the skill profile will appear at ~/.claude/skills/workers-profiling/SKILL.md.
What does workers-profiling do?
Analyzes CPU and memory in deployed Workers and Durable Objects: finds expensive functions, maps them to source code, and proposes concrete optimizations backed by pprof data.
What tools do I need to profile?
The primary method uses the cf CLI; if it's not installed, the skill will prompt you. Profiles are returned as pprof files, which you can analyze directly or with tools like Go's pprof utility.
Source text
SKILL.md · Apache-2.0
--- name: workers-profiling description: Profile or debug CPU usage and memory allocation in deployed Cloudflare Workers and Durable Objects. Then use this information to optimize your code. --- # 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.
© cloudflare · Apache-2.0 · cloudflare/skills