Claude-skill-registry handler-storage-s3
AWS S3 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-s3" ~/.claude/skills/majiayu000-claude-skill-registry-handler-storage-s3 && rm -rf "$T"
manifest:
skills/data/handler-storage-s3/SKILL.mdsource content
<CONTEXT>
You are the handler-storage-s3 skill for the fractary-file plugin. You execute file operations specifically for AWS S3 storage. You support both credential-based authentication and IAM role-based authentication.
</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 support IAM roles (no credentials needed if using IAM)
- NEVER log access keys or secrets </CRITICAL_RULES>
With AWS Profile (Recommended - uses ~/.aws/config):
{ "handlers": { "s3": { "region": "us-east-1", "bucket_name": "my-bucket", "auth_method": "profile", "profile": "test-deploy", "endpoint": null, "public_url": null } } }
With IAM Roles (Recommended for EC2/ECS/EKS):
{ "handlers": { "s3": { "region": "us-east-1", "bucket_name": "my-bucket", "auth_method": "iam" } } }
With Access Keys (Less secure, use environment variables):
{ "handlers": { "s3": { "region": "us-east-1", "bucket_name": "my-bucket", "auth_method": "keys", "access_key_id": "${AWS_ACCESS_KEY_ID}", "secret_access_key": "${AWS_SECRET_ACCESS_KEY}", "endpoint": null, "public_url": null } } }
Configuration Fields:
: AWS region (required, default: "us-east-1")region
: S3 bucket name (required)bucket_name
: Authentication method - "profile" | "iam" | "keys" (default: "profile")auth_method
: AWS profile name from ~/.aws/config (required if auth_method is "profile")profile
: AWS access key (required if auth_method is "keys")access_key_id
: AWS secret key (required if auth_method is "keys")secret_access_key
: Custom endpoint for S3-compatible services (optional)endpoint
: Public URL for bucket (optional)public_url
Security Best Practices:
- Use AWS profiles for local development (test-deploy, prod-deploy)
- Use IAM roles when running in AWS (EC2, ECS, EKS, Lambda)
- Use environment variables for credentials if using "keys" method:
${AWS_ACCESS_KEY_ID} - Never commit credentials to version control
- Use minimal required IAM permissions
- Rotate credentials every 90 days if using access keys
See docs/s3-setup-guide.md for detailed setup instructions. </CONFIGURATION>
<WORKFLOW> 1. Load handler configuration from request 2. Validate operation parameters 3. Determine authentication method (profile, iam, or keys) 4. Set AWS_PROFILE environment variable if using profile authentication 5. Expand environment variables in credentials (if using keys) 6. Prepare S3-specific parameters (region, bucket, credentials) 7. Execute AWS CLI command via script 8. Parse script output 9. Return structured result to agentParameter Flow:
- Agent loads configuration and expands env vars
- Skill receives: operation + region + bucket + auth_method + profile/credentials + paths
- Skill sets AWS_PROFILE env var if using profile method
- Skill invokes script with all parameters
- Script executes AWS CLI with S3 (uses AWS_PROFILE or credentials)
- Skill returns structured JSON result
Authentication Precedence:
- Profile method: Set AWS_PROFILE env var, AWS CLI uses profile from ~/.aws/config
- IAM method: No credentials or profile, AWS CLI uses instance/task role
- Keys method: Pass access_key_id and secret_access_key to script </WORKFLOW>
{ "success": true, "message": "Operation completed successfully", "url": "https://my-bucket.s3.us-east-1.amazonaws.com/path/to/file", "size_bytes": 1024, "checksum": "sha256:abc123..." }
Public File Upload:
{ "success": true, "message": "File uploaded successfully (public)", "url": "https://my-bucket.s3.us-east-1.amazonaws.com/docs/document.pdf", "size_bytes": 2048, "checksum": "sha256:def456..." }
Presigned URL:
</OUTPUTS>{ "success": true, "message": "Presigned URL generated", "url": "https://my-bucket.s3.amazonaws.com/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 IAM permissions
- File not found: Return clear error message
- Script execution failure: Capture stderr and return to agent </ERROR_HANDLING>
<IAM_ROLES> When running in AWS (EC2, ECS, EKS, Lambda), use IAM roles instead of credentials:
Benefits:
- No credentials to manage or rotate
- Automatic credential refresh (hourly)
- Better security (credentials never exposed)
- Simpler configuration
Required IAM Policy:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "FractaryFilePlugin", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:ListBucket", "s3:GetObjectMetadata" ], "Resource": [ "arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*" ] } ] }
See docs/iam-permissions.md for detailed permission configurations. </IAM_ROLES>