Cloudflare deploy skill
將網頁或 HTML 部署到 Cloudflare Pages 的標準方式。支援兩種模式:(1) 把文件放進一個文件中心站的對應子目錄再整包部署;(2) 把任意 HTML 或資料夾丟成一個獨立的 CF Pages 站並拿到網址。適用情境包含部署網頁、佈署 HTML、deploy 到 cloudflare、CF Pages、更新文件中心站、把網頁變成可公開訪問的網址。只要目標是把 HTML/網頁/資料夾變成線上網址,皆適用此 skill。From its SKILL.md
npx -y skills add circleghost/cloudflare-deploy-skillAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 20 days oldThe repository was created 20 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
8.2 KB, ~3.3k tokens by cl100k_base, as published. Nobody here has run it
Cloudflare Pages 部署
把網頁推到 Cloudflare Pages 的標準作法。前提是本機已安裝 wrangler,並設好 API Token 與 Account ID 環境變數(見「認證」)。
本機設定(LOCAL.md)
同目錄若存在 LOCAL.md,代表使用者的站點私有設定(帳號、專案名、目錄對照、部署腳本、站點專屬 checklist)。執行任何部署前,必先讀取 LOCAL.md 並優先遵循其中的具體值與紀律。 若不存在,走本文的通用流程即可,並提示使用者可參考同目錄的 LOCAL.md.example 建立自己的 LOCAL.md。
若使用者已建立 LOCAL.md:本 skill 的 LOCAL 契約版本為 v1,用來避免 skill 升級後使用者拿著舊版 LOCAL.md 卻不自知、靜默部署到錯的地方。若 LOCAL.md 標示的契約版本與此不符、或缺少本文引用的欄位,停下並列出缺漏項請使用者更新,不得靜默跳過。沒有 LOCAL.md 就略過這段,直接走下面的通用流程。
LOCAL.md 只能提供具名的私有值與站點專屬 checklist,不得覆寫本文的安全紀律(Token 安全鐵律、部署前確認網址、公開性警告);若兩者矛盾,以本文的安全條款為準。
兩種模式
- 模式 A|更新文件中心站:文件進一個既有文件中心站(綁自訂網域,該網域受 Cloudflare Access 保護,細節與陷阱見下方「Cloudflare Access」一節)的對應專案子目錄,整包重新部署。既有專案文件多走這個。
- 模式 B|獨立站:把一份 HTML 或資料夾丟成一個獨立 Pages 站,拿到
xxx.pages.dev。臨時預覽或一次性網頁用。
判斷一句話:屬於既有文件中心的內部文件就走 A,其他都走 B。 站點歸屬與判斷細節見 LOCAL.md。
部署前必做:先與使用者確認網址
部署前先把「這次內容會落在哪個網址」講清楚、得到使用者確認再推。原因:URL 的 slug 與專案名一旦上線又分享出去,別人存了連結就不好改,所以開頭就敲定,省得事後搬。
- 模式 A:確認放哪個專案子目錄與 slug,例如先問「我打算放
<文件中心網域>/<專案>/<slug>/,這樣可以嗎?」得到確認再部署。 - 模式 B:確認專案名(即
xxx.pages.dev的 xxx),以及要不要綁自訂網域、綁哪個子網域。專案名用小寫連字號,取個之後好認的。
確認網址後才跑部署。
認證
在 ~/.zshenv 設好 Pages:Edit 的 CLOUDFLARE_API_TOKEN 與 CLOUDFLARE_ACCOUNT_ID,非互動 shell 會自動載入。所以正常情況直接部署即可,不用 wrangler login。
驗證 token 在不在(安全寫法,絕不印值):
[ -n "$CLOUDFLARE_API_TOKEN" ] && echo "token 已載入(長度 ${#CLOUDFLARE_API_TOKEN})" || echo "沒載到"
萬一某個 shell 沒自動載到,補一次 source ~/.zshenv。
wrangler whoami 用這個 scoped token 會報 Failed to retrieve account IDs,那是正常的(token 只有 Pages 權限、不能列帳號),不影響 deploy(deploy 用 CLOUDFLARE_ACCOUNT_ID 直接指定)。
Token 安全鐵律:絕不 echo token 值。檢查只用 [ -n "$VAR" ] 判斷,要印就印 ${#VAR} 長度。永遠不要用 ${VAR:-...}、${VAR:+...$VAR...} 或把 $VAR 直接塞進 echo 字串,那會把 token 印進 transcript。
模式 A:更新文件中心站
文件中心的通用流程如下。下面步驟 2、3 描述的麵包屑與首頁卡片是常見的一種文件中心站設計,不是每個文件中心站都長這樣,你的站沒有這些元素就略過。本機路徑、專案名、子目錄對照、部署腳本等具體值一律見 LOCAL.md。
-
把文件放進對應專案子目錄,slug 用英文,子目錄對照見
LOCAL.md。檔名用index.html(例如<專案>/<slug>/index.html對應/<專案>/<slug>/)。文件多時再往下分子路徑。 -
每一頁都建議有:
<meta name="robots" content="noindex,nofollow">(這條沒有例外,任何文件中心站都該加)- 若你的站有麵包屑導覽慣例:頁面頂端放一條可點回文件中心與所屬專案頁的麵包屑,樣式用自帶淺底深字的膠囊、獨立 inline style、不依賴該頁 CSS 變數,壓在深淺背景上都讀得清楚。細部規範見
LOCAL.md。
-
回頭更新導覽入口(容易漏,若你的站有這個結構,務必做)。若首頁
index.html是手寫的卡片頁(常見做法:每張卡帶狀態標籤與文件份數),新增或更新文件後那張卡不會自己變,需同步更新首頁對應卡片與該專案落地頁的文件清單。漏了這步,文件雖上線但從首頁點不進去。具體檔案位置見LOCAL.md。 -
部署:整包
wrangler pages deploy上傳(部署是整包覆蓋,沒動到的子目錄不受影響)。若LOCAL.md提供部署腳本,優先用腳本(它會處理認證、整包上傳並印出正式網址)。
模式 B:獨立站
⚠️
pages.dev是公開網址、沒有登入保護。含敏感內容時別走模式 B 裸放。要嘛走模式 A(有 Cloudflare Access 擋著),要嘛至少每頁掛noindex並先確認這東西真的可以公開。臨時、不敏感的預覽才用模式 B。
- 單檔 HTML 先放進一個資料夾並命名
index.html。 - 取一個專案名(小寫、連字號,會變成
<名稱>.pages.dev)。 - 首次先建專案,再部署(認證見上):
wrangler pages project create <專案名> --production-branch=main
wrangler pages deploy <目錄> --project-name=<專案名> --branch=main --commit-dirty=true
之後同一個站要更新,重跑 deploy 即可,不必再 create。
綁自訂網域
wrangler 沒有綁網域的命令。若網域 DNS 在 Cloudflare,走 dashboard 最快: Workers & Pages → 選專案 → Custom domains → Set up a custom domain → 輸入子網域 → CF 自動建 DNS 與 SSL,幾分鐘生效。
Cloudflare Access(登入保護)
wrangler 不管 Access。走 Zero Trust dashboard: Zero Trust → Access → Applications → Add an application → Self-hosted → 填網域 → 加一條 policy(Action: Allow,Include: Emails,填允許進入的帳號)。設好後,這個網域就需要登入指定帳號才打得開。
⚠️ 這條保護只蓋你剛剛填的那個網域,不會自動延伸到別的網域。Cloudflare Pages 每個專案還有一個原廠 <project>.pages.dev 網址,以及每次部署的 preview 網址(如 <hash>.<project>.pages.dev),兩者預設公開,即使自訂網域已經設好 Access 也一樣。要嘛比照辦理替 *.pages.dev 也加一條 policy,要嘛部署後親自用無痕視窗打一次 <project>.pages.dev 與 preview 網址,確認真的進不去,別只信自訂網域打得開登入頁就以為全站都擋住了。
部署後:開網址確認渲染
部署完不算結束。開正式網址確認真的有渲染、手機寬不崩、標點正常。
注意受 Access 保護的站,curl 會被 302 導去登入頁、驗不到內容。所以這類站的渲染驗證要靠已登入的瀏覽器,或直接請使用者開一下。模式 B 的獨立站沒有 Access,可以直接 curl 或開網址驗。
常見錯誤
Not logged in... non-interactive:見「認證」,deploy 前沒設CLOUDFLARE_API_TOKEN。create成功但deploy失敗:create 與 deploy 都需要有效認證;若create是靠wrangler login留下的本機 OAuth session(而非環境變數 token)先過的,等 session 過期或換了機器,create也會一起失敗,別誤以為它天生不用認證。- 部署後主網址短暫 404:propagation,等幾秒或先開帶 hash 的 deployment 專屬網址。
What ships with it: 7 files
21.4 KB alongside SKILL.md
assets/
- readme/gates.svg3.6 KB
- readme/hero.svg4.4 KB
- readme/modes.svg2.5 KB
- .gitignore222 B
- LICENSE1.0 KB
- LOCAL.md.example2.3 KB
- README.md7.4 KB
Gives 0 of the 12 instructions most containers cloud skills give in ~3.3k tokens
Counted across 607 of the 657 authors here whose files we hold, read 2026-08-07
- Run containers as a non-root userin 66 of 607, across 46 files
- Use multi-stage buildsin 53 of 607, across 44 files
- Use Promise.all for independent operationsin 47 of 607, across 13 files
- Import directly instead of barrel filesin 46 of 607, across 12 files
- Use ternary instead of AND for conditionalsin 45 of 607, across 12 files
- Use Set or Map for O(1) lookupsin 42 of 607, across 10 files
- Create a .dockerignore filein 41 of 607, across 31 files
- Read individual rule files for detailsin 39 of 607, across 9 files
- Copy dependency files before source codein 36 of 607, across 23 files
- Authenticate server actions like API routesin 35 of 607, across 7 files
- Use next/dynamic for heavy componentsin 34 of 607, across 9 files
- Use React.cache for per-request deduplicationin 34 of 607, across 10 files
Said here and by no other author read
- read LOCAL.md before deploying if it exists
- use lowercase with hyphens for project names
- update navigation entries and homepage cards
- add robots noindex meta tag to every page
- open the live URL to verify rendering after deployment
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.