Skill Press

No. 943 · workers-profiling

Workers profiling

A field guide from Cloudflare

Cloudflare

When to use it

Profile or debug CPU usage and memory allocation in deployed Cloudflare Workers and Durable Objects. Then use this information to optimize your code.

Rank
No. 943 of 971
Installs
Not listed yet
Runs in
Claude, Codex, Cursor, GitHub Copilot
Length
284 words · 1 min
Files
3
License
Apache-2.0

Get this skill

Download the skill folder (.zip, 7 KB) ↓ · SKILL.md only ↓

Agent prompt

Paste into a coding agent with terminal access. Check the upstream requirements for the skill you’re installing.

Prompt
Install the "workers-profiling" Agent Skill by Cloudflare, from https://github.com/cloudflare/skills.

1. Fetch the whole folder skills/workers-profiling — SKILL.md plus every script, reference, and asset beside it, not just SKILL.md. For example:
   skill_checkout=$(mktemp -d)
   git init "$skill_checkout"
   git -C "$skill_checkout" fetch --depth 1 https://github.com/cloudflare/skills.git 5108325ecceabc899c761e07aa617b09c02445ee
   git -C "$skill_checkout" checkout --detach FETCH_HEAD
2. Copy it into your skills directory as a folder named "workers-profiling":
   - Claude Code: ~/.claude/skills/workers-profiling/ (all projects) or .claude/skills/workers-profiling/ (this project only)
   - Another agent: the directory you load Agent Skills from (folders containing a SKILL.md)
3. Check that workers-profiling/SKILL.md exists and its frontmatter says name: workers-profiling.
4. Read SKILL.md, then tell me in two or three sentences what the skill does and when it will trigger, and list any dependencies it mentions (Python packages, npm packages, CLIs) that aren't installed yet. Don't install them without asking.

skills CLI

One command; the skills.sh installer detects your agents (Claude Code, Cursor, Codex, and more).

Terminal
npx skills add https://github.com/cloudflare/skills/tree/5108325ecceabc899c761e07aa617b09c02445ee/skills/workers-profiling --skill workers-profiling

Claude.ai

Upload the .zip as a custom skill.

  1. In Settings → Capabilities, turn on “Code execution and file creation”.
  2. Download the .zip above.
  3. Go to Customize → Skills, click + → Create skill → Upload a skill, and choose it.
Anthropic’s guide to using skills ↗

Contents

  1. Retrieve the docs
  2. Profiling steps
  3. Inspect the evidence
  4. Optimise
  5. Report findings
  6. Skill feedback

The skill, in full

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 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 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.

Skill feedback

If the user reports that this skill gave incorrect or outdated guidance, or is missing information, read references/skill-feedback.md.

More in Testing & Code Review

All Testing & Code Review skills →

More from Cloudflare

From cloudflare/skills at 5108325, Apache-2.0. Install counts from skills.sh.