cloudflare-workers-expert

Expert in Cloudflare Workers and the Edge Computing ecosystem. Covers Wrangler, KV, D1, Durable Objects, and R2 storage.

6 stars

Best use case

cloudflare-workers-expert is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Expert in Cloudflare Workers and the Edge Computing ecosystem. Covers Wrangler, KV, D1, Durable Objects, and R2 storage.

Teams using cloudflare-workers-expert should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/cloudflare-workers-expert/SKILL.md --create-dirs "https://raw.githubusercontent.com/netbarros/psique/main/.codex/skills/cloudflare-workers-expert/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/cloudflare-workers-expert/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How cloudflare-workers-expert Compares

Feature / Agentcloudflare-workers-expertStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Expert in Cloudflare Workers and the Edge Computing ecosystem. Covers Wrangler, KV, D1, Durable Objects, and R2 storage.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

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

```typescript
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

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

Related Skills

typescript-expert

6
from netbarros/psique

TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling.

threat-modeling-expert

6
from netbarros/psique

Expert in threat modeling methodologies, security architecture review, and risk assessment. Masters STRIDE, PASTA, attack trees, and security requirement extraction. Use for security architecture r...

swiftui-expert-skill

6
from netbarros/psique

Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption. Use when buil...

service-mesh-expert

6
from netbarros/psique

Expert service mesh architect specializing in Istio, Linkerd, and cloud-native networking patterns. Masters traffic management, security policies, observability integration, and multi-cluster mesh con

prisma-expert

6
from netbarros/psique

Prisma ORM expert for schema design, migrations, query optimization, relations modeling, and database operations. Use PROACTIVELY for Prisma schema issues, migration problems, query performance, re...

nosql-expert

6
from netbarros/psique

Expert guidance for distributed NoSQL databases (Cassandra, DynamoDB). Focuses on mental models, query-first modeling, single-table design, and avoiding hot partitions in high-scale systems.

nestjs-expert

6
from netbarros/psique

Nest.js framework expert specializing in module architecture, dependency injection, middleware, guards, interceptors, testing with Jest/Supertest, TypeORM/Mongoose integration, and Passport.js auth...

n8n-mcp-tools-expert

6
from netbarros/psique

Expert guide for using n8n-mcp MCP tools effectively. Use when searching for nodes, validating configurations, accessing templates, managing workflows, or using any n8n-mcp tool. Provides tool sele...

mermaid-expert

6
from netbarros/psique

Create Mermaid diagrams for flowcharts, sequences, ERDs, and architectures. Masters syntax for all diagram types and styling.

laravel-expert

6
from netbarros/psique

Senior Laravel Engineer role for production-grade, maintainable, and idiomatic Laravel solutions. Focuses on clean architecture, security, performance, and modern standards (Laravel 10/11+).

kotlin-coroutines-expert

6
from netbarros/psique

Expert patterns for Kotlin Coroutines and Flow, covering structured concurrency, error handling, and testing.

flutter-expert

6
from netbarros/psique

Master Flutter development with Dart 3, advanced widgets, and multi-platform deployment.