s3-upload-handler
Handle S3 file uploads including UI components, client-side logic, and server-side processing
Best use case
s3-upload-handler is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Handle S3 file uploads including UI components, client-side logic, and server-side processing
Handle S3 file uploads including UI components, client-side logic, and server-side processing
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "s3-upload-handler" skill to help with this workflow task. Context: Handle S3 file uploads including UI components, client-side logic, and server-side processing
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/s3-upload-handler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How s3-upload-handler Compares
| Feature / Agent | s3-upload-handler | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Handle S3 file uploads including UI components, client-side logic, and server-side processing
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# S3 Upload Handler Skill
This skill provides methods to handle file uploads to AWS S3 using pre-built UI components, custom client-side logic, or server-side processing.
## Capabilities
1. **UI Component**: Ready-to-use `S3Uploader` for drag-and-drop or button uploads.
2. **Client SDK**: `ClientS3Uploader` class for custom upload interfaces.
3. **Server Utilities**: `uploadFromServer` for backend file processing and uploading.
## Usage Patterns
### 1. Standard UI Component (Recommended)
Use the `S3Uploader` component for most user-facing upload needs.
```tsx
import { S3Uploader } from "@/components/ui/s3-uploader/s3-uploader";
// Usage in a form or page
<S3Uploader
presignedRouteProvider="/api/app/your-upload-route" // API route to get signed URL
variant="dropzone" // or "button"
maxFiles={5}
accept="image/*" // or specific extensions like ".pdf,.doc"
onUpload={async (fileUrls) => {
console.log("Files uploaded:", fileUrls);
// Handle success (e.g., update form state)
}}
/>
```
### 2. Custom Client-Side Upload
Use `ClientS3Uploader` when you need full control over the UI (e.g., hidden inputs, custom buttons).
```tsx
import { ClientS3Uploader } from "@/lib/s3/clientS3Uploader";
// Initialize
const uploader = new ClientS3Uploader({
presignedRouteProvider: "/api/app/your-upload-route"
});
// Upload a file
const url = await uploader.uploadFile(fileObject);
```
### 3. Server-Side Upload
Use `uploadFromServer` in API routes or Server Actions for processing files (resizing, generating PDFs) before storage.
```typescript
import uploadFromServer from "@/lib/s3/uploadFromServer";
// In a server context (API route/Action)
const url = await uploadFromServer({
file: base64String, // File content as base64
path: "uploads/users/avatar.jpg", // Destination path in bucket
contentType: "image/jpeg" // MIME type
});
```
## Environment Configuration
Ensure `.env.local` has the necessary AWS credentials:
```env
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"
AWS_REGION="us-east-1"
AWS_S3_BUCKET_NAME="your-bucket-name"
```
## API Route Example (for Presigned URLs)
You typically need an API route to generate presigned URLs for the client uploader.
```typescript
// src/app/api/app/upload-input-images/route.ts
import { createPresignedPost } from "@aws-sdk/s3-presigned-post";
import { S3Client } from "@aws-sdk/client-s3";
import { v4 as uuidv4 } from "uuid";
export async function POST(request: Request) {
const { fileName, fileType } = await request.json();
const client = new S3Client({ region: process.env.AWS_REGION });
const { url, fields } = await createPresignedPost(client, {
Bucket: process.env.AWS_S3_BUCKET_NAME!,
Key: `uploads/${uuidv4()}-${fileName}`,
Conditions: [
["content-length-range", 0, 10485760], // up to 10 MB
["starts-with", "$Content-Type", fileType],
],
Fields: {
acl: "public-read",
"Content-Type": fileType,
},
Expires: 600, // Seconds before the presigned post expires. 3600 by default.
});
return Response.json({ url, fields });
}
```
Refer to [reference.md](reference.md) for more details.Related Skills
file-uploads
Expert at handling file uploads and cloud storage. Covers S3, Cloudflare R2, presigned URLs, multipart uploads, and image optimization. Knows how to handle large files without blocking. Use when: file upload, S3, R2, presigned URL, multipart.
gws-drive-upload
Google Drive: Upload a file with automatic metadata.
error-handler-advisor
Proactively reviews error handling patterns and suggests improvements using Result types, proper error propagation, and idiomatic patterns. Activates when users write error handling code or use unwrap/expect.
ui-handler
Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.
theme-handler
Manage and update application themes using shadcn and tweakcn.
stripe-handler
Handle Stripe payments, custom checkouts, and webhook fulfillment outside of standard plans/credits.
seo-handler
Manage SEO, sitemaps, and metadata for optimal search engine visibility
replicate-handler
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
plate-handler
Implement rich text editors using Plate.js. Supports creating both simple (comment/chat) and detailed (document/blog) editors.
plans-handler
Manage subscription plans, pricing, and quotas. Use when adding plan features, updating limits, or building pricing pages.
inngest-handler
Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
env-handler
Manage environment variables securely. Handles distinction between .env (template) and .env.local (secrets).