Deploying with Claude
Deployment is where everything comes together. Claude Code can handle the entire flow from code to production.
The Deployment Workflow
Section titled “The Deployment Workflow”1. Build Verification
Section titled “1. Build Verification”> Run the build and make sure there are no errorsClaude runs your build command, reads the output, and fixes any issues.
2. Pre-Deploy Checks
Section titled “2. Pre-Deploy Checks”> Before deploying, check:> - All tests pass> - No TypeScript errors> - No console.logs in production code> - Environment variables are setClaude runs through each check systematically.
3. Deploy
Section titled “3. Deploy”> Deploy to Cloudflare Pagesnpx wrangler pages deploy dist --project-name my-app4. Post-Deploy Verification
Section titled “4. Post-Deploy Verification”> Check that the deployment is live and the homepage loadsClaude can curl the deployed URL and verify it’s responding.
Wrangler Configuration
Section titled “Wrangler Configuration”A complete wrangler.toml for a full-stack app:
name = "my-app"compatibility_date = "2024-01-01"pages_build_output_dir = "./dist"
# D1 Database[[d1_databases]]binding = "DB"database_name = "my-app-db"database_id = "your-database-id"
# KV Namespace[[kv_namespaces]]binding = "KV"id = "your-kv-id"
# R2 Bucket[[r2_buckets]]binding = "ASSETS"bucket_name = "my-assets"
# Environment Variables[vars]ENVIRONMENT = "production"Local Development
Section titled “Local Development”# Pages with Functionsnpx wrangler pages dev dist
# Workersnpx wrangler devBoth commands start a local server with access to your Cloudflare bindings (D1, KV, R2) using local emulation.
Creating a Deploy Skill
Section titled “Creating a Deploy Skill”Automate your deployment with a custom skill:
---name: deploydescription: Build, verify, and deploy to Cloudflare---
1. Run the build: `npm run build`2. Run tests: `npm test`3. Check for issues: - No TypeScript errors - No console.log statements in src/ - Build output exists in dist/4. Deploy: `npx wrangler pages deploy dist --project-name PROJECT_NAME`5. Verify the deployment URL responds with 2006. Report the deployment URLNow deployment is just:
> /deployExercise
Section titled “Exercise”- Set up a
wrangler.tomlfor your project - Test locally with
wrangler pages dev - Deploy to Cloudflare Pages
- Create a custom
/deployskill for your workflow - Use the Cloudflare MCP to verify the deployment