ericrisco/rsc-harness / skills/cloudflare
cloudflare
VerifiedUse when working on Cloudflare's edge platform — wrangler.jsonc bindings, choosing between D1/KV/R2/Durable Objects/Queues, deploying a Worker or SPA via Static Assets, or designing around a Workers runtime limit. NOT generic CI/release (that is `deployment`), NOT Next.js framework wiring (that is `nextjs`), NOT DNS records (that is `domains-dns`).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.1 KB |
| evals/README.md | markdown | 1020 B |
| evals/cases.yaml | config | 3.0 KB |
| references/storage-primitives.md | markdown | 4.4 KB |
| references/wrangler-config.md | markdown | 4.1 KB |
| scripts/verify.shexecutable | script | 5.2 KB |
references/wrangler-config.md
View on GitHub# wrangler.jsonc — full config, environments, migration
Config may be `wrangler.toml`, `wrangler.json`, or `wrangler.jsonc`. Prefer **jsonc** so bindings can carry comments. Wrangler is **v4**. Minimum keys: `name`, `main`, `compatibility_date`.
## Annotated config
```jsonc
{
"name": "my-app",
"main": "src/index.ts",
// Set to the date you start the project. It pins runtime + flag defaults so deploys
// are reproducible. Bump it deliberately to opt into newer behavior.
"compatibility_date": "2026-06-02",
// Flags toggle behaviors not yet default for your date. nodejs_compat auto-enables
// at compatibility_date 2025-10-01+, so you can drop it once you bump past that.
"compatibility_flags": ["nodejs_compat"],
"observability": { "enabled": true }, // structured logs in the dashboard
"vars": { "API_BASE": "https://api.example.com" }, // non-secret config only
"assets": {
"directory": "./dist",
"binding": "ASSETS",
"not_found_handling": "single-page-application", // or "404-page"
"run_worker_first": true // Worker runs before static serving (API routes)
},
"r2_buckets": [{ "binding": "BUCKET", "bucket_name": "uploads" }],
"d1_databases": [{ "binding": "DB", "database_name": "app", "database_id": "<id>" }],
"kv_namespaces":[{ "binding": "CACHE", "id": "<namespace-id>" }],
"queues": {
"producers": [{ "binding": "JOBS", "queue": "thumbnails" }],
"consumers": [{ "queue": "thumbnails", "max_batch_size": 10, "max_retries": 3,
"dead_letter_queue": "thumbnails-dlq" }]
},
// Named environments inherit top-level config and override per env.
"env": {
"staging": {
"vars": { "API_BASE": "https://staging-api.example.com" },
"d1_databases": [{ "binding": "DB", "database_name": "app-staging", "database_id": "<id>" }]
}
}
}
```
Deploy a named env: `wrangler deploy --env staging`.
## Routes & custom domains
```jsonc
"routes": [
{ "pattern": "app.example.com", "custom_domain": true }, // Cloudflare-managed cert
{ "pattern": "example.com/api/*", "zone_name": "example.com" }
]
```
`workers_dev: false` disables the `*.workers.dev` URL once you have a custom domain. DNS records themselves (A/CNAME/MX) are the Cloudflare DNS product — see `../../domains-dns/SKILL.md`.
## Compatibility dates & flags
- `compatibility_date` pins the runtime semantics for your Worker. Set it once at project start; bumping it can change defaults.
- `compatibility_flags` opt into individual behaviors ahead of or behind the date. Example: `nodejs_compat` auto-enables at `2025-10-01`+.
- Reproducibility rule: never leave `compatibility_date` unset. An unpinned Worker silently shifts behavior across deploys.
## Static Assets routing options
- `not_found_handling: "single-page-application"` — serve `index.html` on any miss (client-side router).
- `not_found_handling: "404-page"` — serve `/404.html`.
- `run_worker_first: true` — invoke the Worker before serving assets, so `/api/*` reaches your handler.
- Without `run_worker_first`, a matching static file is served and the Worker never runs for that path.
## Pages → Workers migration checklist
Workers Static Assets is the recommended target for new full-stack work; Pages still functions but new projects point at Workers. Workers Sites is deprecated in Wrangler v4 — do not use it.
1. Move build output dir into `assets.directory` (e.g. `./dist`).
2. Replace Pages Functions in `functions/` with a single Worker `main` entrypoint that routes (`run_worker_first` for API paths).
3. Convert Pages bindings (dashboard) into `wrangler.jsonc` binding blocks.
4. Set `compatibility_date` + needed `compatibility_flags`.
5. `wrangler deploy` and verify each binding resolves (run `verify.sh` / `--dry-run`).
6. Remove any `[site]` / `site =` Workers-Sites config — it is deprecated and unsupported by the Vite plugin.
## Scaffolding
```bash
npm create cloudflare@latest my-app # plain Worker
npm create cloudflare@latest my-app -- --framework=react # Vite + React SPA (GA plugin)
```
C3 picks a correct `compatibility_date` and generates `Env` types — start here rather than hand-writing config.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |