Token导航 LogoToken导航

Agent Skill · 开发

cloudflare-worker-base(cloudflare 工人基地)

cloudflare-worker-base 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

cloudflare-worker-base 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,暂无第三方扫描结果,按安装量在开发类的 21,746 个 Skill 里排第 3,990。

总安装 9,408周安装 416GitHub Stars 750下载 3,296核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cloudflare-worker-base(cloudflare 工人基地)
来源仓库:https://github.com/jezweb/claude-skills
仓库路径:skills/cloudflare-worker-base
安装命令:
npx skills add https://github.com/jezweb/claude-skills --skill cloudflare-worker-base
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jezweb/claude-skills --skill cloudflare-worker-base

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

生产就绪的 Cloudflare Workers 设置为 Hono、Vite 和静态资产,可防止 10 个已记录的问题。

防止严重的路由冲突(API 路由返回index.html )、通过测试的配置模式导出语法错误、HMR 竞争条件和 Vite 8+ 兼容性问题 包括自动配置 R2、D1 和 KV 资源 (Wrangler 4.45+)、用于服务到服务调用的 Workers RPC,以及逐步推出资产不匹配处理 使用 run_worker_first 覆盖免费层 429 错误 、缓存损坏故障排除以及 vite-tsconfig-paths 和 uuid 包冲突的社区解决方法 提供 5 分钟快速启动、完整的 wrangler.jsonc/vite.config.ts 模板以及带有飞行前验证的一命令部署管道

来源仓库内路径:skills/cloudflare-worker-base

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/jezweb/claude-skills --skill cloudflare-worker…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

cloudflare-worker-base 怎么安装?

在终端执行 npx skills add https://github.com/jezweb/claude-skills --skill cloudflare-worker-base。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

cloudflare-worker-base 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

cloudflare-worker-base 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

cloudflare-worker-base 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

cloudflare-worker-base 用的人多吗?

公开数据是累计安装 9,408 次,近一周安装 416 次,下载 3,296 次,GitHub 750 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

cloudflare-worker-base 安全吗?

没有查到第三方扫描结果,安全性无法从公开资料判断,安装前请自行审查源码、依赖和命令行为。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 没有第三方扫描结果,安全性只能靠自己读源码判断。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 要求有安全扫描结论才肯安装的团队。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
cloudflare-worker-base

cloudflare 工人基地 · 本页

9,408750接触敏感数据MIT未收录

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Cloudflare Worker Base Stack

Production-tested: cloudflare-worker-base-test (https://cloudflare-worker-base-test.webfonts.workers.dev) Last Updated: 2026-01-20 Status: Production Ready ✅ Latest Versions: hono@4.11.3, @cloudflare/vite-plugin@1.17.1, vite@7.3.1, wrangler@4.54.0 Skill Version: 3.1.0

Recent Updates (2025-2026):

  • Wrangler 4.55+: Auto-config for frameworks (wrangler deploy --x-autoconfig)
  • Wrangler 4.45+: Auto-provisioning for R2, D1, KV bindings (enabled by default)
  • Workers RPC: JavaScript-native RPC via WorkerEntrypoint class for service bindings
  • March 2025: Wrangler v4 release (minimal breaking changes, v3 supported until Q1 2027)
  • June 2025: Native Integrations removed from dashboard (CLI-based approach with wrangler secrets)
  • 2025 Platform: Workers VPC Services, Durable Objects Data Studio, 64 env vars (5KB each), unlimited Cron Triggers per Worker, WebSocket 32 MiB messages, node:fs/Web File System APIs
  • 2025 Static Assets: Gradual rollout asset mismatch issue, free tier 429 errors with run_worker_first, Vite plugin auto-detection
  • Hono 4.11.x: Enhanced TypeScript RPC type inference, cloneRawRequest utility, JWT aud validation, auth middleware improvements

Quick Start (5 Minutes)

# 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 hono@4.11.3
npm install -D @cloudflare/vite-plugin@1.17.1 vite@7.3.1

# 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)

Known Issues Prevention

This skill prevents 10 documented issues:

Issue #1: Export Syntax Error

Error: "Cannot read properties of undefined (reading 'map')" Source: honojs/hono #3955 Prevention: Use export default app (NOT {fetch: app.fetch})

Issue #2: Static Assets Routing Conflicts

Error: API routes return index.html instead of JSON Source: workers-sdk #8879 Prevention: Add "run_worker_first": ["/api/*"] to wrangler.jsonc

Issue #3: Scheduled/Cron Not Exported

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) => { /* ... */ }
}

Issue #4: HMR Race Condition

Error: "A hanging Promise was canceled" during development Source: workers-sdk #9518 Prevention: Use @cloudflare/vite-plugin@1.13.13 or later

Issue #5: Static Assets Upload Race

Error: Non-deterministic deployment failures in CI/CD Source: workers-sdk #7555 Prevention: Use Wrangler 4.x+ with retry logic (fixed in recent versions)

Issue #6: Service Worker Format Confusion

Error: Using deprecated Service Worker format Source: Cloudflare migration guide Prevention: Always use ES Module format

Issue #7: Gradual Rollouts Asset Mismatch (2025)

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:

  • Avoid gradual deployments with fingerprinted assets
  • Use instant cutover deployments for static sites
  • Or implement version-aware routing with custom logic

Issue #8: Free Tier 429 Errors with run_worker_first (2025)

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:

  • Upgrade to Workers Paid plan ($5/month) for unlimited requests
  • Use negative patterns (!/pattern) to exclude paths from Worker invocation
  • Minimize run_worker_first patterns to only essential API routes

Issue #9: Vite 8 Breaks nodejs_compat with require()

Error: 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).

Issue #10: Vite base Option Breaks SPA Routing (1.13.8+)

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).

Route Priority with run_worker_first

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/*"]**:

  1. /api/hello → Worker handles (returns JSON)
  2. / → Static Assets serve index.html
  3. /styles.css → Static Assets serve styles.css
  4. /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.

Auto-Provisioning (Wrangler 4.45+)

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!
    }
  ],
  "r2_buckets": [
    {
      "binding": "STORAGE",
      "bucket_name": "my-app-files"  // Always specify!
    }
  ],
  "kv_namespaces": [
    {
      "binding": "CACHE",
      "title": "my-app-cache"  // Always specify!
    }
  ]
}
# Deploy - resources auto-provisioned if they don't exist
wrangler deploy

# Disable auto-provisioning (use existing resources only)
wrangler deploy --no-x-provision

Benefits:

  • No separate wrangler d1 create / wrangler r2 create steps needed
  • Idempotent - existing resources are used, not recreated
  • Works with local dev (wrangler dev creates local emulated resources)

Workers RPC (Service Bindings)

What It Is: JavaScript-native RPC system for calling methods between Workers. Uses Cap'n Proto under the hood for zero-copy message passing.

Use Case: Split your application into multiple Workers (e.g., API Worker + Auth Worker + Email Worker) that call each other with type-safe methods.

Defining an RPC Service:

import { WorkerEntrypoint } from 'cloudflare:workers'

export class AuthService extends WorkerEntrypoint<Env> {
  async verifyToken(token: string): Promise<{ userId: string; valid: boolean }> {
    // Access bindings via this.env
    const session = await this.env.SESSIONS.get(token)
    return session ? { userId: session.userId, valid: true } : { userId: '', valid: false }
  }

  async createSession(userId: string): Promise<string> {
    const token = crypto.randomUUID()
    await this.env.SESSIONS.put(token, JSON.stringify({ userId }), { expirationTtl: 3600 })
    return token
  }
}

// Default export still handles HTTP requests
export default { fetch: ... }

Calling from Another Worker:

// wrangler.jsonc
{
  "services": [
    { "binding": "AUTH", "service": "auth-worker", "entrypoint": "AuthService" }
  ]
}

// In your main Worker
const { valid, userId } = await env.AUTH.verifyToken(authHeader)

Key Points:

  • Zero latency: Workers on same account typically run in same thread
  • Type-safe: Full TypeScript support for method signatures
  • 32 MiB limit: Max serialized RPC message size
  • Self-bindings: In wrangler dev, shows as [connected] for same-Worker calls

Troubleshooting

Random "Response Already Sent" Errors in Development

Symptom: Sporadic ResponseSentError: The response has already been sent to the browser and cannot be altered during wrangler dev Source: workers-sdk #11932 Cause: Cache corruption in .wrangler directory or stale Vite cache

Solution:

# Clear all caches
rm -rf .wrangler dist node_modules/.vite

# Rebuild
npm run build

# Recreate local D1 databases if needed
wrangler d1 execute DB --local --file schema.sql

Applies to: Wrangler 4.x full Workers mode (not Cloudflare Pages)

Community Tips

Note: These tips come from community discussions. Verify against your version.

Avoid vite-tsconfig-paths v6 with React SSR

Source: workers-sdk #11825 (Community-sourced)

If using React SSR with @cloudflare/vite-plugin, pin to vite-tsconfig-paths@5.1.4:

npm install vite-tsconfig-paths@5.1.4

Why: Version 6.x doesn't follow path aliases during dependency scan, causing duplicate React instances and "Invalid hook call" errors.

Applies to: Projects using TypeScript path aliases with React SSR

Use crypto.randomUUID() Instead of uuid Package

Source: workers-sdk #11957

The uuid@11 package (ESM) can cause runtime crashes with "fileURLToPath undefined" in Workers. Use the native Web Crypto API instead:

// ✅ Native Workers API (recommended)
const uuid = crypto.randomUUID();

// ❌ Avoid uuid package in Workers
import { v4 as uuidv4 } from 'uuid';  // May crash

Applies to: All Workers projects needing UUIDs

Commands

/deploy - One-Command Deploy Pipeline

Use when: Ready to commit, push, and deploy your Cloudflare Worker in one step.

Does:

  1. Pre-flight: Verifies wrangler config, checks for changes, builds, runs TypeScript check
  2. Commit & Push: Stages changes, generates conventional commit message, pushes to remote
  3. Deploy: Runs wrangler deploy, captures Worker URL
  4. Report: Shows commit hash, branch, deployed URL, any warnings

Time savings: 2-3 min per deploy cycle

Edge Cases Handled:

  • No changes to commit → skips to deploy
  • Build script missing → warns and continues
  • No remote configured → reports error with suggestion
  • TypeScript errors → stops and reports

Bundled Resources

Templates: Complete setup files in templates/ directory (wrangler.jsonc, vite.config.ts, package.json, tsconfig.json, src/index.ts, public/index.html, styles.css, script.js)

Official Documentation


Dependencies (Latest Verified 2026-01-03)

{
  "dependencies": {
    "hono": "^4.11.3"
  },
  "devDependencies": {
    "@cloudflare/vite-plugin": "^1.17.1",
    "@cloudflare/workers-types": "^4.20260103.0",
    "vite": "^7.3.1",
    "wrangler": "^4.54.0",
    "typescript": "^5.9.3"
  }
}

Production Validation

Live Example: https://cloudflare-worker-base-test.webfonts.workers.dev (build time: 45 min, 0 errors, all 10 issues prevented)


Last verified: 2026-01-20 | Skill version: 3.1.0 | Changes: Added Vite 8 nodejs_compat workaround (Issue #9), Vite base option regression (Issue #10), auto-provisioning edge case warning, troubleshooting section for cache corruption, and community tips for vite-tsconfig-paths v6 and uuid package alternatives. Research conducted by skill-researcher agent covering post-May 2025 Workers SDK updates.

平台分布

Claude Code

27.05%
按下载量换算892

Gemini CLI

24.24%
按下载量换算799

Antigravity

18.9%
按下载量换算623

OpenCode

12.19%
按下载量换算402

Cursor

6.85%
按下载量换算226

Codex

3.63%
按下载量换算120

安全审计

暂无安全审计结果可展示。

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills