Production-ready Cloudflare Workers setup with Hono, Vite, and Static Assets preventing 10 documented issues.
Works with
Prevents critical routing conflicts (API routes returning index.html ), export syntax errors, HMR race conditions, and Vite 8+ compatibility issues through tested configuration patterns
Includes auto-provisioning for R2, D1, and KV resources (Wrangler 4.45+), Workers RPC for service-to-service calls, and gradual rollout asset mismatch handling
Covers free tier 429 errors with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versioncloudflare-worker-baseExecute the skills CLI command in your project's root directory to begin installation:
Fetches cloudflare-worker-base from jezweb/claude-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate cloudflare-worker-base. Access via /cloudflare-worker-base in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
697
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
697
stars
Production-tested: cloudflare-worker-base-test (https://cloudflare-worker-base-test.webfonts.workers.dev) Last Updated: 2026-01-20 Status: Production Ready ✅ Latest Versions: [email protected], @cloudflare/[email protected], [email protected], [email protected] Skill Version: 3.1.0
Recent Updates (2025-2026):
wrangler deploy --x-autoconfig)WorkerEntrypoint class for service bindings# 1. Scaffold project
npm create cloudflare@latest my-worker -- --type hello-world --ts --git --deploy false --framework none
# 2. Install dependencies
cd my-worker
npm install [email protected]
npm install -D @cloudflare/[email protected] [email protected]
# 3. Create wrangler.jsonc
{
"name": "my-worker",
"main": "src/index.ts",
"account_id": "YOUR_ACCOUNT_ID",
"compatibility_date": "2025-11-11",
"assets": {
"directory": "./public/",
"binding": "ASSETS",
"not_found_handling": "single-page-application",
"run_worker_first": ["/api/*"] // CRITICAL: Prevents SPA fallback from intercepting API routes
}
}
# 4. Create vite.config.ts
import { defineConfig } from 'vite'
import { cloudflare } from '@cloudflare/vite-plugin'
export default defineConfig({ plugins: [cloudflare()] })
# 5. Create src/index.ts
import { Hono } from 'hono'
type Bindings = { ASSETS: Fetcher }
const app = new Hono<{ Bindings: Bindings }>()
app.get('/api/hello', (c) => c.json({ message: 'Hello!' }))
app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
export default app // CRITICAL: Use this pattern (NOT { fetch: app.fetch })
# 6. Deploy
npm run dev # Local: http://localhost:8787
wrangler deploy # Production
Critical Configuration:
run_worker_first: ["/api/*"] - Without this, SPA fallback intercepts API routes returning index.html instead of JSON (workers-sdk #8879)export default app - Using { fetch: app.fetch } causes "Cannot read properties of undefined" (honojs/hono #3955)This skill prevents 10 documented issues:
Error: "Cannot read properties of undefined (reading 'map')"
Source: honojs/hono #3955
Prevention: Use export default app (NOT { fetch: app.fetch })
Error: API routes return index.html instead of JSON
Source: workers-sdk #8879
Prevention: Add "run_worker_first": ["/api/*"] to wrangler.jsonc
Error: "Handler does not export a scheduled() function" Source: honojs/vite-plugins #275 Prevention: Use Module Worker format when needed:
export default {
fetch: app.fetch,
scheduled: async (event, env, ctx) => { /* ... */ }
}
Error: "A hanging Promise was canceled" during development
Source: workers-sdk #9518
Prevention: Use @cloudflare/[email protected] or later
Error: Non-deterministic deployment failures in CI/CD Source: workers-sdk #7555 Prevention: Use Wrangler 4.x+ with retry logic (fixed in recent versions)
Error: Using deprecated Service Worker format Source: Cloudflare migration guide Prevention: Always use ES Module format
Error: 404 errors for fingerprinted assets during gradual deployments
Source: Cloudflare Static Assets Docs
Why It Happens: Modern frameworks (React/Vue/Angular with Vite) generate fingerprinted filenames (e.g., index-a1b2c3d4.js). During gradual rollouts between versions, a user's initial request may go to Version A (HTML references index-a1b2c3d4.js), but subsequent asset requests route to Version B (only has index-m3n4o5p6.js), causing 404s
Prevention:
Error: 429 (Too Many Requests) responses on asset requests when exceeding free tier limits
Source: Cloudflare Static Assets Billing Docs
Why It Happens: When using run_worker_first, requests matching specified patterns ALWAYS invoke your Worker script (counted toward free tier limits). After exceeding limits, these requests receive 429 instead of falling back to free static asset serving
Prevention:
!/pattern) to exclude paths from Worker invocationrun_worker_first patterns to only essential API routesError: Calling require for "buffer" in an environment that doesn't expose the require function
Source: workers-sdk #11948
Affected Versions: Vite 8.x with @cloudflare/vite-plugin 1.21.0+
Why It Happens: Vite 8 uses Rolldown bundler which doesn't convert require() to import for external modules. Workers don't expose require() function, causing Node built-in module imports to fail at runtime.
Prevention:
// vite.config.ts - Add esmExternalRequirePlugin
import { defineConfig } from 'vite'
import { cloudflare } from '@cloudflare/vite-plugin'
import { esmExternalRequirePlugin } from 'vite'
import { builtinModules } from 'node:module'
export default defineConfig({
plugins: [
cloudflare(),
esmExternalRequirePlugin({
external: [/^node:/, ...builtinModules],
}),
],
})
Status: Workaround available. Vite team working on fix (vitejs/vite#21452).
Error: curl http://localhost:5173/prefix returns 404 instead of index.html
Source: workers-sdk #11857
Affected Versions: @cloudflare/vite-plugin 1.13.8+
Why It Happens: Plugin now passes full URL with base path to Asset Worker (matching prod behavior). Platform support for assets.base not yet available.
Prevention (dev-mode workaround):
// worker.ts - Strip base path in development
if (import.meta.env.DEV) {
url.pathname = url.pathname.replace(import.meta.env.BASE_URL, '');
if (url.pathname === '/') {
return this.env.ASSETS.fetch(request);
}
request = new Request(url, request);
}
Status: Intentional change to align dev with prod. Platform feature assets.base planned for Q1 2026 (workers-sdk #9885).
Critical Understanding: "not_found_handling": "single-page-application" returns index.html for unknown routes (enables React Router, Vue Router). Without run_worker_first, this intercepts API routes!
Request Routing with run_worker_first: ["/api/*"]:
/api/hello → Worker handles (returns JSON)/ → Static Assets serve index.html/styles.css → Static Assets serve styles.css/unknown → Static Assets serve index.html (SPA fallback)Static Assets Caching: Automatic edge caching. Cache bust with query strings: <link href="/styles.css?v=1.0.0">
Free Tier Warning (2025): run_worker_first patterns count toward free tier limits. After exceeding, requests get 429 instead of falling back to free static assets. Use negative patterns (!/pattern) or upgrade to Paid plan.
Default Behavior: Wrangler automatically provisions R2 buckets, D1 databases, and KV namespaces when deploying. This eliminates manual resource creation steps.
Critical: Always Specify Resource Names
⚠️ Edge Case (workers-sdk #11870): If you provide only binding without database_name/bucket_name, Wrangler uses the binding name as the resource name. This causes confusing behavior with wrangler dev and subcommands, which prefer database_id → database_name → binding.
// ❌ DON'T: Binding-only creates database named "DB"
{
"d1_databases": [{ "binding": "DB" }]
}
// ✅ DO: Explicit names prevent confusion
{
"d1_databases": [
{
"binding": "DB",
"database_name": "my-app-db" // Always specify!
Implementation Guide
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
- 1Install skill using provided installation command
- 2Test with simple use case relevant to your work
- 3Evaluate output quality and relevance
- 4Iterate on prompts to improve results
- 5Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Related Skills
wordpress-elementor
128jezweb/claude-skills
Productivitysame reporeact-native
22jezweb/claude-skills
Frontendsame repozustand-state-management
7jezweb/claude-skills
Productivitysame repoonboarding-ux
4jezweb/claude-skills
Productivitysame repoicon-set-generator
4jezweb/claude-skills
Productivitysame repodependency-audit
4jezweb/claude-skills
Productivitysame repoReviews
4.6★★★★★69 reviews- AArya Perez★★★★★Dec 24, 2024
Registry listing for cloudflare-worker-base matched our evaluation — installs cleanly and behaves as described in the markdown.
- AArya Ramirez★★★★★Dec 24, 2024
cloudflare-worker-base fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- AArya Park★★★★★Dec 24, 2024
cloudflare-worker-base reduced setup friction for our internal harness; good balance of opinion and flexibility.
- AArya Khan★★★★★Dec 16, 2024
Solid pick for teams standardizing on skills: cloudflare-worker-base is focused, and the summary matches what you get after install.
- RRen Ghosh★★★★★Dec 16, 2024
Useful defaults in cloudflare-worker-base — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- HHana Haddad★★★★★Dec 12, 2024
I recommend cloudflare-worker-base for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- HHana Yang★★★★★Nov 23, 2024
Useful defaults in cloudflare-worker-base — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- DDev Kapoor★★★★★Nov 15, 2024
We added cloudflare-worker-base from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- CCamila Dixit★★★★★Nov 15, 2024
cloudflare-worker-base has been reliable in day-to-day use. Documentation quality is above average for community skills.
- LLiam Abbas★★★★★Nov 7, 2024
I recommend cloudflare-worker-base for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
showing 1-10 of 69
1 / 7Discussion
Comments — not star reviews- No comments yet — start the thread.