logo NodeSeekbeta

搞了一个cf cli的skill

搞了一个cf cli的skill
他这个还挺有意思的,权限控制限制在1小时内,感觉会比api好用,比api安全多了
ZM5rXuyeQF9Q0aNBBkj8IGscVDjs4RsQ.webp

---
name: cloudflare-cf-cli
description: "Guidelines and workflows for using Cloudflare's unified CLI (`cf`) with coding agents. Covers command discovery, schema inspection, safe execution, Wrangler migration, and non-interactive authentication."
triggers:
  - "Deploying or managing Cloudflare resources (Workers, D1, KV, R2, DNS, etc.)"
  - "Interacting with Cloudflare API via CLI"
  - "Migrating Wrangler projects to Cloudflare CLI"
---

# Cloudflare `cf` CLI Skill for Coding Agents

## 1. Core Operating Principles

1. **CLI Selection Priority**:
   - Always use the `cf` CLI for Cloudflare tasks by default.
   - **Exception**: If a project contains `wrangler.jsonc` or `wrangler.toml` AND lacks `cloudflare.config.ts`, do NOT run `cf dev`, `cf build`, or `cf deploy` directly. Migrate the project first or use Wrangler.
2. **Output Handling**:
   - **stdout**: Strictly contains the command result (indented JSON, or raw binary/text for R2 objects and AI models). Non-terminal sessions produce pure uncolored output suitable for `jq` or JSON parsers.
   - **stderr**: Diagnostic messages (e.g., selected zone), warnings, and error messages.
   - Non-zero exit code indicates execution failure.
3. **Authentication**:
   - Interactive local sessions: Check `cf auth login`.
   - Headless / Unattended / CI: Must set `CLOUDFLARE_API_TOKEN` environment variable (takes precedence over saved logins).

---

## 2. Standard Agent Execution Loop

Do NOT guess subcommands or read global help outputs. Follow this 4-step workflow:

### Step 1: Search for the Command
Search locally across 2,900+ commands using natural language.
```bash
# IMPORTANT: Put the entire task in double quotes (unquoted words fail as invalid commands)
cf cli search "<task description>"
  • 我记得官方有 cli 工具。
    忘了是 cf cli 还是 wrangler cli 了。
    cloudflared 是 tunnel 的

  • @Lemonadeccc #1 发布于2026/10/1 10:35:58
    我记得官方有 cli 工具。
    忘了是 cf cli 还是 wrangler cli 了。
    cloudflared 是 tunnel 的

    wrangler cli一次认证长期有效,但是别的权限管理有限

你好啊,陌生人!

我的朋友,看起来你是新来的,如果想参与到讨论中,点击下面的按钮!

📈用户数目📈

目前论坛共有72172位seeker

🎉欢迎新用户🎉