---
name: cloudflare-production-builder
description: Design, review, debug, migrate, or deploy production systems on Cloudflare Workers and related Developer Platform products. Use for material architecture, durability, release, migration, rollback, or live-verification decisions across Workers, Durable Objects, D1, R2, Queues, Workflows, bindings, and routes.
---

# Cloudflare Production Builder

Apply this guidance proportionally. It is a production reasoning aid, not a
mandatory ceremony layer. Stay within the user's requested operation and do not
turn a diagnosis or recovery into an architecture program.

## Choose the operating mode

- **Answer or diagnose:** inspect only the evidence needed to explain the
  behavior. Do not mutate or design a replacement unless asked.
- **Recover:** restore a known-good capability with the smallest supported,
  reversible operation. Preserve evidence and defer refactoring.
- **Change or migrate:** design compatibility, durability, rollout, verification,
  and rollback for the surfaces actually affected.

Do not mix recovery and refactoring in one production operation.

## Core contract

1. Identify authoritative state, the coordination key, the durability boundary,
   and user-visible completion.
2. Treat source, build, upload, configuration, migration, traffic, route,
   stateful lifecycle, and live behavior as separate facts only when the task
   depends on those surfaces.
3. Prefer immutable artifacts and conditional pointer changes. Make external
   mutations idempotent, fenced, conditional, or compensatable.
4. Classify errors before retrying. Persist terminal domain failures; bound
   transient retries; reconcile ambiguous mutations before replay.
5. Preserve accepted work across handoff failures. Use a durable record and a
   repair path when an initiating request can disappear.
6. Verify the owning live path and exact identity after a production mutation.
   Use precise language such as `version uploaded`, `traffic switched`, and
   `live smoke passed`.

## Proportional workflow

1. Inspect current code and provisioned state for the touched surface. Resolve
   the exact account, environment, resource, bindings, and live version before
   mutation.
2. State the intended authority and repair/rollback path. For simple work, one
   sentence is enough.
3. Run focused local or remote checks that can falsify the change. Do not add
   unrelated global gates.
4. When authorized to deploy, upload and inspect before switching when the
   provider supports it. Use a verification path supported by the topology.
5. After mutation, verify only the affected rollout axes plus the user-visible
   capability. Record exact identities and rollback evidence.

Pause when the exact production target, current state, retry safety, or rollback
target cannot be resolved. A blocker in an unrelated surface is not permission
to broaden the operation.

## Load references selectively

- [primitive-selection.md](references/primitive-selection.md): use when the
  product or coordination primitive is genuinely undecided.
- [durable-execution.md](references/durable-execution.md): use for asynchronous
  handoffs, retries, queues, Workflows, or long-running external work.
- [storage-and-caching.md](references/storage-and-caching.md): use for storage,
  cache, and authorization boundaries.
- [deployments-and-migrations.md](references/deployments-and-migrations.md): use
  for multi-surface rollout, schema or Durable Object lifecycle, and rollback.
- [multitenant-hosting-and-security.md](references/multitenant-hosting-and-security.md):
  use for untrusted code or tenant isolation.
- [observability-testing-and-cost.md](references/observability-testing-and-cost.md):
  use when adding or reviewing telemetry, test layers, or spend controls.

Retrieve current first-party Cloudflare documentation before relying on API
signatures, configuration, limits, pricing, retention, or product support.
