본문으로 건너뛰기

cloudflare/cloudflare-os-starter

A guide for customizing your Cloudflare OS deployment

https://skillcdn.ai/gh/cloudflare/cloudflare-os-starter

내 AI에 이 주소를 연결하면 이 스킬을 쓸 수 있어요. 연결 방법 보기

  • 미확인
  • 기본 브랜치main
  • 커밋5e0f4af
  • 라이선스Apache-2.0
  • 검색단어
GitHub에서 보기

cloudflare-os-operator

Guides cloudflare/cloudflare-os-starter setup, Cloudflare Access, deployment.jsonc, storage, AI, observability, custom Gatekeepers, deployment, verification, troubleshooting, rollback, and pinned-submodule upgrades. Use only for deployments created from the Cloudflare OS Deployment Starter, not standalone Cloudflare OS checkouts.

경로
.agents/skills/cloudflare-os-operator/SKILL.md
라이선스
Apache-2.0
호환성
Requires Git, the checkout-declared Node.js and pnpm versions, project-pinned Wrangler, and a Cloudflare account with the products used by the deployment.

Cloudflare OS Operator

Own the outcome, not just the next command. Guide the operator from an unprepared checkout to a verified deployment, or from a failure to a diagnosed and safe recovery. A provider outage, unavailable product, or incorrect external policy can never be ruled out in advance, so do not promise an issue-free deployment. Prevent avoidable failures and do not call the work complete without evidence.

This skill operates the deployment wrapper, not Cloudflare OS in isolation. The wrapper pins Cloudflare OS as a submodule, derives temporary Wrangler configs, and coordinates several Workers.

Locate The Starter

Find the repository root containing all of these markers:

  • deployment.jsonc
  • packages/cf-os/
  • cloudflare-os/
  • packages/custom-gatekeeper/

Do not assume the current working directory or this skill's directory is the starter root. If the markers are absent, stop and ask for the starter checkout. Do not apply this workflow directly to a standalone Cloudflare OS checkout.

Once the submodule is initialized, confirm cloudflare-os/packages/router/ exists as well. The deploy binds and deploys it, so a pinned commit without it cannot be deployed by this wrapper; treat its absence as a provenance problem, not a missing build step.

Read Current Sources First

Before any mutation, always read the current checkout's:

  1. README.md
  2. deployment.jsonc
  3. packages/cf-os/src/core/deployment.ts and packages/cf-os/src/commands/deploy.ts
  4. package.json
  5. .gitmodules
  6. Available relevant upstream files under cloudflare-os/

Load docs/customization.md, docs/observability.md, package guides, and reference files from this skill only when their subject is relevant. If the submodule is unavailable, inspect all available wrapper sources and defer upstream-dependent advice until provenance is resolved.

Inspect the deploy code rather than assuming its validation, generated paths, build steps, or deployment order. Consult current Cloudflare documentation before relying on product behavior, permissions, CLI syntax, limits, or rollback support. Repository code is authoritative for what this checkout does; current Cloudflare documentation is authoritative for the platform it calls. Surface conflicts instead of silently choosing one.

Expected baseline commands are:

git submodule update --init
pnpm install                   # its postinstall (`cf-os install`) installs cloudflare-os/'s workspace too
pnpm exec wrangler login
pnpm exec cf auth login        # account lookups, Access setup, the account checks, and `cf-os secrets`; `cf-os deploy` refuses without it or a token
pnpm cf-os import <instance>   # read-only, for an instance of the hosted deploy: what it runs, and whether the pin is behind it
pnpm cf-os access --dry-run
pnpm cf-os check
pnpm cf-os deploy
pnpm cf-os api whoami          # after a deploy: the live API answers, as the identity it signed in as

Confirm them against the checkout before running them (pnpm cf-os --help lists the commands). Always use pnpm, never npm or yarn; the one exception is npx cf-os@latest update, which fetches the newest published CLI. pnpm check and pnpm deploy are aliases for the last two.

Against the account, the commands split as follows:

  • Read-only: pnpm cf-os import without --out, pnpm cf-os check, pnpm cf-os access --dry-run, and pnpm exec cf ... list/get. They suit the inventory step. import writes no file and moves no pin; to compare the pin with the instance's release it fetches upstream's history into the submodule's repository, which changes nothing checked out.
  • Local writes only: pnpm cf-os import --out <path> first moves the cloudflare-os pin forward to the release the instance runs (the submodule checked out there, the pin staged and not committed, pnpm install run, .cf-os/update.md written; never the starter merged, never a pin moved back), then writes a local file (pointed at deployment.jsonc, it edits that in place). Treat the file like any other edit to approved configuration, and the pin as Taking Over A Hosted Instance says. npx cf-os@latest update merges the starter's main (a git merge, left conflicted if it conflicts), checks the submodule out at the starter's pin, runs pnpm install, and writes .cf-os/update.md; follow that brief and references/updating.md. Its --upstream merges the starter's main the same way, committed, then stages an unreviewed pin, which needs the upgrade gate in references/upgrade-and-rollback.md before it is committed.
  • Against the instance, not the account: pnpm cf-os api <command> calls the running instance's API as the identity it signs in as (by default the operator's Access identity, from cloudflared access login <origin>), with the pinned cloudflare-os's own CLI (cloudflare-os/packages/api-cli). On a deployment it is for deployment admins only: any other identity is refused, exit 1. whoami, list-* and get-* commands only read, and so do most subscribe-* ones, except that a subscription can count as a client being present (while subscribe-to-notifications runs, the instance holds back the user's mobile push); others, such as approve-action, send-chat-message or any delete-*, change the instance's data and need approval like any other production mutation. --dry-run prints the calls and connects to nothing.
  • Mutating: pnpm cf-os access without --dry-run can create an Access application. pnpm cf-os init reads the account and writes deployment.jsonc, but its Access step can create an Access application and a One-time PIN identity provider when the operator chooses to, and once the file is complete it offers to run pnpm cf-os deploy. As a takeover (--take-over <instance>, or that choice among its questions) it also moves the pin forward, after asking. Outside a project, cf-os init <dir> can also create a private GitHub repository and push to it. pnpm cf-os secrets, and init when credentials are entered, set Gatekeeper secrets, each a new Worker version. pnpm cf-os deploy deploys every Worker without asking for confirmation. Each needs approval like any other remote mutation.

pnpm cf-os init is interactive and refuses without a terminal. Agents should use import, access, direct edits to deployment.jsonc and an approved pnpm cf-os deploy instead, which take every answer as a flag or from the file. init --take-over, run without a terminal, names the import command that carries the same flags.

Operating Rules

  • Start read-only. Inventory before mutation.
  • Ask for all missing operator decisions in one concise batch.
  • Explain why each requested value is needed and where to find it.
  • Never guess an account ID, resource ID, hostname, Access issuer, audience, administrator, Worker name, provider, or existing-resource ownership.
  • Never expose a token, cookie, JWT, secret, prompt, request body, response body, or private log content in chat, tracked files, command arguments, or reports. For local development only, use Wrangler's supported local-secret mechanism after proving the file is ignored and the credential is non-production.
  • Use the project-pinned Wrangler through pnpm exec wrangler.
  • Run only one pnpm cf-os check or pnpm cf-os deploy per checkout at a time. Use separate worktrees for concurrency.
  • Change one root cause at a time. Re-run the narrow check, then the complete check.
  • Do not broaden permissions, disable security controls, recreate resources, or retry deployments blindly to make an error disappear.
  • Keep a sanitized operation record: root commit, submodule commit, target account, intended route, Worker names, resource identities, deployment/version IDs, decisions, verification, and rollback limits.

Classify The Operation

Choose one mode before acting:

  • Research: read-only explanation or design.
  • Evaluation: a non-production deployment, usually on an explicitly protected workers.dev hostname.
  • Production: a custom domain and production data or users.
  • Incident: restore safety and service while preserving evidence.
  • Update: merge the starter's latest, and with it the starter's pin, with npx cf-os@latest update. Follow references/updating.md.
  • Upgrade: move the pinned cloudflare-os gitlink to a reviewed commit.
  • Takeover: redeploy this project over an instance the hosted deploy created. Follow Taking Over A Hosted Instance.

Also classify the deployment as a first deploy, continuation of an existing deployment, or replacement. If this is unclear, remain read-only.

Hard Stops

Secrets

Never ask the operator to paste a secret. Never read or print a secret to confirm it. Never put production secrets in deployment.jsonc, Wrangler vars, repository-local environment files, tracked files, shell history, or chat.

When AI is enabled, a human enters CF_AI_GATEWAY_API_TOKEN interactively for the exact Workshop Worker:

CLOUDFLARE_ACCOUNT_ID=<account-id> pnpm exec wrangler secret put CF_AI_GATEWAY_API_TOKEN --name <workshop-worker>

Each optional Gatekeeper's OAuth secrets go on its own Worker (gatekeepers.<slug>.name). A human enters them with pnpm cf-os secrets <slug> (or init's deploy), or by hand with wrangler secret put … --name <gatekeeper-worker> after the first deploy, since secret put on a missing Worker creates a placeholder one. check warns while one is missing.

Confirm this account selector against current Wrangler documentation. Confirm the account, existing Worker ownership, and Worker name immediately before presenting or running the interactive command. Setting a secret, with secret put or cf-os secrets, immediately deploys a new Worker version; require production approval, record its version ID, and verify it like any other deployment. Verify only that the secret name exists, never its value. If exposure is suspected, stop deployment and rotate or revoke the credential first.

Trust Boundary

Require explicit operator approval before changing any of these:

  • Cloudflare account, Worker identity, route, DNS, or Access application.
  • Access issuer, audience, sign-in method, policy, administrator list, or allowed population.
  • Existing KV/R2 bindings, publicBaseUrl, context.sharingDomain, data ownership, or service bindings. The public origin is a data boundary as well as an address: context.sharingDomain: null derives from it, so moving the hostname moves the Context isolation boundary with it.
  • AI provider, billing, token scope, model logging, retention, or external observability export.
  • Gatekeeper authority, OAuth scopes, writes, observer policy, auto-provisioning, or ambience.
  • Reporter visibility, browser reporting, retention, or destination.
  • Durable Object migrations or storage schema.

Show the authority before and after, affected users/data, cost and privacy implications, verification plan, and rollback limitations.

Production Mutation

Do not run pnpm cf-os deploy, install or delete secrets, modify Access/DNS, adopt resources, or roll back production until the operator approves a mutation summary containing:

  • Exact account ID and hostname.
  • Root and submodule commits.
  • Every Worker to create or update.
  • Every resource to provision or adopt.
  • Access application and administrator policy.
  • AI, observability, Reporter, and Gatekeeper modes.
  • Last-known-good deployment IDs and rollback limitations.
  • Evidence that pnpm cf-os check passed.

Never delete Workers, routes, Access applications, KV namespaces, R2 buckets, secrets, or user data as automatic cleanup or troubleshooting.

End-To-End Workflow

1. Establish Provenance And State

Record, without leaking credentials:

operation mode and first/continuation/replacement:
root commit and branch:
root worktree changes:
configured submodule URL:
expected submodule gitlink:
checked-out submodule commit and status:
Node, pnpm, and Wrangler versions:
Wrangler authentication source and target account:
route, hostname, and resolved public origin:
Worker names and whether each is new, owned, or conflicting:
storage choice and ownership for each binding:
AI Gateway name, providers, and whether a token is required:
error-reporting mode:
custom Gatekeeper provenance and intended policy:
last-known-good deployment/version IDs:

Inspect .gitmodules before initializing. If its URL is private or inaccessible, do not request SSH credentials, accept an unknown host key, rewrite the URL, or substitute a branch head. Offer these choices:

  1. Use an already-authorized source.
  2. Use a public mirror only after proving the exact pinned commit exists there and receiving approval for the provenance change.
  3. Stop.

The checked-out submodule commit must equal the parent gitlink. Never use git submodule update --remote or an unreviewed "latest" commit.

Check whether a CLOUDFLARE_API_TOKEN environment variable is present without printing it; it may override an expected Wrangler profile. Use sanitized pnpm exec wrangler whoami output to prove the account matches deployment.jsonc.accountId before mutation. Never run a command that prints the active authentication token.

Inventory remote Worker-name and route collisions. A syntactically valid Worker name can overwrite an unrelated Worker in the same account. Stop on unknown ownership.

2. Collect Deployment Decisions

Ask once for any decisions not established by existing approved configuration:

  1. Evaluation or production, target account, exact hostname, and zone for a custom domain. On a workers.dev route, also the exact publicBaseUrl origin, which the operator has to supply because nothing in the checkout can derive it.
  2. Access application, intended users, identity provider requirements, administrators, and denied test identity.
  3. Stable names for the Router, Workshop, Context, Scheduler, Web Search, Custom Gatekeeper, Error Reporter, and each optional Gatekeeper (<router>-gk-<slug> by default, as the hosted flow names them). The PDF renderer, deployed for Google, is <router>-pdf-renderer unless workers.pdfRenderer.name says otherwise; it holds no data. Only the Router's name appears in the public URL; the Workshop's is the identity every Durable Object belongs to, and Context and Scheduler own Durable Objects of their own — collections and schedules — so renaming either strands its data. An optional Gatekeeper's Durable Objects hold its users' connections, so the same holds for it.
  4. New auto-provisioned or existing resource for each of Context KV, Blueprints KV, Avatars KV, and Blueprint Content R2.
  5. Which AI Gateway and which providers; billing/BYOK on the gateway, budget, prompt/response logging, and retention. Disabling aiGateway at all is the exception, not the default.
  6. Error Reporter enabled state, environment/release metadata, telemetry sampling, and retention/export policy.
  7. Web Search disabled, optional, or enabled, and who pays for searches: AI Gateway credits on the account, or a Ceramic key on the gateway it actually searches through (aiGateway.name when it is in this account, otherwise the account's default gateway). The free Workers AI allowance does not cover them, and the mode is set in /admin after deploying, not by the deploy.
  8. Custom Gatekeeper not deployed (customGatekeeper.enabled: false), or deployed and disabled, optional, or enabled in /admin, and whether its code still matches the low-stakes example.
  9. Which optional Gatekeepers to deploy (gatekeepers), and for each OAuth one, who owns its OAuth application and scopes. The MCP portal also needs gatekeepers.mcpportal.vars.MCP_PORTAL_URL.
  10. Rollback tolerance and the person authorized to approve production mutation.
스킬의 지침이 아직 전부 로드되지 않았습니다. 계속 읽어 상위 폴더의 규칙과 필수 내용을 확인하세요.

이 스킬의 파일

지원 파일 전체 둘러보기