From product-builder
Adds Cloudflare R2 file storage to an existing Product Builder project using Wrangler bindings, a Drizzle file metadata table, and React Router server context. Use when the user asks to add uploads, file storage, R2 buckets, object storage, file metadata, or file management to an existing Cloudflare Workers React Router project.
How this skill is triggered — by the user, by Claude, or both
Slash command
/product-builder:adding-file-storageThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Work in the target project repository. If the project path is unclear, ask for only the path before changing files.
Work in the target project repository. If the project path is unclear, ask for only the path before changing files.
Derive these values from the project or user prompt when possible:
PROJECT_PATH: <absolute path>
R2_BUCKET_NAME: <project-name>-files
R2_BINDING: APP_FILES
D1_BINDING: APP_DB
Use APP_FILES as the default R2 binding and APP_DB as the default D1 binding unless the existing project already uses different binding names.
pnpm for Wrangler, package, and project scripts.react-router-patterns before changing React Router context, Worker request handling, route modules, loaders, actions, upload forms, or resource routes. Any React Router code must follow those patterns.adding-database skill first.files table.wrangler.jsonc settings and merge R2 configuration into it.wrangler r2 bucket create are region-specific. The bucket name must be globally unique across all Cloudflare accounts — a "bucket already exists" error usually means the name is taken, not that the bucket was already created in this account.wrangler.jsonc use r2_buckets (plural), not r2_bucket. Using the singular form silently ignores the binding.env.APP_FILES.put() accepts a ReadableStream, ArrayBuffer, or string — not a File or Blob directly. Extract the body from the uploaded file before calling put().react-router-patterns, then wire the service into app context and the Worker using 03-app-integration.md.Cloudflare R2 (file storage).files entity with columns, types, and relationships matching app/db/schema.ts.wrangler.jsonc includes an R2 binding for APP_FILES.app/db/schema.ts exports a files table and includes it in schema.files metadata table.app/services/file.service.ts uploads to R2 before inserting metadata.app/context.ts exposes files: FilesService.workers/app.ts constructs new FilesService(db, env.APP_FILES).data-access-architecture.md was followed for file metadata service boundaries and any DAO or data access workflow changes.react-router-patterns was loaded and followed for any React Router context, Worker request-handling, route, upload, or resource endpoint changes.Env types include APP_FILES.docs/architecture.md includes Cloudflare R2 in the Stack section.docs/data-model.md includes the files entity matching app/db/schema.ts.README.md and AGENTS.md document file storage setup and behavior, and AGENTS.md references docs/.npx claudepluginhub adrianhdezm/mystack --plugin product-builderProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.