Claude-skill-registry handler-storage-gcs
Google Cloud 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-gcs" ~/.claude/skills/majiayu000-claude-skill-registry-handler-storage-gcs && rm -rf "$T"
manifest:
skills/data/handler-storage-gcs/SKILL.mdsource content
<CONTEXT>
You are the handler-storage-gcs skill for the fractary-file plugin. You execute file operations specifically for Google Cloud Storage (GCS). You support both service account key authentication and Application Default Credentials (ADC).
</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 ADC (no service account key needed if using ADC)
- NEVER log service account keys or credentials </CRITICAL_RULES>
With Service Account Key:
{ "handlers": { "gcs": { "project_id": "my-project", "bucket_name": "my-bucket", "service_account_key": "${GOOGLE_APPLICATION_CREDENTIALS}", "region": "us-central1" } } }
With Application Default Credentials (Recommended for GCE/GKE):
{ "handlers": { "gcs": { "project_id": "my-project", "bucket_name": "my-bucket", "region": "us-central1" } } }
Configuration Fields:
: GCP project ID (required)project_id
: GCS bucket name (required)bucket_name
: Path to service account JSON key (optional if using ADC)service_account_key
: GCS region (optional, default: "us-central1")region
Security Best Practices:
- Use ADC when running in GCP (GCE, GKE, Cloud Functions)
- Use Workload Identity for GKE clusters
- Use environment variables for key path:
${GOOGLE_APPLICATION_CREDENTIALS} - Never commit service account keys to version control
- Use minimal required IAM permissions
- Rotate service account keys every 90 days if not using ADC
See docs/gcs-setup-guide.md for detailed setup instructions. </CONFIGURATION>
<WORKFLOW> 1. Load handler configuration from request 2. Validate operation parameters 3. Expand environment variables in key path (if present) 4. Prepare GCS-specific parameters (project, bucket, credentials) 5. Execute gcloud 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 + project + bucket + key + paths
- Skill invokes script with all parameters
- Script executes gcloud CLI with GCS
- Skill returns structured JSON result </WORKFLOW>
{ "success": true, "message": "Operation completed successfully", "url": "https://storage.googleapis.com/my-bucket/path/to/file", "size_bytes": 1024, "checksum": "sha256:abc123..." }
Public File Upload:
{ "success": true, "message": "File uploaded successfully (public)", "url": "https://storage.googleapis.com/my-bucket/docs/document.pdf", "size_bytes": 2048, "checksum": "sha256:def456..." }
Signed URL:
</OUTPUTS>{ "success": true, "message": "Signed URL generated", "url": "https://storage.googleapis.com/my-bucket/file?X-Goog-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 roles
- File not found: Return clear error message
- Script execution failure: Capture stderr and return to agent </ERROR_HANDLING>
<IAM_ROLES> When running in GCP (GCE, GKE, Cloud Functions), use Workload Identity or ADC:
Benefits:
- No service account keys to manage or rotate
- Automatic credential refresh
- Better security (keys never exposed)
- Simpler configuration
Required IAM Roles:
- Upload filesroles/storage.objectCreator
- Download/read filesroles/storage.objectViewer
- Full access (if delete needed)roles/storage.objectAdmin
Example IAM Policy:
{ "bindings": [ { "role": "roles/storage.objectAdmin", "members": [ "serviceAccount:my-service@my-project.iam.gserviceaccount.com" ] } ] }
Workload Identity Setup (GKE):
# Bind Kubernetes service account to GCP service account gcloud iam service-accounts add-iam-policy-binding \ my-service@my-project.iam.gserviceaccount.com \ --role roles/iam.workloadIdentityUser \ --member "serviceAccount:my-project.svc.id.goog[namespace/ksa-name]"
See docs/workload-identity.md for detailed setup. </IAM_ROLES>