cloudflare-r2:presigned-url

cloudflare-r2:presigned-url is a command for Claude Code from secondsky/claude-skills. It costs 20 tokens per session (854 once invoked), scanned A, original, MIT.

A tool for creating temporary signed links that let clients upload or download R2 files without receiving storage credentials.

In plain words
What is it for?
It generates signed upload or download URLs, supports custom headers, and provides curl and client-side examples.
Why use it?
It limits direct access to a particular file operation for a chosen amount of time.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cloudflare-r2 plugin — 1 skill, 4 commands, 5 agents shipped together

Good fit It generates signed upload or download URLs, supports custom headers, and provides curl and client-side examples.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/secondsky/claude-skills/r2-presigned-url
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code.

Or install cloudflare-r2, the plugin that ships this one along with the rest of its 1 skill, 4 commands, 5 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cloudflare-r2:presigned-url

README.md
[![agentmods](https://agentmods.dev/badge/commands/secondsky/claude-skills/r2-presigned-url/github.svg)](https://agentmods.dev/commands/secondsky/claude-skills/r2-presigned-url)
Your own site
<a href="https://agentmods.dev/commands/secondsky/claude-skills/r2-presigned-url"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/r2-presigned-url/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cloudflare-r2:presigned-url

Your own site · 80×15
<a href="https://agentmods.dev/commands/secondsky/claude-skills/r2-presigned-url"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/r2-presigned-url.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 854 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00854
Opus 5 $0.00010 $0.00427
Sonnet 5 $0.00004 $0.00171
Haiku 4.5 $0.00002 $0.00085

Measured 5d ago against content hash 6ee392c66b71, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

cloudflare-r2:presigned-url scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

3. **Provides curl test command** for verification
plugins/cloudflare-r2/commands/r2-presigned-url.md · 127 lines

How it starts

The opening of the file, as written. The whole thing — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.

R2 Presigned URL Generator

Generate time-limited, signed URLs for secure client-side uploads or downloads without exposing R2 credentials.

Required Information

  1. Operation type: {{operation}} (upload or download)
  2. Object key (file path in bucket): {{key}}
  3. Expiry (seconds, max 604800 = 7 days): {{expiry}}
  4. Custom headers (optional, e.g., Content-Type): {{headers}}

What This Command Does

  1. Generates AWS v4 signed URL using aws4fetch library
  2. Sets expiration time (1 hour to 7 days)
  3. Provides curl test command for verification
  4. Explains security considerations
  5. Shows client-side usage example

Implementation

import { AwsClient } from 'aws4fetch';

// Configure AWS client for R2
const r2Client = new AwsClient({
  accessKeyId: env.R2_ACCESS_KEY_ID,
  secretAccessKey: env.R2_SECRET_ACCESS_KEY,
});

// Generate presigned URL for upload
async function generateUploadURL(
  bucket: string,
  key: string,
  expirySeconds: number
) {
  const url = new URL(
    `https://${bucket}.${env.ACCOUNT_ID}.r2.cloudflarestorage.com/${key}`
  );

  url.searchParams.set('X-Amz-Expires', expirySeconds.toString());

  const signed = await r2Client.sign(
    new Request(url, { method: 'PUT' }),
    { aws: { signQuery: true } }
  );

  return signed.url;
}

// Generate presigned URL for download
async function generateDownloadURL(
  bucket: string,
  key: string,
  expirySeconds: number
) {
  const url = new URL(
    `https://${bucket}.${env.ACCOUNT_ID}.r2.cloudflarestorage.com/${key}`
  );

  url.searchParams.set('X-Amz-Expires', expirySeconds.toString());

  const signed = await r2Client.sign(
    new Request(url, { method: 'GET' }),
    { aws: { signQuery: true } }
  );

  return signed.url;
}

Example Usage

// Generate upload URL (valid for 1 hour)
const uploadURL = await generateUploadURL('my-bucket', 'user/file.pdf', 3600);

// Client-side upload
fetch(uploadURL, {
  method: 'PUT',
  body: fileData,
  headers: {
    'Content-Type': 'application/pdf',
  },
});

// Generate download URL (valid for 24 hours)
const downloadURL = await generateDownloadURL('my-bucket', 'user/file.pdf', 86400);

// Provide URL to user
return c.json({ downloadURL });

Read the full file on GitHub · 127 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 127 lines · 20 tokens per session scan A 6ee392c66b71

Subscribe to this mod's changes

cloudflare-r2:presigned-url is a command published in the GitHub repository secondsky/claude-skills (216 stars, last pushed yesterday), licensed MIT. It adds 20 tokens to every session and 854 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.