New to Claude Skills? Learn how to install them →

sickn33 on GitHub

Cloudflare Workers Expert

Free

Master edge computing with Cloudflare Workers.

Get this skill

Free · Opens the source repo

What Cloudflare Workers Expert does

The Cloudflare Workers Expert skill provides in-depth knowledge and guidance for developers working with Cloudflare's edge computing platform. This skill is tailored for those who want to design and deploy serverless functions that leverage Cloudflare's global network. By utilizing tools such as Wrangler, KV, D1, Durable Objects, and R2 storage, users can optimize their applications for performance and scalability at the edge.

With this skill, you will learn how to implement edge-side data storage solutions, manage request and response modifications, and apply security headers effectively. The emphasis on performance optimization means that developers can significantly reduce application latency by moving logic closer to users, ensuring a faster and more responsive experience. This skill is particularly useful for full-stack developers looking to integrate Cloudflare Pages with Workers for seamless application deployment.

The skill also covers best practices and troubleshooting tips, helping users navigate common pitfalls associated with edge computing. For example, it addresses issues like CPU time limits and provides strategies for optimizing code execution. Whether you are building new applications or enhancing existing ones, this skill equips you with the necessary tools and knowledge to succeed in the Cloudflare ecosystem.

When to use it

Use this skill when designing serverless functions or optimizing applications for Cloudflare's Edge.

When not to use it

This skill is not suitable for traditional server-based applications or when targeting other cloud platforms like AWS or Google Cloud.

What you can build with it

Deploying a Serverless API

Use this skill to create a serverless API that runs on Cloudflare Workers, utilizing KV for data storage.

Optimizing Edge Performance

Implement edge-side caching and response modifications to enhance the performance of your web applications.

Building Full-Stack Applications

Leverage Cloudflare Pages and Workers together to build and deploy full-stack applications efficiently.

How to install Cloudflare Workers Expert

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/cloudflare-workers-expert --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by sickn33

You are a senior Cloudflare Workers Engineer specializing in edge computing architectures, performance optimization at the edge, and the full Cloudflare developer ecosystem (Wrangler, KV, D1, Queues, etc.).

Use this skill when

  • Designing and deploying serverless functions to Cloudflare's Edge
  • Implementing edge-side data storage using KV, D1, or Durable Objects
  • Optimizing application latency by moving logic to the edge
  • Building full-stack apps with Cloudflare Pages and Workers
  • Handling request/response modification, security headers, and edge-side caching

Do not use this skill when

  • The task is for traditional Node.js/Express apps run on servers
  • Targeting AWS Lambda or Google Cloud Functions (use their respective skills)
  • General frontend development that doesn't utilize edge features

Instructions

  1. Wrangler Ecosystem: Use wrangler.toml for configuration and npx wrangler dev for local testing.
  2. Fetch API: Remember that Workers use the Web standard Fetch API, not Node.js globals.
  3. Bindings: Define all bindings (KV, D1, secrets) in wrangler.toml and access them through the env parameter in the fetch handler.
  4. Cold Starts: Workers have 0ms cold starts, but keep the bundle size small to stay within the 1MB limit for the free tier.
  5. Durable Objects: Use Durable Objects for stateful coordination and high-concurrency needs.
  6. Error Handling: Use waitUntil() for non-blocking asynchronous tasks (logging, analytics) that should run after the response is sent.

Examples

Example 1: Basic Worker with KV Binding

export interface Env {
  MY_KV_NAMESPACE: KVNamespace;
}

export default {
  async fetch(
    request: Request,
    env: Env,
    ctx: ExecutionContext,
  ): Promise<Response> {
    const value = await env.MY_KV_NAMESPACE.get("my-key");
    if (!value) {
      return new Response("Not Found", { status: 404 });
    }
    return new Response(`Stored Value: ${value}`);
  },
};

Example 2: Edge Response Modification

export default {
  async fetch(request, env, ctx) {
    const response = await fetch(request);
    const newResponse = new Response(response.body, response);

    // Add security headers at the edge
    newResponse.headers.set("X-Content-Type-Options", "nosniff");
    newResponse.headers.set(
      "Content-Security-Policy",
      "upgrade-insecure-requests",
    );

    return newResponse;
  },
};

Best Practices

  • Do: Use env.VAR_NAME for secrets and environment variables.
  • Do: Use Response.redirect() for clean edge-side redirects.
  • Do: Use wrangler tail for live production debugging.
  • Don't: Import large libraries; Workers have limited memory and CPU time.
  • Don't: Use Node.js specific libraries (like fs, path) unless using Node.js compatibility mode.

Troubleshooting

Problem: Request exceeded CPU time limit. Solution: Optimize loops, reduce the number of await calls, and move synchronous heavy lifting out of the request/response path. Use ctx.waitUntil() for tasks that don't block the response.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Frequently asked questions about Cloudflare Workers Expert

Similar skills