Lucas Synnott

Cloudflare API

運維安全v1.0.0
作者:Lucas Synnott更新於 2026-05-11cloudflare-api@clawhub_lucassynnott/cloudflare-api
伺服器運維配置生成

據 AlphaMoat 統計,截至 2026-09,Cloudflare API 累計下載 4,105 次、獲 3 個星標,在全部 5,078 個 AI 技能中排名第 2,463 位,在「運維安全」分類(264 個)中排名第 144 位。

累計安裝
148
累計下載
4105
星標
3
全站排名
#2,463
全站前 49% · 「運維安全」前 55%
平台累計安裝累計下載星標評論
ClawHub ↗13540063-
SkillHub ↗14841053—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

該技能使用 curl、jq 和 Cloudflare API token。不同操作需要對應許可權;DNS 和隧道命令會改變線上資源。應使用許可權範圍最小的 token,並在執行前核實區域、記錄名稱、隧道名稱和 ID。token 與隧道執行令牌應妥善保護,避免在日誌或錄製的會話中輸出。

資料釋出於 2026-10-29

可以用來做什麼

  • 列出或檢視 Cloudflare 區域及 DNS 記錄
  • 為指定主機名建立或更新 DNS 記錄
  • 配置指向本地服務的 Cloudflare Tunnel

什麼時候用

  • 已確認 API token 只包含當前操作所需許可權時
  • 目標區域、記錄名稱和隧道 ID 已逐項核即時
  • 執行變更或刪除前已審閱具體命令時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

說明如何檢查指定區域的 DNS 記錄並規劃一項變更;不要訪問帳戶、輸出 token 或執行建立、更新、刪除操作。

月度資料趨勢

累計下載4105
2622341942152026-03 · 累計下載 27322026-05 · 累計下載 33002026-06 · 累計下載 34472026-07 · 累計下載 36822026-08 · 累計下載 38802026-09 · 累計下載 410526-0326-09
星標3
2342026-03 · 星標 32026-05 · 星標 32026-06 · 星標 32026-07 · 星標 32026-08 · 星標 32026-09 · 星標 326-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-094105—3
2026-083880+5.4%3
2026-073682+6.8%3
2026-063447+4.5%3
2026-053300—3
2026-032732—3

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

3.8 KB · ClawHub v1.0.0
---
name: cloudflare
description: Connect to Cloudflare API for DNS management, tunnels, and zone administration. Use when user needs to manage domains, DNS records, or create tunnels.
read_when:
  - User asks about Cloudflare DNS or domains
  - User wants to create or manage DNS records
  - User needs to set up Cloudflare tunnels
  - User wants to list their Cloudflare zones
metadata:
  clawdbot:
展開全部(共 174 行)
    emoji: "☁️"
    requires:
      bins: ["curl", "jq"]
---

# Cloudflare Skill

Connect to [Cloudflare](https://cloudflare.com) API for DNS management, tunnels, and zone administration.

## Setup

### 1. Get Your API Token
1. Go to [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens)
2. Create a token with required permissions:
   - **Zone:Read** - List domains
   - **DNS:Edit** - Manage DNS records
   - **Account:Cloudflare Tunnel:Edit** - Manage tunnels
3. Copy the token

### 2. Configure
```bash
# Option A: Store in file (recommended)
echo "YOUR_API_TOKEN" > ~/.cloudflare_token
chmod 600 ~/.cloudflare_token

# Option B: Environment variable
export CLOUDFLARE_API_TOKEN="YOUR_API_TOKEN"
```

### 3. Test Connection
```bash
./scripts/setup.sh
```

---

## Commands

### Zones (Domains)

```bash
./scripts/zones/list.sh                    # List all zones
./scripts/zones/list.sh --json             # JSON output
./scripts/zones/get.sh example.com         # Get zone details
```

### DNS Records

```bash
# List records
./scripts/dns/list.sh example.com
./scripts/dns/list.sh example.com --type A
./scripts/dns/list.sh example.com --name api

# Create record
./scripts/dns/create.sh example.com \
  --type A \
  --name api \
  --content 1.2.3.4 \
  --proxied

# Create CNAME
./scripts/dns/create.sh example.com \
  --type CNAME \
  --name www \
  --content example.com \
  --proxied

# Update record
./scripts/dns/update.sh example.com \
  --name api \
  --type A \
  --content 5.6.7.8

# Delete record
./scripts/dns/delete.sh example.com --name api --type A
```

### Tunnels

```bash
# List tunnels
./scripts/tunnels/list.sh

# Create tunnel
./scripts/tunnels/create.sh my-tunnel

# Configure tunnel ingress
./scripts/tunnels/configure.sh my-tunnel \
  --hostname app.example.com \
  --service http://localhost:3000

# Get run token
./scripts/tunnels/token.sh my-tunnel

# Delete tunnel
./scripts/tunnels/delete.sh my-tunnel
```

---

## Token Permissions

| Feature | Required Permission |
|---------|-------------------|
| List zones | Zone:Read |
| Manage DNS | DNS:Edit |
| Manage tunnels | Account:Cloudflare Tunnel:Edit |

Create token at: [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens)

---

## Common Workflows

### Point subdomain to server
```bash
./scripts/dns/create.sh mysite.com --type A --name api --content 1.2.3.4 --proxied
```

### Set up tunnel for local service
```bash
# 1. Create tunnel
./scripts/tunnels/create.sh webhook-tunnel

# 2. Configure ingress
./scripts/tunnels/configure.sh webhook-tunnel \
  --hostname hook.mysite.com \
  --service http://localhost:8080

# 3. Add DNS record
TUNNEL_ID=$(./scripts/tunnels/list.sh --name webhook-tunnel --quiet)
./scripts/dns/create.sh mysite.com \
  --type CNAME \
  --name hook \
  --content ${TUNNEL_ID}.cfargotunnel.com \
  --proxied

# 4. Run tunnel
TOKEN=$(./scripts/tunnels/token.sh webhook-tunnel)
cloudflared tunnel run --token $TOKEN
```

---

## Output Formats

| Flag | Description |
|------|-------------|
| `--json` | Raw JSON from API |
| `--table` | Formatted table (default) |
| `--quiet` | Minimal output (IDs only) |

---

## Troubleshooting

| Error | Solution |
|-------|----------|
| "No API token found" | Run setup or set CLOUDFLARE_API_TOKEN |
| "401 Unauthorized" | Check token is valid |
| "403 Forbidden" | Token missing required permission |
| "Zone not found" | Verify domain is in your account |

「運維安全」分類下的熱門技能

Lucas Synnott 的其他技能

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。