Cloudflare
它能做什么
让智能体设置和更新 Cloudflare 账户的部分内容,例如网站、无服务器函数和存储。它适用于把项目托管在 Cloudflare 上的开发者。
适用场景
- ✓当你想部署 Cloudflare Worker 或 Pages 网站的时候。
- ✓当你需要在 Cloudflare 上更改 DNS、KV 存储、R2 或 D1 数据库的时候。
- ✓当你想查看 Worker 日志或确认部署已上线的时候。
技能链接
https://github.com/danielmiessler/LifeOS/blob/main/LifeOS/install/skills/Cloudflare/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请部署我的 Cloudflare Worker,并确认新版本已在我的域名上线。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能通过一个包装器运行 Cloudflare 的命令行工具,并且只传递它所需的访问令牌。然后它会在线上地址上检查结果,因此报告会显示已部署的版本以及网站是否响应。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Cloudflare Skill
Contents: Ideal State · Intent Routing · How It Works · Data & Config · Gotchas · Examples
Deploys and manages Cloudflare Workers, Pages, KV, R2, D1, DNS, and Queues with one tool, Cloudflare's cf CLI, run through LIFEOS/TOOLS/CfEnv.ts so the master token reaches the cf process and nothing else. A raw Cloudflare CLI call either runs on whatever token the calling shell exports (a shell profile that exports .env puts it in every interactive shell, the agent's Bash shell included), outside CfEnv's probes and review, or coasts on a stale OAuth login, which produces false "the token is dead, rotate it" diagnoses. This skill encodes one tool, one credential, one runner, and one set of verified probes so deploys and queries land the first time.
Ideal State
- Every account-touching Cloudflare call runs through
LIFEOS/TOOLS/CfEnv.ts, so the master token from.envreaches one cf process and nothing else: no raw cf or Wrangler write, no sourced.env, no OAuth fallback. - Whatever is deployed or created answers only on its authoritative URL (custom domain with workers.dev and previews off, or workers.dev when no domain exists). The report proves it live with a version ID and a probe, and the code review, new-zone baseline and registration gates were passed rather than overridden.
- Reads and diagnoses come from live cf output in the same turn. An auth failure is traced through
auth whoamiand a scope-matching probe before any rotation is considered. - An MCP server built here is a stateless Worker that meets
References/McpServerSpec.md.
Intent Routing
| Intent | Trigger | File |
|---|---|---|
| Deploy | Any Cloudflare write (deploy, secret, D1 migration or write, KV/R2 write, queue create, Pages deploy), an approved teardown, and converting a Wrangler project | Intents/Deploy.md |
| Create | Create a Worker or MCP server | Intents/Create.md |
| Troubleshoot | Deployment issues | Intents/Troubleshoot.md |
| Query | Cloudflare state (list workers, versions, KV, DNS, D1, logs, analytics), read-only via cf | Intents/Query.md |
| Explorer | Inspect Worker bindings/data live via Local Explorer | Intents/Explorer.md |
| File | Read when |
|---|---|
References/McpServerSpec.md |
Before writing any MCP server. The normative 2026-07-28 build contract — stateless shape, server/discover, resultType, CacheableResult, required headers, MRTR, deprecated features not to adopt. Every MCP server built here uses this structure. |
References/CfCli.md |
finding the cf command for a task (the decision table), cf output, auth order, --local mode, Access, previews, secrets-store and other capabilities, or falling back to Code Mode MCP |
References/RuntimeGotchas.md |
writing or applying a D1 migration, exporting or backing up D1, long waitUntil or cron jobs, static-asset caching headers, Durable Object containers, deciding Container vs isolate, or probing an Astro POST route |
References/StaticSiteConfig.md |
writing or converting a project's cloudflare.config.ts and vite.config.ts, static sites especially |
Setup.md |
first-time setup: the two .env keys, the deploy review's reviewer and waivers, the Config.md entries, and the no-account check that CfEnv's allowlist guard is in place |
LIFEOS/TOOLS/CfEnv.help.md |
CfEnv's usage, verb allowlist and refusals |
How It Works
- cf CLI (open beta) is the only Cloudflare CLI this skill uses. Every account call runs the one version CfEnv pins as
CF_PACKAGEinLIFEOS/TOOLS/CfEnv.ts(cf@1.0.0-beta.5when this was written; read the constant for the current pin), not whatevercfis installed globally. The pin costs container Workers: a Durable Object container needscf@1.0.0-beta.10or later (References/RuntimeGotchas.md§ Durable Object containers), so a container Worker cannot deploy through CfEnv until the pin moves. Moving it is a deliberate change: beta.14 droppedobservability telemetry query, which scheduled log readers rely on (LifeOS's optional Vigil monitor is one), so check every command your callers run against the new version first. Its command map, discovery, output, local mode and extra capabilities are inReferences/CfCli.md. LIFEOS/TOOLS/CfEnv.tsruns one cf command withCLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDfrom~/.claude/.envinjected into that child process only, behind a verb allowlist.secret putis translated so t
常见问题
它使用哪个工具更改我的账户?
它使用 Cloudflare 的 cf 命令行工具,通过只传递主令牌的包装器运行。
它如何确认部署成功?
部署后,它会探测线上地址,并在结果中报告版本 ID。
它能构建 MCP server 吗?
能。它可以把 MCP server 编写为 Cloudflare Workers。
详情
作者的原始描述
Deploys and manages Cloudflare Workers, Pages, KV, R2, D1, DNS, and Queues with the cf CLI, converts Wrangler projects to cf, and authors MCP servers as Workers; never call cf or wrangler raw for a write. USE WHEN deploy worker, deploy pages, ship worker, push to cloudflare, wrangler deploy, Cloudflare, Pages, DNS, KV, R2, D1, Queues, Workers AI, worker logs, build an MCP server, write an MCP server, expose this as MCP, MCP server structure, what shape should our MCP server be, MCP spec, server/discover, MCP stateless. NOT FOR non-Cloudflare deploys or MCP servers we only consume.
repo: danielmiessler/LifeOS
热度
- GitHub 星标
- 20k
- 排名
- #10413
- 许可证
- MIT
- 更新时间
- 2026/10/28
评论
- …