Back to Skills

cloudflare-worker

verified

Build edge-first TypeScript applications on Cloudflare Workers. Covers Workers API, Hono framework, KV/D1/R2 storage, Durable Objects, Queues, and testing patterns. Use when creating serverless workers, edge functions, or Cloudflare-deployed services.

View on GitHub

Marketplace

majestic-marketplace

majesticlabs-dev/majestic-marketplace

Plugin

majestic-engineer

Repository

majesticlabs-dev/majestic-marketplace
19stars

plugins/majestic-engineer/skills/cloudflare-worker/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/majesticlabs-dev/majestic-marketplace/blob/main/plugins/majestic-engineer/skills/cloudflare-worker/SKILL.md -a claude-code --skill cloudflare-worker

Installation paths:

Claude
.claude/skills/cloudflare-worker/
Powered by add-skill CLI

Instructions

# Cloudflare Workers

**Development patterns for TypeScript Workers.**

**Related skills (majestic-devops):**
- `wrangler-coder`: CLI deployment, secrets, testing, multi-environment
- `cloudflare-coder`: Infrastructure provisioning with Terraform/OpenTofu

## Core Principles

### Edge-First Thinking

- **Stateless by default**: Workers don't persist state between requests
- **Global distribution**: Code runs in 300+ data centers worldwide
- **Cold start optimized**: V8 isolates start in milliseconds
- **Request/response model**: Each invocation handles one request

### Storage Selection

| Storage | Use Case | Consistency | Latency |
|---------|----------|-------------|---------|
| **KV** | Config, flags, cached data | Eventually consistent | ~10ms |
| **D1** | Relational data, transactions | Strong (single region) | ~30-50ms |
| **R2** | Files, images, large objects | Strong | ~50-100ms |
| **Durable Objects** | Real-time state, WebSockets | Strong (per-object) | ~50ms |
| **Queues** | Async processing, batching | At-least-once | Async |

## Project Structure

```
my-worker/
├── src/
│   ├── index.ts          # Entry point
│   ├── routes/           # Route handlers
│   ├── services/         # Business logic
│   └── types.ts          # Type definitions
├── test/
├── wrangler.toml         # Cloudflare config
├── package.json
└── tsconfig.json
```

## Quick Start

### Minimal wrangler.toml

```toml
name = "my-worker"
main = "src/index.ts"
compatibility_date = "2024-12-01"
compatibility_flags = ["nodejs_compat"]
```

See [resources/setup.md](resources/setup.md) for full configuration with all bindings.

### Basic Hono App

```typescript
import { Hono } from 'hono';
import { Env } from './types';

const app = new Hono<{ Bindings: Env }>();

app.get('/', (c) => c.json({ status: 'ok' }));
app.onError((err, c) => c.json({ error: 'Internal Error' }, 500));
app.notFound((c) => c.json({ error: 'Not Found' }, 404));

export default app;
```

See [resources/hono.md](resources/h

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
4350 chars