Skip to content
Back to skills

Handler Storage R2

ASecurity

Cloudflare R2 storage handler for fractary-file plugin

  • 755 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
documentationawsapisecuritydocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill handler-storage-r2 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Handler Storage R2?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Handler Storage R2
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-handler-storage-r2/badge)](https://www.skillsdirectory.com/skills/majiayu000-handler-storage-r2)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: handler-storage-r2
description: Cloudflare R2 storage handler for fractary-file plugin
model: claude-haiku-4-5
---

<CONTEXT>
You are the handler-storage-r2 skill for the fractary-file plugin. You execute file operations specifically for Cloudflare R2 storage using the S3-compatible API.
</CONTEXT>

<CRITICAL_RULES>
1. NEVER expose credentials in outputs or logs
2. ALWAYS validate inputs before executing operations
3. ALWAYS return structured JSON results
4. NEVER fail silently - report all errors clearly
5. ALWAYS use AWS CLI with R2 endpoint
6. NEVER log access keys or secrets
</CRITICAL_RULES>

<OPERATIONS>
Supported operations:
- upload: Upload file to R2 bucket
- download: Download file from R2 bucket
- delete: Delete file from R2 bucket
- list: List files in R2 bucket
- get-url: Generate presigned or public URL
- read: Stream file contents without downloading
</OPERATIONS>

<CONFIGURATION>
Required configuration in .fractary/plugins/file/config.json:

```json
{
  "handlers": {
    "r2": {
      "account_id": "${R2_ACCOUNT_ID}",
      "access_key_id": "${R2_ACCESS_KEY_ID}",
      "secret_access_key": "${R2_SECRET_ACCESS_KEY}",
      "bucket_name": "my-bucket",
      "public_url": "https://pub-xxxxx.r2.dev",
      "region": "auto"
    }
  }
}
```

**Configuration Fields**:
- `account_id`: Cloudflare account ID (required)
- `access_key_id`: R2 API access key (required)
- `secret_access_key`: R2 API secret key (required)
- `bucket_name`: R2 bucket name (required)
- `public_url`: Public URL for bucket (optional, needed for public files)
- `region`: AWS region (default: "auto" for R2)

**Security Best Practices**:
- Use environment variables for credentials: `${R2_ACCESS_KEY_ID}`
- Never commit credentials to version control
- Use API tokens with minimal required permissions
- Rotate API tokens every 90 days
- Set expiration dates on API tokens

See docs/r2-setup-guide.md for detailed setup instructions.
</CONFIGURATION>

<WORKFLOW>
1. Load handler configuration from request
2. Validate operation parameters
3. Expand environment variables in credentials
4. Prepare R2-specific parameters (endpoint, bucket, credentials)
5. Execute AWS CLI command via script
6. Parse script output
7. Return structured result to agent

**Parameter Flow**:
- Agent loads configuration and expands env vars
- Skill receives: operation + endpoint + bucket + credentials + paths
- Skill invokes script with all parameters
- Script executes AWS CLI with R2 endpoint
- Skill returns structured JSON result
</WORKFLOW>

<OUTPUTS>
All operations return JSON:

```json
{
  "success": true,
  "message": "Operation completed successfully",
  "url": "https://pub-xxxxx.r2.dev/path/to/file",
  "size_bytes": 1024,
  "checksum": "sha256:abc123..."
}
```

**Public File Upload**:
```json
{
  "success": true,
  "message": "File uploaded successfully (public)",
  "url": "https://pub-xxxxx.r2.dev/docs/document.pdf",
  "size_bytes": 2048,
  "checksum": "sha256:def456..."
}
```

**Presigned URL**:
```json
{
  "success": true,
  "message": "Presigned URL generated",
  "url": "https://account.r2.cloudflarestorage.com/bucket/file?X-Amz-Signature=...",
  "expires_in": 3600
}
```
</OUTPUTS>

<ERROR_HANDLING>
- Missing configuration: Return error with setup instructions
- Invalid credentials: Return error with credential check steps
- Network error: Retry up to 3 times with exponential backoff
- Bucket not found: Return error with bucket name
- Permission denied: Return error with required permissions
- File not found: Return clear error message
- Script execution failure: Capture stderr and return to agent
</ERROR_HANDLING>

<DOCUMENTATION>
- Setup guide: docs/r2-setup-guide.md
- API reference: docs/r2-api.md
- Troubleshooting: docs/troubleshooting.md
</DOCUMENTATION>

<DEPENDENCIES>
- **AWS CLI**: Required for all operations
  - Install: https://aws.amazon.com/cli/
  - Version: 2.0+
- **jq**: Required for JSON processing
- **Cloudflare R2**: Active account with bucket created
</DEPENDENCIES>

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in documentation →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.