cloudflare-deploylisted
Install: claude install-skill rvanbaalen/skills
# Deploy Astro Site to Cloudflare Workers
Guide for setting up and deploying Astro sites to Cloudflare Workers with custom domains. This encodes tested patterns that avoid common pitfalls.
## Critical Rule
**Never run `wrangler deploy` or `wrangler pages deploy` locally.** Deployments happen by pushing to git. The CI/CD pipeline (Cloudflare dashboard connected to GitHub) handles the rest. Local deploys create version drift and bypass any CI checks.
The only local wrangler commands you should run are diagnostic/read-only ones like `wrangler whoami`, `wrangler deployments list`, and `wrangler dev` (local preview).
## Setup Checklist
Work through these steps in order. Each step has a verification check.
### 1. Install the Cloudflare Adapter
```bash
npm install @astrojs/cloudflare
```
Astro 6 also requires an explicit Vite 7 dependency to avoid build errors (`require_dist is not a function`):
```bash
npm install vite@^7
```
**Verify:** `package.json` has both `@astrojs/cloudflare` and `vite: "^7"` in dependencies.
### 2. Configure astro.config.mjs
The adapter should only activate for builds, not during local dev. Use this conditional pattern:
```js
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
site: 'https://your-domain.example.com',
adapter: process.argv.includes('dev') ? undefined : cloudflare(),
vite: {
plugins: [tailwindcss()],
},