Agent skill

Cloudflare Workers Performance

by secondsky in secondsky/claude-skills

Cloudflare Workers performance optimization with CPU, memory, caching, bundle size.

MITAuto-check passedBackend & APIs

Install Cloudflare Workers Performance

skills CLI
$ npx skills add secondsky/claude-skills --skill cloudflare-workers-performance -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills cloudflare-workers-performance --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/cloudflare-workers/skills/cloudflare-workers-performance .claude/skills/cloudflare-workers-performance && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cloudflare-workers-performance
GitHub stars
227
Token cost
~1.6k tokens
SKILL.md length
249 words
Files
11 (incl. scripts, references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Cloudflare Workers performance optimization with CPU, memory, caching, bundle size.

  • Works in 5 steps: Stay under CPU limits - 10ms (free),… → Minimize cold starts - Keep bundles <… → Use Cache API - Cache responses at the… → …
  • Encountering CPU limits
  • SKILL.md covers Quick Wins, Critical Rules, Top 10 Performance Errors and CPU Optimization, plus 7 more sections
  • Runs TypeScript and Shell scripts from its folder

What it does

Cloudflare Workers Performance is an agent skill from secondsky/claude-skills. 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.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 13 other files, including scripts and reference files (for example `references/bundle-optimization.md`, `references/caching-strategies.md` and `references/cold-starts.md`).

It sits in Backend & APIs, covering Caching, Web performance and Performance optimization. It works with Cloudflare Workers. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Encountering CPU limits
  • Tasks that involve Caching
  • Tasks that involve Web performance

Example prompts

  • “/cloudflare-workers-performance”

Requirements

  • Node.js
  • A Bash shell

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  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

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (TypeScript and Shell), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.cloudflare.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cloudflare Workers Performance loads about 1.6k tokens when it runs, and up to ~14k if it reads all its reference files. Until then it costs about 56 tokens; SKILL.md has 249 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~14k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 249 words, ~1,554 tokens.

Download SKILL.mdSave it as .claude/skills/cloudflare-workers-performance/SKILL.md (or your agent's skills folder). This skill also uses 10 other files; get the full folder from GitHub.
name
cloudflare-workers-performance
description
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.
license
MIT

Cloudflare Workers Performance Optimization

Techniques for maximizing Worker performance and minimizing latency.

Quick Wins

typescript
// 1. Avoid unnecessary cloning
// ❌ Bad: Clones entire request
const body = await request.clone().json();

// ✅ Good: Parse directly when not re-using body
const body = await request.json();

// 2. Use streaming instead of buffering
// ❌ Bad: Buffers entire response
const text = await response.text();
return new Response(transform(text));

// ✅ Good: Stream transformation
return new Response(response.body.pipeThrough(new TransformStream({
  transform(chunk, controller) {
    controller.enqueue(process(chunk));
  }
})));

// 3. Cache expensive operations
const cache = caches.default;
const cached = await cache.match(request);
if (cached) return cached;

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

ErrorSymptomFix
CPU limit exceededWorker terminatedOptimize hot paths, use streaming
Cold start latencyFirst request slowReduce bundle size, avoid top-level await
Memory pressureSlow GC, timeoutsStream data, avoid large arrays
KV latencySlow readsUse Cache API, batch reads
D1 slow queriesHigh latencyAdd indexes, optimize SQL
Large bundlesSlow cold startsTree-shake, code split
Blocking operationsRequest timeoutsUse Promise.all, streaming
Unnecessary cloningMemory spikeOnly clone when needed
Missing cacheRepeated computationImplement caching layer
Sync operationsCPU spikesUse async alternatives

CPU Optimization

Profile Hot Paths
typescript
async function profiledHandler(request: Request): Promise<Response> {
  const timing: Record<string, number> = {};

  const time = async <T>(name: string, fn: () => Promise<T>): Promise<T> => {
    const start = Date.now();
    const result = await fn();
    timing[name] = Date.now() - start;
    return result;
  };

  const data = await time('fetch', () => fetchData());
  const processed = await time('process', () => processData(data));
  const response = await time('serialize', () => serialize(processed));

  console.log('Timing:', timing);
  return new Response(response);
}
Optimize JSON Operations
typescript
// For large JSON, use streaming parser
import { JSONParser } from '@streamparser/json';

async function parseStreamingJSON(stream: ReadableStream): Promise<unknown[]> {
  const parser = new JSONParser();
  const results: unknown[] = [];

  parser.onValue = (value) => results.push(value);

  for await (const chunk of stream) {
    parser.write(chunk);
  }

  return results;
}

Memory Optimization

Avoid Large Arrays
typescript
// ❌ Bad: Loads all into memory
const items = await db.prepare('SELECT * FROM items').all();
const processed = items.results.map(transform);

// ✅ Good: Process in batches
async function* batchProcess(db: D1Database, batchSize = 100) {
  let offset = 0;
  while (true) {
    const { results } = await db
      .prepare('SELECT * FROM items LIMIT ? OFFSET ?')
      .bind(batchSize, offset)
      .all();

    if (results.length === 0) break;

    for (const item of results) {
      yield transform(item);
    }
    offset += batchSize;
  }
}

Caching Strategies

Multi-Layer Cache
typescript
interface CacheLayer {
  get(key: string): Promise<unknown | null>;
  set(key: string, value: unknown, ttl?: number): Promise<void>;
}

// Layer 1: In-memory (request-scoped)
const memoryCache = new Map<string, unknown>();

// Layer 2: Cache API (edge-local)
const edgeCache: CacheLayer = {
  async get(key) {
    const response = await caches.default.match(new Request(`https://cache/${key}`));
    return response ? response.json() : null;
  },
  async set(key, value, ttl = 60) {
    await caches.default.put(
      new Request(`https://cache/${key}`),
      new Response(JSON.stringify(value), {
        headers: { 'Cache-Control': `max-age=${ttl}` }
      })
    );
  }
};

// Layer 3: KV (global)
// Use env.KV.get/put

Bundle Optimization

typescript
// 1. Tree-shake imports
// ❌ Bad
import * as lodash from 'lodash';

// ✅ Good
import { debounce } from 'lodash-es';

// 2. Lazy load heavy dependencies
let heavyLib: typeof import('heavy-lib') | undefined;

async function getHeavyLib() {
  if (!heavyLib) {
    heavyLib = await import('heavy-lib');
  }
  return heavyLib;
}

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

TemplatePurposeUse When
templates/performance-middleware.tsPerformance monitoringAdding timing/profiling
templates/caching-layer.tsMulti-layer cachingImplementing cache
templates/optimized-worker.tsPerformance patternsStarting optimized worker

Scripts

ScriptPurposeCommand
scripts/benchmark.shLoad testing./benchmark.sh <url>
scripts/profile-worker.shCPU profiling./profile-worker.sh

Resources

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 10 other files (scripts, references) in plugins/cloudflare-workers/skills/cloudflare-workers-performance of secondsky/claude-skills.

  • SKILL.md
  • references/bundle-optimization.md
  • references/caching-strategies.md
  • references/cold-starts.md
  • references/cpu-optimization.md
  • references/memory-optimization.md
  • scripts/benchmark.sh
  • scripts/profile-worker.sh
  • templates/caching-layer.ts
  • templates/optimized-worker.ts
  • templates/performance-middleware.ts

Open the folder on GitHubat commit 8837836

Compare with similar skills

Cloudflare Workers Performance next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cloudflare Workers Performance compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cloudflare Workers Performance this skillsecondsky/claude-skills227—~1.6kAutomated safety check: PassMIT
Zhihu Performance Regression Reviewzly2006/zhihu-plus-plus4.2k—~868Automated safety check: PassAGPL-3.0
Electron DevTools Trace Analysiskeybase/client9.3k—~809Automated safety check: PassBSD-3-Clause
Keybase RPC Log Analysiskeybase/client9.3k—~3kAutomated safety check: PassBSD-3-Clause
Performance CheckZeroDeng01/sublinkPro1.7k—~1.8kAutomated safety check: PassMIT
React Best Practicesryokun6/ryos1.3k—~2kAutomated safety check: PassMIT

Similar skills

  • Review and fix Zhihu++ functional regressions caused by performance optimizations.

    4.2k GitHub stars~868 tokensUpdated today
    Backend & APIsAuto-check passed
  • Analyzes Chrome or Electron DevTools Performance trace exports with Python scripts to find where render time actually goes, without opening DevTools.

    9.3k GitHub stars~809 tokensUpdated today
    DevelopmentAuto-check passed
  • Captures a clean Keybase service log and analyzes it for redundant, duplicated or looping RPCs, then checks whether a caching fix reduced the calls.

    9.3k GitHub stars~3k tokensUpdated today
    DevelopmentAuto-check passed
  • Performance Check

    ZeroDeng01/sublinkPro

    Checklist for reviewing code changes that touch queries, APIs, rendering, caching or algorithms for performance, scalability and resource-usage problems.

    1.7k GitHub stars~1.8k tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • React performance optimization guidelines from Vercel Engineering (vercel-labs/agent-skills).

    1.3k GitHub stars~2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Searches synthetic workloads for cases where Caffeine's adaptive eviction policy falls short of its achievable hit rate, then classifies each gap by cause.

    18k GitHub stars~16k tokensUpdated 2 days ago
    DevelopmentAuto-check: notes

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Questions about Cloudflare Workers Performance

What does Cloudflare Workers Performance do?

Cloudflare Workers performance optimization with CPU, memory, caching, bundle size. Cloudflare Workers Performance is an agent skill from secondsky/claude-skills. Cloudflare Workers performance optimization with CPU, memory, caching, bundle size.

When should I use Cloudflare Workers Performance?

Cloudflare Workers Performance fits situations like: encountering CPU limits; tasks that involve Caching; tasks that involve Web performance.

How do I install Cloudflare Workers Performance in Claude Code?

Run `npx skills add secondsky/claude-skills --skill cloudflare-workers-performance -a claude-code`. Or copy the skill folder (plugins/cloudflare-workers/skills/cloudflare-workers-performance in secondsky/claude-skills) into .claude/skills/cloudflare-workers-performance in your project. Claude Code loads it when a task matches its description.

How do I install Cloudflare Workers Performance in Codex?

Run `npx skills add secondsky/claude-skills --skill cloudflare-workers-performance -a codex`. Or copy the skill folder (plugins/cloudflare-workers/skills/cloudflare-workers-performance in secondsky/claude-skills) into .agents/skills/cloudflare-workers-performance in your project. Codex loads it when a task matches its description.

Can I use Cloudflare Workers Performance in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill cloudflare-workers-performance -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cloudflare-workers-performance, .gemini/skills/cloudflare-workers-performance, .github/skills/cloudflare-workers-performance and .opencode/skills/cloudflare-workers-performance in your project.

What does Cloudflare Workers Performance need to run?

Going by SKILL.md and its folder, Cloudflare Workers Performance needs TypeScript and a shell for the scripts in its folder. Our summary lists: Node.js; A Bash shell.

Does Cloudflare Workers Performance access the network?

SKILL.md names 1 domain. As links in the text: developers.cloudflare.com. This is read from the text; nothing was executed.

Is Cloudflare Workers Performance safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Cloudflare Workers Performance use?

Cloudflare Workers Performance is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cloudflare Workers Performance use?

About 1.6k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 12k tokens, read only when the agent opens those files.

What are the alternatives to Cloudflare Workers Performance?

Skills that share tags, products or a category with Cloudflare Workers Performance: Zhihu Performance Regression Review (zly2006/zhihu-plus-plus, 4.2k stars), Electron DevTools Trace Analysis (keybase/client, 9.3k stars), Keybase RPC Log Analysis (keybase/client, 9.3k stars) and Performance Check (ZeroDeng01/sublinkPro, 1.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cloudflare Workers Performance?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.