[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6NZ23610KQKMZYJ84S45CC9":3,"skill-same:01M6NZ23610KQKMZYJ84S45CC9":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":21,"commitSha":52,"skillDirectory":53,"forksCount":13,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6NZ23610KQKMZYJ84S45CC9","cloudflare-r2",null,"Manage Cloudflare R2 buckets, lifecycle, and signed URLs. Use for low-egress object storage and media delivery.","duc-duy-1612\u002FOnline-Delivery-Systems-Web","duc-duy-1612","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192231384?v=4","01M6NSDKQQDKVTHZ8DZMZ1VYY6","01M6NSDKW8DDVTQHBT1HBDDJPT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fcloudflare-r2\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"cloudflare","r2","cloudflare r2","main","for","relevant","scripts","critical","os","platform","delivery","security","community","manage","only","access","Media","lifecycle","devops-security","storage","2026-11-10 10:12:30",false,"---\nname: cloudflare-r2\ndescription: Manage Cloudflare R2 buckets, lifecycle, and signed URLs. Use for low-egress\n  object storage and media delivery.\ncategory: devops\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\nsource_repo: BagelHole\u002FDevOps-Security-Agent-Skills\nsource_type: community\ndate_added: '2026-09-20'\nlicense: MIT\nlicense_source: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE\ncompatibility: Requires the relevant OS\u002Fplatform tooling and privileged access where\n  noted. Docs-only; helper scripts and templates not bundled.\nmetadata:\n  author: devops-skills\n  version: '1.0'\n---\n\n# Cloudflare R2\n\nS3-compatible object storage with zero egress fees, built on Cloudflare's global network.\n\n## When to Use\n\n- Storing user uploads, media files, backups, or static assets.\n- Replacing AWS S3 to eliminate egress costs for read-heavy workloads.\n- Serving files at the edge via Workers or public bucket access.\n- Building multi-cloud storage that avoids vendor lock-in (S3 API compatible).\n- Storing ML model artifacts, training data, or inference results.\n\n## Prerequisites\n\n- Cloudflare account with R2 enabled (dashboard > R2 > subscribe).\n- Wrangler CLI v3+ installed: `npm install -g wrangler`.\n- Authenticated via `wrangler login` or `CLOUDFLARE_API_TOKEN`.\n- For S3 API access: R2 API token created under **R2 > Manage R2 API Tokens**.\n\n## Bucket Management with Wrangler\n\n### Create and List Buckets\n\n```bash\n# Create a new bucket\nnpx wrangler r2 bucket create app-assets\n\n# Create a bucket in a specific region (hint for data locality)\nnpx wrangler r2 bucket create eu-uploads --location=eu\n\n# List all buckets\nnpx wrangler r2 bucket list\n\n# Delete an empty bucket\nnpx wrangler r2 bucket delete old-bucket\n```\n\n### Object Operations\n\n```bash\n# Upload a single file\nnpx wrangler r2 object put app-assets\u002Fimages\u002Flogo.png --file=.\u002Flogo.png\n\n# Upload with content type\nnpx wrangler r2 object put app-assets\u002Fdata\u002Freport.json \\\n  --file=.\u002Freport.json \\\n  --content-type=\"application\u002Fjson\"\n\n# Download an object\nnpx wrangler r2 object get app-assets\u002Fimages\u002Flogo.png --file=.\u002Fdownloaded-logo.png\n\n# Delete an object\nnpx wrangler r2 object delete app-assets\u002Fimages\u002Fold-logo.png\n\n# Get object metadata\nnpx wrangler r2 object head app-assets\u002Fimages\u002Flogo.png\n```\n\n## S3-Compatible API Access\n\nR2 supports the S3 API, so existing tools (AWS CLI, boto3, s3cmd) work out of the box.\n\n### Generate R2 API Tokens\n\n1. Go to **R2 > Manage R2 API Tokens > Create API token**.\n2. Select permissions: Object Read & Write, or Object Read only.\n3. Scope to specific buckets if possible.\n4. Save the Access Key ID and Secret Access Key.\n\n### AWS CLI Configuration\n\n```bash\n# Configure a named profile for R2\naws configure --profile r2\n# Access Key ID: \u003Cyour-r2-access-key>\n# Secret Access Key: \u003Cyour-r2-secret-key>\n# Region: auto\n# Output: json\n\n# Use the R2 endpoint\nexport R2_ENDPOINT=\"https:\u002F\u002F\u003CACCOUNT_ID>.r2.cloudflarestorage.com\"\n\n# List buckets\naws s3 ls --endpoint-url=$R2_ENDPOINT --profile=r2\n\n# Sync a directory\naws s3 sync .\u002Fdist s3:\u002F\u002Fapp-assets\u002Fstatic\u002F \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n\n# Copy a file\naws s3 cp .\u002Fbackup.tar.gz s3:\u002F\u002Fapp-assets\u002Fbackups\u002Fbackup-$(date +%Y%m%d).tar.gz \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n\n# List objects with prefix\naws s3 ls s3:\u002F\u002Fapp-assets\u002Fimages\u002F \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n\n# Remove objects by prefix\naws s3 rm s3:\u002F\u002Fapp-assets\u002Ftmp\u002F --recursive \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n```\n\n### Python boto3 Client\n\n```python\nimport boto3\n\ns3 = boto3.client(\n    \"s3\",\n    endpoint_url=\"https:\u002F\u002F\u003CACCOUNT_ID>.r2.cloudflarestorage.com\",\n    aws_access_key_id=\"\u003CR2_ACCESS_KEY>\",\n    aws_secret_access_key=\"\u003CR2_SECRET_KEY>\",\n    region_name=\"auto\",\n)\n\n# Upload file\ns3.upload_file(\".\u002Freport.pdf\", \"app-assets\", \"reports\u002Freport.pdf\")\n\n# Generate presigned URL (valid for 1 hour)\nurl = s3.generate_presigned_url(\n    \"get_object\",\n    Params={\"Bucket\": \"app-assets\", \"Key\": \"reports\u002Freport.pdf\"},\n    ExpiresIn=3600,\n)\nprint(url)\n\n# List objects\nresponse = s3.list_objects_v2(Bucket=\"app-assets\", Prefix=\"images\u002F\", MaxKeys=100)\nfor obj in response.get(\"Contents\", []):\n    print(f\"{obj['Key']} - {obj['Size']} bytes\")\n```\n\n## Worker Bindings\n\nBind R2 buckets to Workers or Pages Functions for server-side access without API tokens.\n\n### Wrangler Configuration\n\n```toml\n# wrangler.toml\nname = \"asset-worker\"\nmain = \"src\u002Findex.ts\"\ncompatibility_date = \"2024-09-01\"\n\n[[r2_buckets]]\nbinding = \"ASSETS\"\nbucket_name = \"app-assets\"\n\n[[r2_buckets]]\nbinding = \"UPLOADS\"\nbucket_name = \"user-uploads\"\n```\n\n### Worker with R2 Operations\n\n```typescript\n\u002F\u002F src\u002Findex.ts\ninterface Env {\n  ASSETS: R2Bucket;\n  UPLOADS: R2Bucket;\n}\n\nexport default {\n  async fetch(request: Request, env: Env): Promise\u003CResponse> {\n    const url = new URL(request.url);\n\n    \u002F\u002F GET — serve file from R2\n    if (request.method === \"GET\") {\n      const key = url.pathname.slice(1); \u002F\u002F strip leading \u002F\n      const object = await env.ASSETS.get(key);\n\n      if (!object) {\n        return new Response(\"Not Found\", { status: 404 });\n      }\n\n      const headers = new Headers();\n      object.writeHttpMetadata(headers);\n      headers.set(\"etag\", object.httpEtag);\n      headers.set(\"cache-control\", \"public, max-age=86400\");\n\n      return new Response(object.body, { headers });\n    }\n\n    \u002F\u002F PUT — upload file to R2\n    if (request.method === \"PUT\") {\n      const key = url.pathname.slice(1);\n      const contentType = request.headers.get(\"content-type\") || \"application\u002Foctet-stream\";\n\n      await env.UPLOADS.put(key, request.body, {\n        httpMetadata: { contentType },\n        customMetadata: { uploadedAt: new Date().toISOString() },\n      });\n\n      return new Response(JSON.stringify({ key, status: \"uploaded\" }), {\n        headers: { \"Content-Type\": \"application\u002Fjson\" },\n      });\n    }\n\n    \u002F\u002F DELETE — remove file\n    if (request.method === \"DELETE\") {\n      const key = url.pathname.slice(1);\n      await env.UPLOADS.delete(key);\n      return new Response(null, { status: 204 });\n    }\n\n    return new Response(\"Method Not Allowed\", { status: 405 });\n  },\n};\n```\n\n### Presigned URL Generation in a Worker\n\n```typescript\n\u002F\u002F Generate time-limited signed URLs using Workers\nimport { AwsClient } from \"aws4fetch\";\n\ninterface Env {\n  R2_ACCESS_KEY: string;\n  R2_SECRET_KEY: string;\n  R2_ACCOUNT_ID: string;\n}\n\nexport default {\n  async fetch(request: Request, env: Env): Promise\u003CResponse> {\n    const aws = new AwsClient({\n      accessKeyId: env.R2_ACCESS_KEY,\n      secretAccessKey: env.R2_SECRET_KEY,\n    });\n\n    const url = new URL(request.url);\n    const key = url.searchParams.get(\"key\");\n    if (!key) return new Response(\"Missing key\", { status: 400 });\n\n    const r2Url = `https:\u002F\u002F${env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com\u002Fapp-assets\u002F${key}`;\n\n    const signed = await aws.sign(new Request(r2Url), {\n      aws: { signQuery: true },\n    });\n\n    return Response.json({ url: signed.url });\n  },\n};\n```\n\n## Public Bucket Access\n\nEnable public access to serve files directly without a Worker.\n\n1. Go to **R2 > bucket > Settings > Public access**.\n2. Enable and set a custom domain (e.g., `assets.example.com`).\n3. Objects are accessible at `https:\u002F\u002Fassets.example.com\u002F\u003Ckey>`.\n\n```bash\n# Or enable via the r2.dev subdomain (for testing)\n# Bucket Settings > R2.dev subdomain > Allow Access\n# URL: https:\u002F\u002Fpub-\u003Chash>.r2.dev\u002F\u003Ckey>\n```\n\n## Lifecycle Rules\n\nConfigure automatic object expiration or transition.\n\n```bash\n# Set lifecycle rules via the Cloudflare dashboard:\n# R2 > bucket > Settings > Object lifecycle rules\n\n# Or via API\ncurl -X PUT \"https:\u002F\u002Fapi.cloudflare.com\u002Fclient\u002Fv4\u002Faccounts\u002F$ACCOUNT_ID\u002Fr2\u002Fbuckets\u002Fapp-assets\u002Flifecycle\" \\\n  -H \"Authorization: Bearer $CF_API_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"rules\": [\n      {\n        \"id\": \"expire-tmp-files\",\n        \"enabled\": true,\n        \"conditions\": { \"prefix\": \"tmp\u002F\" },\n        \"actions\": { \"deleteObject\": { \"daysAfterCreationDate\": 7 } }\n      },\n      {\n        \"id\": \"expire-old-logs\",\n        \"enabled\": true,\n        \"conditions\": { \"prefix\": \"logs\u002F\" },\n        \"actions\": { \"deleteObject\": { \"daysAfterCreationDate\": 90 } }\n      }\n    ]\n  }'\n```\n\n## CORS Configuration\n\n```bash\n# Set CORS policy for browser-based uploads\ncurl -X PUT \"https:\u002F\u002Fapi.cloudflare.com\u002Fclient\u002Fv4\u002Faccounts\u002F$ACCOUNT_ID\u002Fr2\u002Fbuckets\u002Fapp-assets\u002Fcors\" \\\n  -H \"Authorization: Bearer $CF_API_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"corsRules\": [\n      {\n        \"allowedOrigins\": [\"https:\u002F\u002Fexample.com\"],\n        \"allowedMethods\": [\"GET\", \"PUT\", \"HEAD\"],\n        \"allowedHeaders\": [\"Content-Type\", \"Authorization\"],\n        \"maxAgeSeconds\": 3600\n      }\n    ]\n  }'\n```\n\n## Troubleshooting\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `NoSuchBucket` error via S3 API | Wrong endpoint or bucket name | Verify endpoint is `https:\u002F\u002F\u003CACCOUNT_ID>.r2.cloudflarestorage.com` |\n| `SignatureDoesNotMatch` | Incorrect secret key or endpoint mismatch | Regenerate R2 API token; ensure region is `auto` |\n| Uploads succeed but GET returns 404 | Key path mismatch (leading slash) | R2 keys should not start with `\u002F` |\n| Slow uploads for large files | Single-stream upload | Use multipart upload; set `--expected-size` with wrangler |\n| CORS errors in browser | Missing CORS config on bucket | Add CORS rules for your origin domain |\n| Worker binding returns `undefined` | `wrangler.toml` binding name mismatch | Verify `binding` name matches `Env` interface property |\n| Public access returns 403 | Public access not enabled | Enable in bucket Settings > Public access |\n\n## Related Skills\n\n- cloudflare-workers (`cloudflare-workers`) - Signed URL generation and edge file serving\n- cloudflare-pages (`cloudflare-pages`) - Pages Functions with R2 bindings\n- cdn-setup (`cdn-setup`) - CDN configuration for asset delivery\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n","# Cloudflare R2\n\nS3-compatible object storage with zero egress fees, built on Cloudflare's global network.\n\n## When to Use\n\n- Storing user uploads, media files, backups, or static assets.\n- Replacing AWS S3 to eliminate egress costs for read-heavy workloads.\n- Serving files at the edge via Workers or public bucket access.\n- Building multi-cloud storage that avoids vendor lock-in (S3 API compatible).\n- Storing ML model artifacts, training data, or inference results.\n\n## Prerequisites\n\n- Cloudflare account with R2 enabled (dashboard > R2 > subscribe).\n- Wrangler CLI v3+ installed: `npm install -g wrangler`.\n- Authenticated via `wrangler login` or `CLOUDFLARE_API_TOKEN`.\n- For S3 API access: R2 API token created under **R2 > Manage R2 API Tokens**.\n\n## Bucket Management with Wrangler\n\n### Create and List Buckets\n\n```bash\n# Create a new bucket\nnpx wrangler r2 bucket create app-assets\n\n# Create a bucket in a specific region (hint for data locality)\nnpx wrangler r2 bucket create eu-uploads --location=eu\n\n# List all buckets\nnpx wrangler r2 bucket list\n\n# Delete an empty bucket\nnpx wrangler r2 bucket delete old-bucket\n```\n\n### Object Operations\n\n```bash\n# Upload a single file\nnpx wrangler r2 object put app-assets\u002Fimages\u002Flogo.png --file=.\u002Flogo.png\n\n# Upload with content type\nnpx wrangler r2 object put app-assets\u002Fdata\u002Freport.json \\\n  --file=.\u002Freport.json \\\n  --content-type=\"application\u002Fjson\"\n\n# Download an object\nnpx wrangler r2 object get app-assets\u002Fimages\u002Flogo.png --file=.\u002Fdownloaded-logo.png\n\n# Delete an object\nnpx wrangler r2 object delete app-assets\u002Fimages\u002Fold-logo.png\n\n# Get object metadata\nnpx wrangler r2 object head app-assets\u002Fimages\u002Flogo.png\n```\n\n## S3-Compatible API Access\n\nR2 supports the S3 API, so existing tools (AWS CLI, boto3, s3cmd) work out of the box.\n\n### Generate R2 API Tokens\n\n1. Go to **R2 > Manage R2 API Tokens > Create API token**.\n2. Select permissions: Object Read & Write, or Object Read only.\n3. Scope to specific buckets if possible.\n4. Save the Access Key ID and Secret Access Key.\n\n### AWS CLI Configuration\n\n```bash\n# Configure a named profile for R2\naws configure --profile r2\n# Access Key ID: \u003Cyour-r2-access-key>\n# Secret Access Key: \u003Cyour-r2-secret-key>\n# Region: auto\n# Output: json\n\n# Use the R2 endpoint\nexport R2_ENDPOINT=\"https:\u002F\u002F\u003CACCOUNT_ID>.r2.cloudflarestorage.com\"\n\n# List buckets\naws s3 ls --endpoint-url=$R2_ENDPOINT --profile=r2\n\n# Sync a directory\naws s3 sync .\u002Fdist s3:\u002F\u002Fapp-assets\u002Fstatic\u002F \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n\n# Copy a file\naws s3 cp .\u002Fbackup.tar.gz s3:\u002F\u002Fapp-assets\u002Fbackups\u002Fbackup-$(date +%Y%m%d).tar.gz \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n\n# List objects with prefix\naws s3 ls s3:\u002F\u002Fapp-assets\u002Fimages\u002F \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n\n# Remove objects by prefix\naws s3 rm s3:\u002F\u002Fapp-assets\u002Ftmp\u002F --recursive \\\n  --endpoint-url=$R2_ENDPOINT \\\n  --profile=r2\n```\n\n### Python boto3 Client\n\n```python\nimport boto3\n\ns3 = boto3.client(\n    \"s3\",\n    endpoint_url=\"https:\u002F\u002F\u003CACCOUNT_ID>.r2.cloudflarestorage.com\",\n    aws_access_key_id=\"\u003CR2_ACCESS_KEY>\",\n    aws_secret_access_key=\"\u003CR2_SECRET_KEY>\",\n    region_name=\"auto\",\n)\n\n# Upload file\ns3.upload_file(\".\u002Freport.pdf\", \"app-assets\", \"reports\u002Freport.pdf\")\n\n# Generate presigned URL (valid for 1 hour)\nurl = s3.generate_presigned_url(\n    \"get_object\",\n    Params={\"Bucket\": \"app-assets\", \"Key\": \"reports\u002Freport.pdf\"},\n    ExpiresIn=3600,\n)\nprint(url)\n\n# List objects\nresponse = s3.list_objects_v2(Bucket=\"app-assets\", Prefix=\"images\u002F\", MaxKeys=100)\nfor obj in response.get(\"Contents\", []):\n    print(f\"{obj['Key']} - {obj['Size']} bytes\")\n```\n\n## Worker Bindings\n\nBind R2 buckets to Workers or Pages Functions for server-side access without API tokens.\n\n### Wrangler Configuration\n\n```toml\n# wrangler.toml\nname = \"asset-worker\"\nmain = \"src\u002Findex.ts\"\ncompatibility_date = \"2024-09-01\"\n\n[[r2_buckets]]\nbinding = \"ASSETS\"\nbucket_name = \"app-assets\"\n\n[[r2_buckets]]\nbinding = \"UPLOADS\"\nbucket_name = \"user-uploads\"\n```\n\n### Worker with R2 Operations\n\n```typescript\n\u002F\u002F src\u002Findex.ts\ninterface Env {\n  ASSETS: R2Bucket;\n  UPLOADS: R2Bucket;\n}\n\nexport default {\n  async fetch(request: Request, env: Env): Promise\u003CResponse> {\n    const url = new URL(request.url);\n\n    \u002F\u002F GET — serve file from R2\n    if (request.method === \"GET\") {\n      const key = url.pathname.slice(1); \u002F\u002F strip leading \u002F\n      const object = await env.ASSETS.get(key);\n\n      if (!object) {\n        return new Response(\"Not Found\", { status: 404 });\n      }\n\n      const headers = new Headers();\n      object.writeHttpMetadata(headers);\n      headers.set(\"etag\", object.httpEtag);\n      headers.set(\"cache-control\", \"public, max-age=86400\");\n\n      return new Response(object.body, { headers });\n    }\n\n    \u002F\u002F PUT — upload file to R2\n    if (request.method === \"PUT\") {\n      const key = url.pathname.slice(1);\n      const contentType = request.headers.get(\"content-type\") || \"application\u002Foctet-stream\";\n\n      await env.UPLOADS.put(key, request.body, {\n        httpMetadata: { contentType },\n        customMetadata: { uploadedAt: new Date().toISOString() },\n      });\n\n      return new Response(JSON.stringify({ key, status: \"uploaded\" }), {\n        headers: { \"Content-Type\": \"application\u002Fjson\" },\n      });\n    }\n\n    \u002F\u002F DELETE — remove file\n    if (request.method === \"DELETE\") {\n      const key = url.pathname.slice(1);\n      await env.UPLOADS.delete(key);\n      return new Response(null, { status: 204 });\n    }\n\n    return new Response(\"Method Not Allowed\", { status: 405 });\n  },\n};\n```\n\n### Presigned URL Generation in a Worker\n\n```typescript\n\u002F\u002F Generate time-limited signed URLs using Workers\nimport { AwsClient } from \"aws4fetch\";\n\ninterface Env {\n  R2_ACCESS_KEY: string;\n  R2_SECRET_KEY: string;\n  R2_ACCOUNT_ID: string;\n}\n\nexport default {\n  async fetch(request: Request, env: Env): Promise\u003CResponse> {\n    const aws = new AwsClient({\n      accessKeyId: env.R2_ACCESS_KEY,\n      secretAccessKey: env.R2_SECRET_KEY,\n    });\n\n    const url = new URL(request.url);\n    const key = url.searchParams.get(\"key\");\n    if (!key) return new Response(\"Missing key\", { status: 400 });\n\n    const r2Url = `https:\u002F\u002F${env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com\u002Fapp-assets\u002F${key}`;\n\n    const signed = await aws.sign(new Request(r2Url), {\n      aws: { signQuery: true },\n    });\n\n    return Response.json({ url: signed.url });\n  },\n};\n```\n\n## Public Bucket Access\n\nEnable public access to serve files directly without a Worker.\n\n1. Go to **R2 > bucket > Settings > Public access**.\n2. Enable and set a custom domain (e.g., `assets.example.com`).\n3. Objects are accessible at `https:\u002F\u002Fassets.example.com\u002F\u003Ckey>`.\n\n```bash\n# Or enable via the r2.dev subdomain (for testing)\n# Bucket Settings > R2.dev subdomain > Allow Access\n# URL: https:\u002F\u002Fpub-\u003Chash>.r2.dev\u002F\u003Ckey>\n```\n\n## Lifecycle Rules\n\nConfigure automatic object expiration or transition.\n\n```bash\n# Set lifecycle rules via the Cloudflare dashboard:\n# R2 > bucket > Settings > Object lifecycle rules\n\n# Or via API\ncurl -X PUT \"https:\u002F\u002Fapi.cloudflare.com\u002Fclient\u002Fv4\u002Faccounts\u002F$ACCOUNT_ID\u002Fr2\u002Fbuckets\u002Fapp-assets\u002Flifecycle\" \\\n  -H \"Authorization: Bearer $CF_API_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"rules\": [\n      {\n        \"id\": \"expire-tmp-files\",\n        \"enabled\": true,\n        \"conditions\": { \"prefix\": \"tmp\u002F\" },\n        \"actions\": { \"deleteObject\": { \"daysAfterCreationDate\": 7 } }\n      },\n      {\n        \"id\": \"expire-old-logs\",\n        \"enabled\": true,\n        \"conditions\": { \"prefix\": \"logs\u002F\" },\n        \"actions\": { \"deleteObject\": { \"daysAfterCreationDate\": 90 } }\n      }\n    ]\n  }'\n```\n\n## CORS Configuration\n\n```bash\n# Set CORS policy for browser-based uploads\ncurl -X PUT \"https:\u002F\u002Fapi.cloudflare.com\u002Fclient\u002Fv4\u002Faccounts\u002F$ACCOUNT_ID\u002Fr2\u002Fbuckets\u002Fapp-assets\u002Fcors\" \\\n  -H \"Authorization: Bearer $CF_API_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"corsRules\": [\n      {\n        \"allowedOrigins\": [\"https:\u002F\u002Fexample.com\"],\n        \"allowedMethods\": [\"GET\", \"PUT\", \"HEAD\"],\n        \"allowedHeaders\": [\"Content-Type\", \"Authorization\"],\n        \"maxAgeSeconds\": 3600\n      }\n    ]\n  }'\n```\n\n## Troubleshooting\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `NoSuchBucket` error via S3 API | Wrong endpoint or bucket name | Verify endpoint is `https:\u002F\u002F\u003CACCOUNT_ID>.r2.cloudflarestorage.com` |\n| `SignatureDoesNotMatch` | Incorrect secret key or endpoint mismatch | Regenerate R2 API token; ensure region is `auto` |\n| Uploads succeed but GET returns 404 | Key path mismatch (leading slash) | R2 keys should not start with `\u002F` |\n| Slow uploads for large files | Single-stream upload | Use multipart upload; set `--expected-size` with wrangler |\n| CORS errors in browser | Missing CORS config on bucket | Add CORS rules for your origin domain |\n| Worker binding returns `undefined` | `wrangler.toml` binding name mismatch | Verify `binding` name matches `Env` interface property |\n| Public access returns 403 | Public access not enabled | Enable in bucket Settings > Public access |\n\n## Related Skills\n\n- cloudflare-workers (`cloudflare-workers`) - Signed URL generation and edge file serving\n- cloudflare-pages (`cloudflare-pages`) - Pages Functions with R2 bindings\n- cdn-setup (`cdn-setup`) - CDN configuration for asset delivery\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n",{"name":5,"risk":25,"source":43,"license":14,"category":44,"metadata":45,"date_added":48,"description":7,"source_repo":49,"source_type":30,"compatibility":50,"license_source":51},"https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills","devops",{"author":46,"version":47},"devops-skills","1.0","2026-09-20","BagelHole\u002FDevOps-Security-Agent-Skills","Requires the relevant OS\u002Fplatform tooling and privileged access where noted. Docs-only; helper scripts and templates not bundled.","https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE","f3312ba749561b6159f477dbfc9313c875d40a56",".agents\u002Fskills_archive\u002Fcloudflare-r2","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612","2026-10-25 23:50:58",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill cloudflare-r2",{"tool":63,"command":64},"bunx","bunx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill cloudflare-r2",{"tool":66,"command":67},"pnpm","pnpm dlx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill cloudflare-r2","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fcloudflare-r2\u002FSKILL.md",true,[],[72,95,119,144,172,196],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":83,"publishedAt":38},"01M6Q0FA5FZ410Z33Z3TFQ4DBA","zero-trust","Implement zero-trust network architecture. Configure identity-based access, micro-segmentation, and continuous verification. Use when implementing modern security architectures.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzero-trust\u002FSKILL.md",[78],{"categoryNo":79,"categoryName":80,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",[84,85,86,87,88,89,74,90,36,33,91,32,30,21,92,25,93,24,23,94],"ZeRO","trust","zero trust","architecture","assessment","verification","segmentation","configure","active","scope","implementing",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":38},"01M6Q0F1YZJW3KX5FBKEVZ8CV4","zcode-delegate","Delegate coding tasks to the Z.AI ZCode CLI only when the user explicitly requests it, while the orchestrator retains review and landing responsibility.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzcode-delegate\u002FSKILL.md",[],[102,103,104,105,106,107,108,109,110,111,112,113,114,32,115,30,116,117,25,118],"delegate","zcode","zcode delegate","review","cli","orchestration","tasks","run","Bash","model","node","read","orchestrator","files","desktop app","app","agent-orchestration",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":38},"01M6Q0ETK41VGNMYEXW0T00AJN","youtube-transcript","Fetch YouTube transcripts through DeepAPI or local fallback tooling and save clean text output.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript\u002FSKILL.md",[],[126,127,128,129,130,131,132,133,134,135,136,137,138,30,21,139,140,141,142,143],"transcript","youtube transcript","youtube","safe","github","codex","research","license","https","text","fetch","tooling","clean","local","output","deepapi","youtube transcripts","blob",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":161,"publishedAt":38},"01M6Q0EPPH2PVMDW40017F8WX0","youtube-transcript-skills","Fetch YouTube video transcripts, search videos\u002Fchannels, browse channels, and extract playlists via the getyoutubetranscript.com API - free tier, no card required.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript-skills\u002FSKILL.md",[150,153,156],{"categoryNo":151,"categoryName":152,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":154,"categoryName":155,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":157,"categoryName":158,"taxonomyType":159,"taxonomyTypeDesc":160},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[126,127,128,162,129,163,130,131,133,164,165,166,167,136,168,30,21,169,170,171],"youtube transcript skills","gemini","search","api","Video","browse","api-integration","free","card","channels",{"skillNo":173,"name":174,"nameZh":6,"description":175,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":176,"categories":177,"keywords":182,"publishedAt":38},"01M6Q0EAB96PX83W5PTE8A0R8D","youtube-notetaker","Turn YouTube talks into local study notes with slides, transcripts, editable annotations, and a markdown-backed viewer.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-notetaker\u002FSKILL.md",[178,181],{"categoryNo":179,"categoryName":180,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":154,"categoryName":155,"taxonomyType":81,"taxonomyTypeDesc":82},[128,183,184,106,129,185,186,187,188,133,166,189,190,191,192,21,193,139,194,195],"youtube notetaker","notetaker","workflow","official","notes","code","markdown","slides","annotations","README","study","dair-academy","viewer",{"skillNo":197,"name":198,"nameZh":6,"description":199,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":200,"categories":201,"keywords":203,"publishedAt":38},"01M6Q0E55F0GW5MX48V8HXS8B5","youtube-full","Fetch YouTube transcripts, search videos, browse channels, and extract playlists via TranscriptAPI — no yt-dlp, no Google API key, works from any cloud server.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-full\u002FSKILL.md",[202],{"categoryNo":151,"categoryName":152,"taxonomyType":81,"taxonomyTypeDesc":82},[204,128,205,206,129,163,164,207,208,165,166,167,136,209,168,30,21,169,210,142],"youtube full","full","google","server","dlp","credits","automatic"]