gcs-file-storage-patternslisted
Install: claude install-skill ajyadav013/claude-kit
Standardize Google Cloud Storage file operations following production service patterns for uploads, downloads, signed URLs, and tabular data reads.
## When to use
- Implementing file upload endpoints (single or bulk) for user-generated content
- Generating time-limited signed URLs for secure file downloads
- Reading CSV or Excel files from GCS buckets for data processing
- Building a file storage utility layer for a FastAPI or Flask service
- Migrating local file storage to cloud object storage
- Implementing a CDN-backed asset serving pattern with GCS
- Parsing gs:// URIs to extract bucket and blob path components
- Setting up credential refresh for long-running services
- Uploading configuration files (YAML, JSON) to GCS for centralized config storage
- Implementing base64-encoded image upload from client applications
## Core conventions
1. **Storage client initialization with credential refresh**: initialize `storage.Client(credentials=_auth())` where `_auth()` calls `google.auth.default()` and refreshes credentials if expired using `credentials.refresh(google.auth.transport.requests.Request())`. For realm-scoped services, pass `credentials` and `project_id` from `auth.default(scopes=SCOPES)` in `__init__`.
2. **Single file upload**: `bucket.blob(blob_path).upload_from_file(file.file)` for file objects (e.g., FastAPI `UploadFile`), or `blob.upload_from_string(data=file_content, content_type=content_type)` for in-memory data. For base64-encoded uploads, decode first: `