# Profile Cloudflare Workers CPU and Memory

CPU hotspots and memory allocation pressure can make deployed Workers and Durable Objects difficult to diagnose. This skill guides profiling, evidence analysis, and targeted optimization.

## Install

```bash
npx skillstore add cloudflare/workers-profiling
```

## Metadata

- Status: approved
- Slug: cloudflare-workers-profiling
- Skillstore revision: r1
- Version status: missing
- Tree hash: 3c0d53835dd05d047307e15797d909d7706ab47b3d22b6dbc60676151d3280f8
- Author: cloudflare
- GitHub username: cloudflare
- License: MIT
- Repository: https://github.com/cloudflare/skills/tree/c430dd965cea3a8faf0ef035e3b3d73b38518081/skills/workers-profiling
- Ref: 919ee28dc01b50c3ac40238df51719a4c8d20e40
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/cloudflare-workers-profiling
- Manifest: https://skillstore.pages.dev/api/skills/cloudflare-workers-profiling/manifest

## Capabilities

- Guide confirmation of the account, Worker, environment, deployed version, and Durable Object identity before profiling.
- Consult the current Cloudflare guide to select supported CPU or heap profiling types.
- Guide profile capture using the cf CLI, with installed command help and schema checks where available.
- Analyze pprof evidence for hotspots and map findings to functions and source locations when supported.
- Recommend source maps for generated JavaScript and propose minimal changes with steps to check their effects.

## Use Cases

- Investigate Worker CPU usage: Inspect production CPU profiles, identify expensive functions, and propose a targeted change with a verification plan.
- Diagnose Durable Object memory growth: Confirm the owning Worker, namespace, and instance before selecting an appropriate profile and examining memory evidence.
- Review optimization evidence: Connect profiling metrics to source locations and evaluate whether a proposed code change addresses the observed hotspot.

## Prompt Templates

### Begin a profiling investigation

```
Help me investigate high CPU usage in my deployed Cloudflare Worker. Ask for the account, environment, deployed version, and affected workload before proceeding.
```

### Prepare a CPU profile capture

```
Guide CPU profile capture for [Worker] in [environment]. Consult current Cloudflare documentation and inspect installed cf help before recommending commands.
```

### Analyze Durable Object memory evidence

```
Analyze my supplied Durable Object pprof capture for allocation pressure or memory growth. Confirm the target instance and report supported metrics and missing symbols.
```

### Propose an evidence-based optimization

```
Review my supplied profile and source for [Worker]. Identify supported hotspots, propose the smallest change, and explain how to check its effect.
```

## Limitations

- This skill provides instructions, not a bundled profiler or executable implementation.
- Profile capture requires access to the deployed target and suitable external tooling.
- Supported profiling types and command syntax depend on current documentation and the installed CLI version.
- Missing symbols or source maps can prevent attribution to original source locations.

## Best Practices

- Confirm the exact deployment and Durable Object identity with the user before capture.
- Use current documentation and installed CLI help to verify supported profiling options.
- Tie each optimization to captured evidence and check its effect under a comparable workload.

## Anti Patterns

- Capture profiles before confirming the correct account, environment, and deployed version.
- Invent source locations or metric meanings when symbols or mappings are missing.
- Make broad code changes without profile evidence or a plan to check their effects.

## Security Audit

- Audited at: 2026-10-11T14:34:16.006\+00:00
- Summary: All four static findings are false positives: Markdown backticks name profiling tools, and the URL links to official Cloudflare documentation. No evidence found of prompt injection, credential theft, or data exfiltration in SKILL.md. The workflow confirms deployment targets and suggests asking before installing missing tooling.

## Stats

- Views: 0
- Downloads: 1
- Favorites: 0
- Popularity score: 0
