---
name: "cloudflare-r2-s3-compatible-storage"
description: "Store and serve multimedia assets globally with 100% S3 API compatibility and zero egress charges."
metadata:
  author: "Cloudflare"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "setup cloudflare r2 bucket"
  - "presigned url cloudflare r2"
  - "connect s3 client to r2"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Cloudflare R2 Object Storage with Zero Egress Fees

Deploys Cloudflare R2: configuring buckets, generating S3-compatible API tokens, setting up custom domain public access, presigned upload URLs in Node/Python, and cache headers.

## When to Invoke
Invoke this skill whenever you need to:
- setup cloudflare r2 bucket
- presigned url cloudflare r2
- connect s3 client to r2

## Execution SOP & Rules
1. Create R2 bucket via wrangler r2 bucket create <name> or Cloudflare dashboard.
2. Initialize AWS S3 Client passing endpoint: https://<account_id>.r2.cloudflarestorage.com.
3. Connect custom domain under R2 Bucket Settings -> Public Access -> Custom Domains.
4. Set Cache-Control: public, max-age=31536000, immutable on static uploads to leverage edge cache.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
