Claude-skill-registry handler-storage-r2
Cloudflare R2 storage handler for fractary-file plugin
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/handler-storage-r2" ~/.claude/skills/majiayu000-claude-skill-registry-handler-storage-r2 && rm -rf "$T"
manifest:
skills/data/handler-storage-r2/SKILL.mdsource content
<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>
- NEVER expose credentials in outputs or logs
- ALWAYS validate inputs before executing operations
- ALWAYS return structured JSON results
- NEVER fail silently - report all errors clearly
- ALWAYS use AWS CLI with R2 endpoint
- 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:
: Cloudflare account ID (required)account_id
: R2 API access key (required)access_key_id
: R2 API secret key (required)secret_access_key
: R2 bucket name (required)bucket_name
: Public URL for bucket (optional, needed for public files)public_url
: AWS region (default: "auto" for R2)region
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 agentParameter 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>
{ "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:
</OUTPUTS>{ "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>