jezweb/claude-skills / archive/plugins/cloudflare/skills/cloudflare-worker-builder
cloudflare-worker-builder
VerifiedScaffold and deploy Cloudflare Workers with Hono routing, Vite plugin, and Static Assets. Describe project, scaffold structure, configure bindings, deploy. Use whenever the user wants to create a Worker project, set up Hono on Cloudflare, configure D1 / R2 / KV / Queues bindings, or troubleshoot Worker export syntax, API route conflicts, HMR issues, or deployment failures.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.7 KB |
| assets/package.json | manifest | 485 B |
| assets/public/index.html | other | 1.9 KB |
| assets/public/script.js | script | 2.0 KB |
| assets/public/styles.css | other | 2.5 KB |
| assets/src/index.ts | script | 1.9 KB |
| assets/tsconfig.json | config | 1.5 KB |
| assets/vite.config.ts | script | 273 B |
| assets/wrangler.jsonc | other | 1.7 KB |
| references/architecture.md | markdown | 10.7 KB |
| references/common-issues.md | markdown | 13.7 KB |
| references/deployment.md | markdown | 14.5 KB |
assets/src/index.ts
View on GitHub/**
* Cloudflare Worker with Hono
*
* CRITICAL: Export pattern to prevent "Cannot read properties of undefined (reading 'map')" error
* See: https://github.com/honojs/hono/issues/3955
*
* ✅ CORRECT: export default app (for Hono apps)
* ❌ WRONG: export default { fetch: app.fetch } (causes build errors with Vite)
*
* Exception: If you need multiple handlers (scheduled, tail, etc.), use Module Worker format:
* export default {
* fetch: app.fetch,
* scheduled: async (event, env, ctx) => { ... }
* }
*/
import { Hono } from 'hono'
// Type-safe environment bindings
type Bindings = {
ASSETS: Fetcher
}
const app = new Hono<{ Bindings: Bindings }>()
/**
* API Routes
*
* These routes are handled by the Worker BEFORE static assets due to
* "run_worker_first": ["/api/*"] in wrangler.jsonc
*/
app.get('/api/hello', (c) => {
return c.json({
message: 'Hello from Cloudflare Workers!',
timestamp: new Date().toISOString(),
})
})
app.get('/api/data', (c) => {
return c.json({
items: [
{ id: 1, name: 'Item 1', description: 'First item' },
{ id: 2, name: 'Item 2', description: 'Second item' },
{ id: 3, name: 'Item 3', description: 'Third item' },
],
count: 3,
})
})
app.post('/api/echo', async (c) => {
const body = await c.req.json()
return c.json({
received: body,
method: c.req.method,
})
})
/**
* Health check endpoint
*/
app.get('/api/health', (c) => {
return c.json({
status: 'ok',
version: '1.0.0',
environment: c.env ? 'production' : 'development',
})
})
/**
* Fallback to Static Assets
*
* Any route not matched above will be served from the public/ directory
* thanks to Workers Static Assets
*/
app.all('*', (c) => {
// Let Cloudflare Workers handle static assets automatically
return c.env.ASSETS.fetch(c.req.raw)
})
/**
* Export the Hono app directly (ES Module format)
* This is the correct pattern for Cloudflare Workers with Hono + Vite
*/
export default app
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 |