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
累计下载
4,105
星标
3
全站排名
#2,463
全站前 49% · 「运维安全」前 55%
平台累计安装累计下载星标评论
ClawHub ↗1354,0063-
SkillHub ↗1484,1053—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

该技能使用 curl、jq 和 Cloudflare API token。不同操作需要对应权限;DNS 和隧道命令会改变线上资源。应使用权限范围最小的 token,并在执行前核实区域、记录名称、隧道名称和 ID。token 与隧道运行令牌应妥善保护,避免在日志或录制的会话中输出。

资料发布于 2026-10-29

可以用来做什么

  • 列出或查看 Cloudflare 区域及 DNS 记录
  • 为指定主机名创建或更新 DNS 记录
  • 配置指向本地服务的 Cloudflare Tunnel

什么时候用

  • 已确认 API token 只包含当前操作所需权限时
  • 目标区域、记录名称和隧道 ID 已逐项核实时
  • 执行变更或删除前已审阅具体命令时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

说明如何检查指定区域的 DNS 记录并规划一项变更;不要访问账户、输出 token 或执行创建、更新、删除操作。

月度数据趋势

累计下载4,105
2,6223,4194,2152026-03 · 累计下载 2,7322026-05 · 累计下载 3,3002026-06 · 累计下载 3,4472026-07 · 累计下载 3,6822026-08 · 累计下载 3,8802026-09 · 累计下载 4,10526-0326-09
星标3
2342026-03 · 星标 32026-05 · 星标 32026-06 · 星标 32026-07 · 星标 32026-08 · 星标 32026-09 · 星标 326-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,105—3
2026-083,880+5.4%3
2026-073,682+6.8%3
2026-063,447+4.5%3
2026-053,300—3
2026-032,732—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),按月更新。口径说明见数据方法。