Token导航 LogoToken导航

Agent Skill · 开发

cloudflare-to-bun(Cloudflare TO Bun 命令行)

cloudflare-to-bun 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

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

总安装 544周安装 22GitHub Stars 3下载 171核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/daleseo/bun-skills --skill cloudflare-to-bun

这个 Skill 是做什么的

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

协助将 Cloudflare Workers 应用迁移至 Bun 运行时,替换边缘 API 调用。提供 runtime APIs、Bindings(KV/R2/D1)与部署策略的对应关系表。包含预迁移检查、端口映射修正与 serverless 到边缘的适配指南。

需对比当前 wrangler 与 Bun 版本,识别废弃接口与行为差异。迁移后应验证本地开发环境与线上 Worker 的行为一致性。

来源仓库内路径:skills/cloudflare-to-bun

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

cloudflare-to-bun 怎么安装?

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

cloudflare-to-bun 支持哪些 AI 工具?

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

cloudflare-to-bun 需要什么权限?

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

cloudflare-to-bun 是免费的吗?

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

cloudflare-to-bun 用的人多吗?

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

cloudflare-to-bun 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

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

值得选的地方

  • 同时适配 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-to-bun

Cloudflare TO Bun 命令行 · 本页

5443接触敏感数据MIT通过

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

SKILL.md 原文

Cloudflare Workers to Bun Migration

You are assisting with migrating Cloudflare Workers applications to Bun. This involves converting edge runtime APIs, replacing Cloudflare bindings, and adapting from edge to server deployment.

Quick Reference

For detailed patterns, see:

  • Runtime APIs: runtime-apis.md - Cloudflare to Bun API mapping
  • Bindings Migration: bindings.md - KV, R2, D1, Durable Objects replacements
  • Deployment: deployment.md - Edge to server deployment strategies

Migration Workflow

1. Pre-Migration Analysis

Check current setup:

# Check Cloudflare CLI
wrangler --version

# Check Bun installation
bun --version

# Analyze wrangler.toml
cat wrangler.toml

Review worker configuration:

# Check compatibility flags
grep compatibility_flags wrangler.toml

# Check bindings
grep -E "kv_namespaces|r2_buckets|d1_databases|durable_objects" wrangler.toml

2. Worker Types Analysis

Determine what type of Worker you're migrating:

  • Service Worker: Traditional addEventListener('fetch') format
  • Module Worker: Modern export default {fetch()} format
  • Scheduled Worker: Cron triggers
  • Durable Objects: Stateful objects
  • Pages Functions: Next.js-like file-based routing

3. Runtime API Conversion

Basic Fetch Handler

Cloudflare Worker (Module format):

export default {
  async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
    return new Response('Hello World');
  },
};

Bun Server:

Bun.serve({
  port: 3000,
  fetch(request: Request): Response | Promise<Response> {
    return new Response('Hello World');
  },
});

console.log('Server running on http://localhost:3000');
Request/Response Handling

Cloudflare Worker:

export default {
  async fetch(request: Request): Promise<Response> {
    const url = new URL(request.url);

    if (url.pathname === '/api/data') {
      return Response.json({ data: 'value' });
    }

    return new Response('Not found', { status: 404 });
  },
};

Bun (with Hono for routing):

import { Hono } from 'hono';

const app = new Hono();

app.get('/api/data', (c) => {
  return c.json({ data: 'value' });
});

app.notFound((c) => {
  return c.text('Not found', 404);
});

export default {
  port: 3000,
  fetch: app.fetch,
};

For complete API mapping, see runtime-apis.md.

4. Bindings Migration

Cloudflare Workers use bindings for KV, R2, D1, etc. These need to be replaced:

KV Namespace → Database/Cache

Cloudflare Worker:

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const value = await env.MY_KV.get('key');
    await env.MY_KV.put('key', 'value', { expirationTtl: 3600 });

    return Response.json({ value });
  },
};

Bun (using Redis or SQLite):

import { Redis } from 'ioredis';

const redis = new Redis(process.env.REDIS_URL);

Bun.serve({
  async fetch(request: Request) {
    const value = await redis.get('key');
    await redis.setex('key', 3600, 'value');

    return Response.json({ value });
  },
});
R2 Bucket → S3 or File System

Cloudflare Worker:

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const object = await env.MY_BUCKET.get('file.txt');
    const text = await object?.text();

    return new Response(text);
  },
};

Bun (using S3-compatible storage):

import { S3Client, GetObjectCommand } from '@aws-sdk/client-s3';

const s3 = new S3Client({ region: 'us-east-1' });

Bun.serve({
  async fetch(request: Request) {
    const command = new GetObjectCommand({
      Bucket: 'my-bucket',
      Key: 'file.txt',
    });

    const response = await s3.send(command);
    const text = await response.Body?.transformToString();

    return new Response(text);
  },
});

For all bindings replacements, see bindings.md.

5. Environment Variables

Cloudflare Worker (wrangler.toml):

[vars]
API_KEY = "dev-key"

[[env.production.vars]]
API_KEY = "prod-key"

Bun (.env files):

# .env.development
API_KEY=dev-key

# .env.production
API_KEY=prod-key

Access in code:

// Both use the same API
const apiKey = process.env.API_KEY;

6. Configuration Migration

wrangler.toml:

name = "my-worker"
main = "src/index.ts"
compatibility_date = "2024-01-01"

[vars]
ENVIRONMENT = "production"

kv_namespaces = [
  { binding = "MY_KV", id = "..." }
]

r2_buckets = [
  { binding = "MY_BUCKET", bucket_name = "my-bucket" }
]

package.json (Bun):

{
  "name": "my-bun-app",
  "type": "module",
  "scripts": {
    "dev": "bun run --hot src/index.ts",
    "start": "bun run src/index.ts",
    "build": "bun build src/index.ts --outdir=dist"
  },
  "dependencies": {
    "hono": "^3.0.0",
    "ioredis": "^5.0.0"
  }
}

7. Routing Patterns

Cloudflare Worker (manual routing):

export default {
  async fetch(request: Request): Promise<Response> {
    const url = new URL(request.url);

    if (url.pathname === '/') {
      return new Response('Home');
    }

    if (url.pathname.startsWith('/api/')) {
      return handleApi(request);
    }

    return new Response('Not found', { status: 404 });
  },
};

Bun (with Hono framework):

import { Hono } from 'hono';

const app = new Hono();

app.get('/', (c) => c.text('Home'));

const api = new Hono();
api.get('/users', (c) => c.json({ users: [] }));
app.route('/api', api);

export default {
  port: 3000,
  fetch: app.fetch,
};

8. Scheduled Events (Cron)

Cloudflare Worker:

export default {
  async scheduled(event: ScheduledEvent, env: Env, ctx: ExecutionContext) {
    await doCleanup();
  },
};

// wrangler.toml
[triggers]
crons = ["0 0 * * *"]  # Daily at midnight

Bun (using node-cron):

import cron from 'node-cron';

// Run daily at midnight
cron.schedule('0 0 * * *', async () => {
  await doCleanup();
});

// Start server
Bun.serve({
  fetch(request: Request) {
    return new Response('Server running');
  },
});

9. Testing Migration

Cloudflare Worker (Miniflare):

import { Miniflare } from 'miniflare';

const mf = new Miniflare({
  script: `
    export default {
      fetch() { return new Response('Hello'); }
    }
  `,
});

const response = await mf.dispatchFetch('http://localhost/');

Bun Test:

import { describe, test, expect } from 'bun:test';

describe('Server', () => {
  test('should respond to requests', async () => {
    const response = await fetch('http://localhost:3000/');
    expect(response.status).toBe(200);
  });
});

10. Deployment Strategy

Cloudflare Workers:

  • Edge deployment (globally distributed)
  • No cold starts
  • Limited runtime (CPU time limits)
  • Specialized bindings (KV, R2, D1)

Bun Server:

  • Traditional server deployment
  • Self-hosted or cloud (AWS, GCP, Azure)
  • No CPU time limits
  • Standard databases and storage
  • Use Docker for containerization (see bun-deploy skill)

For deployment strategies, see deployment.md.

11. Update package.json

{
  "name": "migrated-from-cloudflare",
  "type": "module",
  "scripts": {
    "dev": "bun run --hot src/index.ts",
    "start": "NODE_ENV=production bun run src/index.ts",
    "test": "bun test",
    "build": "bun build src/index.ts --outdir=dist --minify"
  },
  "dependencies": {
    "hono": "^3.11.0",
    "ioredis": "^5.3.0",
    "@aws-sdk/client-s3": "^3.478.0"
  },
  "devDependencies": {
    "@types/bun": "latest"
  }
}

12. File Structure Migration

Cloudflare Worker:

cloudflare-worker/
├── src/
│   └── index.ts
├── wrangler.toml
└── package.json

Bun Server:

bun-server/
├── src/
│   ├── index.ts
│   ├── routes/
│   └── services/
├── .env.development
├── .env.production
├── package.json
├── tsconfig.json
└── bunfig.toml

Migration Checklist

  • Bun installed and verified
  • Worker type identified (service/module/durable)
  • Bindings mapped to replacements (KV→Redis, R2→S3, etc.)
  • Environment variables migrated
  • Routing migrated (manual → framework)
  • Scheduled tasks migrated (cron triggers)
  • wrangler.toml converted to package.json
  • TypeScript configuration created
  • Dependencies installed with bun install
  • Tests migrated and passing
  • Local server running
  • Deployment strategy planned

Key Differences

FeatureCloudflare WorkersBun Server
RuntimeEdge (V8 isolates)Server (JavaScriptCore)
DeploymentGlobal edge networkTraditional hosting
Cold Start~0msMinimal with Bun
Execution TimeLimited (CPU time)Unlimited
StorageKV, R2, D1, DORedis, S3, PostgreSQL, etc.
Cost ModelPer-requestServer/container costs
ScalingAutomaticManual/auto-scaling groups
StateDurable ObjectsTraditional databases

Common Patterns

CORS Handling

Same in both:

const corsHeaders = {
  'Access-Control-Allow-Origin': '*',
  'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE',
  'Access-Control-Allow-Headers': 'Content-Type',
};

// Handle OPTIONS preflight
if (request.method === 'OPTIONS') {
  return new Response(null, { headers: corsHeaders });
}

JSON Responses

Same in both:

return Response.json({ data: 'value' }, {
  headers: { 'Cache-Control': 'max-age=3600' }
});

Error Handling

Same in both:

try {
  // Your code
} catch (error) {
  return new Response('Internal Server Error', { status: 500 });
}

Completion

Once migration is complete, provide summary:

  • ✅ Migration status (success/partial/issues)
  • ✅ Bindings replaced (KV→Redis, R2→S3, etc.)
  • ✅ Deployment strategy chosen
  • ✅ Performance comparison
  • ✅ Links to Bun documentation

Next Steps

Suggest to the user:

  1. Set up Redis/database for KV replacement
  2. Configure S3-compatible storage for R2 replacement
  3. Set up monitoring and logging
  4. Plan deployment strategy (Docker, cloud hosting)
  5. Use bun-deploy skill for containerization
  6. Update CI/CD pipelines
  7. Load test the migrated application

平台分布

Claude Code

30.04%
按下载量换算51

windsurf

22.46%
按下载量换算38

OpenCode

20.54%
按下载量换算35

Cursor

12.99%
按下载量换算22

Codex

8.38%
按下载量换算14

Antigravity

3.99%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

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

安装前确认

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

继续浏览同类 Skills