Marketplace

handler-storage-r2

Cloudflare R2 storage handler for fractary-file plugin

model: claude-haiku-4-5

$ Instalar

git clone https://github.com/fractary/claude-plugins /tmp/claude-plugins && cp -r /tmp/claude-plugins/plugins/file/skills/handler-storage-r2 ~/.claude/skills/claude-plugins

// tip: Run this command in your terminal to install the skill


name: handler-storage-r2 description: Cloudflare R2 storage handler for fractary-file plugin model: claude-haiku-4-5

<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>
{
  "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.

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
{
  "success": true,
  "message": "Operation completed successfully",
  "url": "https://pub-xxxxx.r2.dev/path/to/file",
  "size_bytes": 1024,
  "checksum": "sha256:abc123..."
}

Public File Upload:

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

Presigned URL:

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

<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>