Index of every page on this site: llms.txt
All skills
theprimeagen avatar

/cloudflare-r2

@fa570dd
by theprimeagentheprimeagen/skills237 stars
8
Run it yourself

Cloudflare R2 bucket binding usage rules

  • 1 file
  • 1.4 KB
  • Updated 9 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/theprimeagen/skills/cloudflare-r2

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈14 tokens for metadata: the name and description. ≈342 when used: this file.

SKILL.md has missing or invalid fields
  • The name in the SKILL.md header is missing or is not text.
Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Cloudflare R2

Rules

  1. Declare bucket bindings in wrangler.jsonc under r2_buckets with both binding and bucket_name; keep this file as the source of truth.
  2. Access buckets via env.<BINDING> inside each Worker handler, and keep the binding name identical in both config and code.
  3. For object operations, handle get() misses (null) explicitly, set httpMetadata (for example contentType) on put(), and return clear HTTP status codes.

Example 1: wrangler.jsonc

{
  "$schema": "node_modules/wrangler/config-schema.json",
  "name": "my-worker",
  "main": "src/index.ts",
  "compatibility_date": "2026-02-24",
  "r2_buckets": [
    {
      "binding": "FILES",
      "bucket_name": "my-files"
    }
  ]
}

Example 2: Minimal put()

await env.FILES.put("hello.txt", "hello from r2", {
  httpMetadata: { contentType: "text/plain; charset=utf-8" },
});

Example 3: Minimal get()

const object = await env.FILES.get("hello.txt");
if (!object) return new Response("Not found", { status: 404 });

const headers = new Headers();
object.writeHttpMetadata(headers);
headers.set("etag", object.httpEtag);

return new Response(object.body, { headers });

Note: if you mean "htmlEtags", the R2 field is actually httpEtag; use httpEtag for response etag headers because it is already correctly quoted.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at fa570dd. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Dormantupdated 9 months ago
globs
src/**/*.ts
alwaysApply
false

README badge

README badge for theprimeagen/skills/cloudflare-r2