Cursor Cloudflare 编码规范

Model: qwen-max | ¥0.15/call
AI工具GPT-4.1智能助手CursorCloudflare

Cursor Cloudflare 编码规范:来自 PatrickJS/awesome-cursorrules (40k stars) 的 clo,适用于各类文档与内容的智能化处理。

Calls: 1

Skill Documentation

Cursor Cloudflare 编码规范

摘要

Cursor Cloudflare 编码规范:来自 PatrickJS/awesome-cursorrules (40k stars) 的 clo,适用于各类文档与内容的智能化处理。

**文件来源:** PatrickJS/awesome-cursorrules → `rules/cloudflare-email-telegram-cursorrules-prompt-file.mdc`

**原仓库:** https://github.com/PatrickJS/awesome-cursorrules

**评分:** ⭐ 仓库 40k stars (社区最权威 Cursor rules 合集)

这个 skill 是干什么的?

把 `cloudflare-email-telegram-cursorrules-prompt-file.mdc` 这条 Cursor 编码规则打包成可调用的 AI skill,帮你把代码生成统一到一致的标准上。

> Cursor rules for setting up email-to-Telegram forwarding via Cloudflare Email Routing and Workers using the mail2tg CLI.

🤖 Agent 使用说明

👤 用户需要做什么?

适用场景

原始规则内容

globs: **/*
alwaysApply: false
---
You are an expert at setting up email-to-Telegram forwarding using Cloudflare Email Routing and Workers.

When the user asks to set up email forwarding to Telegram, route domain email to Telegram, or mentions "mail2tg", "email to telegram", follow this workflow.

## Tool

Use the `mail2tg` CLI published on npm: https://www.npmjs.com/package/mail2tg
Source: https://github.com/shatzibitten/mail2tg

## Prerequisites

1. Domain DNS managed by Cloudflare (nameservers pointing to Cloudflare, status "Active").
2. Cloudflare API token with scopes: Zone Read, DNS Edit, Worker Scripts Edit, Email Routing Rules Edit. Create at dash.cloudflare.com/profile/api-tokens → "Create Custom Token".
3. Telegram bot created via @BotFather, token copied. User has sent /start to the bot.
4. Node.js >= 20.

## Plan-first workflow

export CLOUDFLARE_API_TOKEN="<token>"

export TELEGRAM_BOT_TOKEN="<bot-token>"

Replace <reviewed-version> only after reviewing the npm package and source.

MAIL2TG_DOMAIN=example.com \

MAIL2TG_MAILBOX=info@example.com \

npx -y mail2tg@<reviewed-version> init --json

npx -y mail2tg@<reviewed-version> plan --json

Stop here, show the plan to the user, and wait for explicit approval.

npx -y mail2tg@<reviewed-version> apply --json

npx -y mail2tg@<reviewed-version> doctor --json


## Interactive workflow

npx -y mail2tg@<reviewed-version> init

export CLOUDFLARE_API_TOKEN="<token>"

export TELEGRAM_BOT_TOKEN="<bot-token>"

npx -y mail2tg@<reviewed-version> plan

Stop here, show the plan to the user, and wait for explicit approval.

npx -y mail2tg@<reviewed-version> apply

npx -y mail2tg@<reviewed-version> doctor


## What it does

- Deploys a Cloudflare Worker that parses incoming emails (MIME) and forwards headers, body, and attachments (up to 50 MB) to a Telegram chat via Bot API.
- Creates MX and SPF DNS records so Cloudflare receives mail for the domain.
- Creates an Email Routing rule directing the configured address to the Worker.
- Sets Worker secrets (TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID).

After apply, nothing runs locally. Everything is serverless on Cloudflare's edge. Free tier covers 100K emails/day.

## Exit codes

- 0: success
- 2: missing config or env vars
- 3: Cloudflare/Telegram API error
- 4: doctor checks failed
- 5: worker deployment failed

## Common issues

- "Telegram chat_id not found" → user must send /start to the bot, then re-run.
- "Cloudflare zone not found" → domain not on Cloudflare or token lacks Zone Read scope.
- "Worker deployment failed" → check internet; run `npx wrangler whoami` to debug.

数据来源

联系方式

有问题或建议,在本 skill 下留言。

FAQ

这个 skill 是干什么的?

把 `cloudflare-email-telegram-cursorrules-prompt-file.mdc` 这条 Cursor 编码规则打包成可调用的 AI skill,帮你把代码生成统一到一致的标准上。

> Cursor rules for setting up email-to-Telegram forwarding via Cloudflare Email Routing and Workers using the mail2tg CLI.

👤 用户需要做什么?
  • [ ] 知道这条规则适合用在什么场景(参考下面"适用场景")
  • [ ] 把规则原文内容应用到 IDE 项目的 `.cursor/rules/` 目录(直接复制 .mdc 文件)
  • [ ] 调本 skill 时说清楚你的代码任务(语言/框架/目标)
  • [ ] 输出后人工 review 风格是否符合预期