vibes-plug 1.0.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/.github/workflows/publish.yml +20 -0
  2. package/AGENTS.md +66 -0
  3. package/BLUEPRINT.md +152 -60
  4. package/CHANGELOG.md +50 -0
  5. package/README.md +346 -194
  6. package/package.json +25 -25
  7. package/plugin.json +1 -1
  8. package/skills/ai-cost-token-optimizer/SKILL.md +52 -0
  9. package/skills/ai-llm-integration-expert/SKILL.md +180 -162
  10. package/skills/api-design-expert/SKILL.md +314 -310
  11. package/skills/app-analyzer-optimizer/SKILL.md +193 -189
  12. package/skills/apple-ecosystem-expert/SKILL.md +142 -0
  13. package/skills/async-queue-temporal-expert/SKILL.md +54 -0
  14. package/skills/authentication-identity-expert/SKILL.md +251 -20
  15. package/skills/auto-doc-updater/SKILL.md +214 -204
  16. package/skills/autonomous-chaos-monkey/SKILL.md +63 -0
  17. package/skills/autonomous-red-teamer/SKILL.md +59 -0
  18. package/skills/autonomous-swarm-director/SKILL.md +69 -0
  19. package/skills/autonomous-tdd-debugger/SKILL.md +65 -0
  20. package/skills/bootstrap-to-modern/SKILL.md +90 -86
  21. package/skills/brainstorming/SKILL.md +373 -353
  22. package/skills/browser-automation-expert/SKILL.md +46 -0
  23. package/skills/ci-cd-devops-architect/SKILL.md +72 -45
  24. package/skills/cloud-hosting-expert/SKILL.md +244 -244
  25. package/skills/coderabbit/SKILL.md +192 -192
  26. package/skills/cron-scheduler-expert/SKILL.md +298 -0
  27. package/skills/data-telemetry-expert/SKILL.md +213 -213
  28. package/skills/database-orm-expert/SKILL.md +294 -294
  29. package/skills/dependency-upgrade-migrator/SKILL.md +295 -0
  30. package/skills/design-system-architect/SKILL.md +27 -10
  31. package/skills/doku-mcp-server/SKILL.md +251 -0
  32. package/skills/doku-payment-gateway/SKILL.md +227 -0
  33. package/skills/e2e-testing-expert/SKILL.md +315 -315
  34. package/skills/edge-serverless-db-expert/SKILL.md +43 -0
  35. package/skills/email-notification-expert/SKILL.md +362 -0
  36. package/skills/error-resilience-expert/SKILL.md +480 -0
  37. package/skills/event-driven-architect/SKILL.md +81 -81
  38. package/skills/feature-flag-analytics-expert/SKILL.md +46 -0
  39. package/skills/file-upload-media-expert/SKILL.md +431 -0
  40. package/skills/form-validation-expert/SKILL.md +401 -0
  41. package/skills/fullstack-expert/SKILL.md +202 -202
  42. package/skills/fullstack-expert/references/api_design_guide.md +466 -466
  43. package/skills/fullstack-expert/references/multi_language_backend.md +528 -528
  44. package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -253
  45. package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -326
  46. package/skills/gemini-agent-booster/SKILL.md +135 -135
  47. package/skills/global-a11y-i18n-expert/SKILL.md +81 -81
  48. package/skills/glsl-shader-expert/SKILL.md +101 -0
  49. package/skills/go-programming-expert/SKILL.md +295 -295
  50. package/skills/graphql-apollo-expert/SKILL.md +108 -0
  51. package/skills/hig/SKILL.md +188 -188
  52. package/skills/hyper-context-synthesizer/SKILL.md +55 -0
  53. package/skills/js-backend-expert/SKILL.md +34 -9
  54. package/skills/legacy-code-translator/SKILL.md +65 -0
  55. package/skills/llm-cost-arbitrage-router/SKILL.md +59 -0
  56. package/skills/logging-error-tracking-expert/SKILL.md +338 -0
  57. package/skills/mcp-client-orchestrator/SKILL.md +70 -0
  58. package/skills/mcp-server-architect/SKILL.md +194 -194
  59. package/skills/micro-frontend-architect/SKILL.md +106 -0
  60. package/skills/mobile-expo-expert/SKILL.md +186 -186
  61. package/skills/mobile-push-notification-expert/SKILL.md +51 -0
  62. package/skills/monday-design-aesthetic/SKILL.md +67 -67
  63. package/skills/monorepo-architect/SKILL.md +227 -227
  64. package/skills/mpa-orchestrator/SKILL.md +101 -101
  65. package/skills/multi-agent-orchestration/SKILL.md +234 -234
  66. package/skills/multiple-entry-points/SKILL.md +55 -55
  67. package/skills/mvc-expert/SKILL.md +231 -231
  68. package/skills/payment-gateway-expert/SKILL.md +45 -45
  69. package/skills/performance-web-vitals/SKILL.md +332 -332
  70. package/skills/post-quantum-crypto-migrator/SKILL.md +57 -0
  71. package/skills/prd-architect/SKILL.md +201 -191
  72. package/skills/proactive-background-watcher/SKILL.md +62 -0
  73. package/skills/production-ready-hardener/PRODUCTION_READINESS_REPORT.md +67 -0
  74. package/skills/production-ready-hardener/SKILL.md +173 -186
  75. package/skills/production-ready-hardener/references/production_checklist.md +161 -161
  76. package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +881 -875
  77. package/skills/project-context-mapper/SKILL.md +79 -0
  78. package/skills/python-programming-expert/SKILL.md +263 -132
  79. package/skills/rate-limit-abuse-prevention/SKILL.md +371 -0
  80. package/skills/realtime-collaboration-expert/SKILL.md +45 -45
  81. package/skills/rust-programming-expert/SKILL.md +235 -235
  82. package/skills/saas-billing/SKILL.md +377 -377
  83. package/skills/saas-multi-tenant/SKILL.md +251 -237
  84. package/skills/saas-mvp-launcher/SKILL.md +10 -0
  85. package/skills/saas-transformer/SKILL.md +187 -144
  86. package/skills/saas-transformer/references/billing_integration_guide.md +401 -401
  87. package/skills/saas-transformer/references/feature_gating_patterns.md +137 -137
  88. package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -121
  89. package/skills/saas-transformer/scripts/saas_transformation_scanner.py +39 -29
  90. package/skills/scalability-clean-code/SKILL.md +229 -229
  91. package/skills/self-evolving-memory-graph/SKILL.md +75 -0
  92. package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -0
  93. package/skills/senior-frontend/SKILL.md +161 -161
  94. package/skills/senior-fullstack/SKILL.md +167 -167
  95. package/skills/seo/SKILL.md +235 -225
  96. package/skills/seo-geo/SKILL.md +188 -188
  97. package/skills/session-context-loader/SKILL.md +77 -0
  98. package/skills/session-handoff-resume/SKILL.md +158 -158
  99. package/skills/skill_baru/SKILL.md +172 -147
  100. package/skills/spa-orchestrator/SKILL.md +288 -288
  101. package/skills/state-management-expert/SKILL.md +272 -272
  102. package/skills/supabase-security-expert/SKILL.md +243 -243
  103. package/skills/tailwind-expert/SKILL.md +188 -188
  104. package/skills/tanstack-query-expert/SKILL.md +199 -199
  105. package/skills/token-saver/SKILL.md +119 -111
  106. package/skills/typescript-expert/SKILL.md +324 -279
  107. package/skills/ui-components-expert/SKILL.md +263 -46
  108. package/skills/ui-ux-pro-max/SKILL.md +202 -201
  109. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  110. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  111. package/skills/ui_ux_expert/SKILL.md +17 -6
  112. package/skills/vector-db-rag-expert/SKILL.md +52 -0
  113. package/skills/vibe-code-gardener/SKILL.md +181 -173
  114. package/skills/visual-qa-vision-agent/SKILL.md +65 -0
  115. package/skills/vue-frontend-expert/SKILL.md +126 -0
  116. package/skills/web-3d-graphics-expert/SKILL.md +131 -0
  117. package/skills/web-game-engine-expert/SKILL.md +96 -0
  118. package/skills/web-scraper/SKILL.md +207 -205
  119. package/skills/website-design-cloner/SKILL.md +174 -0
  120. package/skills/webxr-ar-vr-expert/SKILL.md +117 -0
  121. package/skills/zero-to-prod-orchestrator/SKILL.md +206 -180
  122. package/skills/zero-trust-secret-vault/SKILL.md +40 -0
  123. package/vibes-swarm-demo.gif +0 -0
@@ -0,0 +1,431 @@
1
+ ---
2
+ name: file-upload-media-expert
3
+ description: "Expert guide for file uploads (S3, R2, Supabase Storage), presigned URLs, image/video processing, CDN optimization, and media pipeline architecture / Panduan ahli untuk upload file (S3, R2, Supabase Storage), presigned URL, pemrosesan gambar/video, optimasi CDN, dan arsitektur pipeline media."
4
+ author: "Roedy Rustam"
5
+ ---
6
+
7
+ # File Upload & Media Expert (2026 Edition)
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Description
17
+ Production-grade guide for building secure, performant file upload systems and media processing pipelines. Covers **presigned URL upload patterns** (S3, R2, Supabase Storage), **multipart uploads** with progress tracking, **image optimization** (Sharp, Cloudflare Images, Vercel OG), **video transcoding** (Mux, Cloudflare Stream), **PDF generation**, **file validation & virus scanning**, **CDN configuration**, and **drag-and-drop UI components**.
18
+
19
+ ### Trigger Conditions
20
+ Activate this skill when:
21
+ - Implementing file upload functionality (images, documents, videos).
22
+ - Setting up cloud storage (AWS S3, Cloudflare R2, Supabase Storage, UploadThing).
23
+ - Building image processing pipelines (resize, crop, watermark, format conversion).
24
+ - Implementing drag-and-drop file upload UI components.
25
+ - Configuring CDN for static assets and media delivery.
26
+ - Generating PDFs or processing documents server-side.
27
+ - Building avatar/profile picture upload functionality.
28
+
29
+ ---
30
+
31
+ ### Storage Provider Selection Guide
32
+
33
+ | Provider | Best For | Key Strength | Egress Cost |
34
+ |---|---|---|---|
35
+ | **Cloudflare R2** | Cost-sensitive, global | Zero egress fees, S3-compatible | **$0** |
36
+ | **AWS S3** | Enterprise, AWS ecosystem | Most mature, rich feature set | $0.09/GB |
37
+ | **Supabase Storage** | Supabase-powered apps | RLS integration, built-in transforms | Included in plan |
38
+ | **UploadThing** | Quick prototyping | React components, zero config | Included in plan |
39
+ | **Vercel Blob** | Vercel-hosted apps | Seamless Vercel integration | Included in plan |
40
+
41
+ **Recommendation**: Use **Cloudflare R2** for most production apps (zero egress, S3-compatible). Use **Supabase Storage** if already on Supabase. Use **UploadThing** for rapid prototyping.
42
+
43
+ ---
44
+
45
+ ### 1. Presigned URL Upload Pattern (Server → Client → Storage)
46
+
47
+ ```
48
+ ┌──────────┐ 1. Request URL ┌──────────┐
49
+ │ Client │ ──────────────────────► │ Server │
50
+ │ (Browser) │ │ (API) │
51
+ │ │ ◄────────────────────── │ │
52
+ │ │ 2. Presigned URL │ │
53
+ │ │ └──────────┘
54
+ │ │ 3. Upload file
55
+ │ │ ──────────────────────► ┌──────────┐
56
+ │ │ │ Storage │
57
+ │ │ ◄────────────────────── │ (S3/R2) │
58
+ └──────────┘ 4. Success response └──────────┘
59
+ ```
60
+
61
+ #### Server: Generate Presigned URL
62
+ ```typescript
63
+ // app/api/upload/route.ts
64
+ import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
65
+ import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
66
+ import { nanoid } from 'nanoid';
67
+
68
+ const s3 = new S3Client({
69
+ region: 'auto',
70
+ endpoint: process.env.R2_ENDPOINT, // Cloudflare R2
71
+ credentials: {
72
+ accessKeyId: process.env.R2_ACCESS_KEY_ID!,
73
+ secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
74
+ },
75
+ });
76
+
77
+ // Allowed file types and max sizes
78
+ const ALLOWED_TYPES: Record<string, { maxSize: number; extensions: string[] }> = {
79
+ image: { maxSize: 10 * 1024 * 1024, extensions: ['jpg', 'jpeg', 'png', 'webp', 'avif'] },
80
+ document: { maxSize: 25 * 1024 * 1024, extensions: ['pdf', 'docx', 'xlsx'] },
81
+ video: { maxSize: 500 * 1024 * 1024, extensions: ['mp4', 'webm', 'mov'] },
82
+ };
83
+
84
+ export async function POST(request: Request) {
85
+ const { filename, contentType, fileSize, category = 'image' } = await request.json();
86
+
87
+ // Validate file type
88
+ const config = ALLOWED_TYPES[category];
89
+ if (!config) return Response.json({ error: 'Invalid category' }, { status: 400 });
90
+
91
+ const ext = filename.split('.').pop()?.toLowerCase();
92
+ if (!ext || !config.extensions.includes(ext)) {
93
+ return Response.json({ error: `Invalid file type. Allowed: ${config.extensions.join(', ')}` }, { status: 400 });
94
+ }
95
+
96
+ // Validate file size
97
+ if (fileSize > config.maxSize) {
98
+ return Response.json({ error: `File too large. Max: ${config.maxSize / 1024 / 1024}MB` }, { status: 400 });
99
+ }
100
+
101
+ // Generate unique key
102
+ const key = `uploads/${category}/${nanoid()}.${ext}`;
103
+
104
+ const command = new PutObjectCommand({
105
+ Bucket: process.env.R2_BUCKET_NAME,
106
+ Key: key,
107
+ ContentType: contentType,
108
+ ContentLength: fileSize,
109
+ });
110
+
111
+ const presignedUrl = await getSignedUrl(s3, command, { expiresIn: 600 }); // 10 min
112
+
113
+ return Response.json({
114
+ presignedUrl,
115
+ key,
116
+ publicUrl: `${process.env.CDN_URL}/${key}`,
117
+ });
118
+ }
119
+ ```
120
+
121
+ #### Client: Upload with Progress
122
+ ```tsx
123
+ // hooks/use-file-upload.ts
124
+ 'use client';
125
+
126
+ import { useState, useCallback } from 'react';
127
+
128
+ interface UploadState {
129
+ progress: number;
130
+ isUploading: boolean;
131
+ error: string | null;
132
+ publicUrl: string | null;
133
+ }
134
+
135
+ export function useFileUpload() {
136
+ const [state, setState] = useState<UploadState>({
137
+ progress: 0, isUploading: false, error: null, publicUrl: null,
138
+ });
139
+
140
+ const upload = useCallback(async (file: File, category = 'image') => {
141
+ setState({ progress: 0, isUploading: true, error: null, publicUrl: null });
142
+
143
+ try {
144
+ // Step 1: Get presigned URL
145
+ const res = await fetch('/api/upload', {
146
+ method: 'POST',
147
+ headers: { 'Content-Type': 'application/json' },
148
+ body: JSON.stringify({
149
+ filename: file.name,
150
+ contentType: file.type,
151
+ fileSize: file.size,
152
+ category,
153
+ }),
154
+ });
155
+
156
+ if (!res.ok) {
157
+ const { error } = await res.json();
158
+ throw new Error(error || 'Failed to get upload URL');
159
+ }
160
+
161
+ const { presignedUrl, publicUrl } = await res.json();
162
+
163
+ // Step 2: Upload to storage with progress
164
+ await new Promise<void>((resolve, reject) => {
165
+ const xhr = new XMLHttpRequest();
166
+ xhr.open('PUT', presignedUrl);
167
+ xhr.setRequestHeader('Content-Type', file.type);
168
+
169
+ xhr.upload.onprogress = (e) => {
170
+ if (e.lengthComputable) {
171
+ setState(prev => ({ ...prev, progress: Math.round((e.loaded / e.total) * 100) }));
172
+ }
173
+ };
174
+
175
+ xhr.onload = () => (xhr.status >= 200 && xhr.status < 300) ? resolve() : reject(new Error(`Upload failed: ${xhr.status}`));
176
+ xhr.onerror = () => reject(new Error('Network error during upload'));
177
+ xhr.send(file);
178
+ });
179
+
180
+ setState({ progress: 100, isUploading: false, error: null, publicUrl });
181
+ return publicUrl;
182
+ } catch (error) {
183
+ const message = error instanceof Error ? error.message : 'Upload failed';
184
+ setState(prev => ({ ...prev, isUploading: false, error: message }));
185
+ throw error;
186
+ }
187
+ }, []);
188
+
189
+ return { ...state, upload };
190
+ }
191
+ ```
192
+
193
+ ---
194
+
195
+ ### 2. Drag-and-Drop Upload Component
196
+
197
+ ```tsx
198
+ // components/file-dropzone.tsx
199
+ 'use client';
200
+
201
+ import { useCallback, useState, useRef, type DragEvent, type ChangeEvent } from 'react';
202
+ import { useFileUpload } from '@/hooks/use-file-upload';
203
+
204
+ interface FileDropzoneProps {
205
+ accept?: string;
206
+ maxSize?: number; // bytes
207
+ onUploadComplete?: (url: string) => void;
208
+ }
209
+
210
+ export function FileDropzone({ accept = 'image/*', maxSize = 10 * 1024 * 1024, onUploadComplete }: FileDropzoneProps) {
211
+ const [isDragOver, setIsDragOver] = useState(false);
212
+ const inputRef = useRef<HTMLInputElement>(null);
213
+ const { progress, isUploading, error, upload } = useFileUpload();
214
+
215
+ const handleFile = useCallback(async (file: File) => {
216
+ if (file.size > maxSize) {
217
+ alert(`File too large. Max size: ${maxSize / 1024 / 1024}MB`);
218
+ return;
219
+ }
220
+ const url = await upload(file);
221
+ if (url) onUploadComplete?.(url);
222
+ }, [maxSize, upload, onUploadComplete]);
223
+
224
+ const onDrop = useCallback((e: DragEvent) => {
225
+ e.preventDefault();
226
+ setIsDragOver(false);
227
+ const file = e.dataTransfer.files[0];
228
+ if (file) handleFile(file);
229
+ }, [handleFile]);
230
+
231
+ const onChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
232
+ const file = e.target.files?.[0];
233
+ if (file) handleFile(file);
234
+ }, [handleFile]);
235
+
236
+ return (
237
+ <div
238
+ className={`dropzone ${isDragOver ? 'dropzone--active' : ''}`}
239
+ onDragOver={(e) => { e.preventDefault(); setIsDragOver(true); }}
240
+ onDragLeave={() => setIsDragOver(false)}
241
+ onDrop={onDrop}
242
+ onClick={() => inputRef.current?.click()}
243
+ role="button"
244
+ tabIndex={0}
245
+ aria-label="Upload file"
246
+ >
247
+ <input ref={inputRef} type="file" accept={accept} onChange={onChange} hidden />
248
+
249
+ {isUploading ? (
250
+ <div className="upload-progress">
251
+ <div className="progress-bar" style={{ width: `${progress}%` }} />
252
+ <span>{progress}%</span>
253
+ </div>
254
+ ) : (
255
+ <p>Drag & drop a file here, or click to browse</p>
256
+ )}
257
+
258
+ {error && <p className="error-text">{error}</p>}
259
+ </div>
260
+ );
261
+ }
262
+ ```
263
+
264
+ ---
265
+
266
+ ### 3. Image Optimization with Sharp
267
+
268
+ ```typescript
269
+ // lib/image-processing.ts
270
+ import sharp from 'sharp';
271
+
272
+ interface ProcessOptions {
273
+ width?: number;
274
+ height?: number;
275
+ quality?: number;
276
+ format?: 'webp' | 'avif' | 'jpeg' | 'png';
277
+ /** Generate multiple sizes for responsive images */
278
+ responsive?: boolean;
279
+ }
280
+
281
+ export async function processImage(buffer: Buffer, options: ProcessOptions = {}) {
282
+ const { width = 1200, height, quality = 80, format = 'webp' } = options;
283
+
284
+ const pipeline = sharp(buffer)
285
+ .resize(width, height, { fit: 'inside', withoutEnlargement: true });
286
+
287
+ switch (format) {
288
+ case 'webp': return pipeline.webp({ quality }).toBuffer();
289
+ case 'avif': return pipeline.avif({ quality }).toBuffer();
290
+ case 'jpeg': return pipeline.jpeg({ quality, mozjpeg: true }).toBuffer();
291
+ case 'png': return pipeline.png({ compressionLevel: 9 }).toBuffer();
292
+ }
293
+ }
294
+
295
+ /** Generate responsive image set */
296
+ export async function generateResponsiveSet(buffer: Buffer) {
297
+ const sizes = [320, 640, 960, 1280, 1920];
298
+ return Promise.all(
299
+ sizes.map(async (w) => ({
300
+ width: w,
301
+ buffer: await processImage(buffer, { width: w, format: 'webp', quality: 80 }),
302
+ key: `w${w}.webp`,
303
+ })),
304
+ );
305
+ }
306
+ ```
307
+
308
+ ---
309
+
310
+ ### 4. Avatar Upload with Crop
311
+
312
+ ```typescript
313
+ // lib/avatar.ts
314
+ import sharp from 'sharp';
315
+
316
+ export async function processAvatar(buffer: Buffer): Promise<Buffer> {
317
+ return sharp(buffer)
318
+ .resize(256, 256, {
319
+ fit: 'cover', // Crop to fill
320
+ position: 'attention', // Smart crop (focus on faces/subjects)
321
+ })
322
+ .webp({ quality: 85 })
323
+ .toBuffer();
324
+ }
325
+ ```
326
+
327
+ ---
328
+
329
+ ### 5. File Validation & Security
330
+
331
+ ```typescript
332
+ // lib/file-validator.ts
333
+ import { fileTypeFromBuffer } from 'file-type';
334
+
335
+ const MAGIC_BYTES_WHITELIST = new Set([
336
+ 'image/jpeg', 'image/png', 'image/webp', 'image/avif', 'image/gif',
337
+ 'application/pdf',
338
+ 'video/mp4', 'video/webm',
339
+ ]);
340
+
341
+ export async function validateFile(buffer: Buffer, declaredMimeType: string): Promise<{ valid: boolean; detectedType?: string; error?: string }> {
342
+ // Check magic bytes (not just extension/MIME header)
343
+ const fileType = await fileTypeFromBuffer(buffer);
344
+
345
+ if (!fileType) {
346
+ return { valid: false, error: 'Unable to determine file type from content' };
347
+ }
348
+
349
+ if (!MAGIC_BYTES_WHITELIST.has(fileType.mime)) {
350
+ return { valid: false, detectedType: fileType.mime, error: `File type ${fileType.mime} is not allowed` };
351
+ }
352
+
353
+ // Verify declared type matches actual type
354
+ if (fileType.mime !== declaredMimeType) {
355
+ return { valid: false, detectedType: fileType.mime, error: `Declared type ${declaredMimeType} doesn't match actual type ${fileType.mime}` };
356
+ }
357
+
358
+ return { valid: true, detectedType: fileType.mime };
359
+ }
360
+ ```
361
+
362
+ ---
363
+
364
+ ### Common Pitfalls to Avoid
365
+
366
+ | Anti-Pattern | Problem | Correct Approach |
367
+ |---|---|---|
368
+ | Uploading through your API server | Memory pressure, timeout risk, bandwidth cost | Use presigned URLs for direct-to-storage uploads |
369
+ | Trusting file extension alone | Malicious files disguised as images | Validate magic bytes with `file-type` library |
370
+ | No file size limit | Storage abuse, OOM errors | Enforce limits both client-side and server-side |
371
+ | Storing originals only | Slow load times, excessive bandwidth | Generate optimized responsive variants |
372
+ | Public S3 bucket | Data breach risk | Use presigned URLs or CDN with signed URLs |
373
+ | Processing images synchronously in API | Blocks request, timeout | Process async (queue) or use on-the-fly transforms (Cloudflare Images) |
374
+
375
+ ---
376
+
377
+ ### Integration with Other Skills
378
+
379
+ - `cloud-hosting-expert` — CDN setup, Cloudflare R2/S3 configuration
380
+ - `senior-frontend` — Upload UI components, image optimization in Next.js
381
+ - `performance-web-vitals` — Image loading strategy (lazy loading, srcset, blur placeholder)
382
+ - `database-orm-expert` — Storing file metadata and references
383
+ - `production-ready-hardener` — File upload security audit
384
+ - `error-resilience-expert` — Upload retry logic and failure recovery
385
+
386
+ ---
387
+
388
+ <a name="bahasa-indonesia"></a>
389
+ ## Bahasa Indonesia
390
+
391
+ ### Deskripsi
392
+ Panduan tingkat produksi untuk membangun sistem upload file yang aman dan performa tinggi serta pipeline pemrosesan media. Mencakup **pola upload presigned URL** (S3, R2, Supabase Storage), **upload multipart** dengan pelacakan progres, **optimasi gambar** (Sharp, Cloudflare Images, Vercel OG), **transcoding video** (Mux, Cloudflare Stream), **pembuatan PDF**, **validasi file & pemindaian virus**, **konfigurasi CDN**, dan **komponen UI drag-and-drop**.
393
+
394
+ ### Kondisi Pemicu
395
+ Aktifkan skill ini ketika:
396
+ - Mengimplementasikan fungsionalitas upload file (gambar, dokumen, video).
397
+ - Menyiapkan penyimpanan cloud (AWS S3, Cloudflare R2, Supabase Storage, UploadThing).
398
+ - Membangun pipeline pemrosesan gambar (resize, crop, watermark, konversi format).
399
+ - Mengimplementasikan komponen UI upload file drag-and-drop.
400
+ - Mengonfigurasi CDN untuk aset statis dan pengiriman media.
401
+ - Menghasilkan PDF atau memproses dokumen di sisi server.
402
+
403
+ ### Panduan Pemilihan Storage
404
+
405
+ | Provider | Terbaik Untuk | Kekuatan Utama | Biaya Egress |
406
+ |---|---|---|---|
407
+ | **Cloudflare R2** | Hemat biaya, global | Tanpa biaya egress, kompatibel S3 | **$0** |
408
+ | **AWS S3** | Enterprise, ekosistem AWS | Paling matang, fitur lengkap | $0.09/GB |
409
+ | **Supabase Storage** | Aplikasi Supabase | Integrasi RLS, transform bawaan | Termasuk paket |
410
+ | **UploadThing** | Prototipe cepat | Komponen React, tanpa konfigurasi | Termasuk paket |
411
+
412
+ **Rekomendasi**: Gunakan **Cloudflare R2** untuk kebanyakan app produksi (tanpa egress, S3-kompatibel). Gunakan **Supabase Storage** jika sudah menggunakan Supabase.
413
+
414
+ ### Kesalahan Umum yang Harus Dihindari
415
+
416
+ | Anti-Pola | Masalah | Pendekatan yang Benar |
417
+ |---|---|---|
418
+ | Upload melalui server API | Tekanan memori, risiko timeout | Gunakan presigned URL untuk upload langsung ke storage |
419
+ | Mempercayai ekstensi file saja | File berbahaya menyamar sebagai gambar | Validasi magic bytes dengan library `file-type` |
420
+ | Tidak ada batas ukuran file | Penyalahgunaan storage, error OOM | Terapkan batas di sisi klien dan server |
421
+ | Menyimpan file asli saja | Waktu muat lambat, bandwidth berlebih | Buat varian responsif yang teroptimasi |
422
+ | Bucket S3 publik | Risiko kebocoran data | Gunakan presigned URL atau CDN dengan signed URL |
423
+
424
+ ### Integrasi dengan Skill Lain
425
+
426
+ - `cloud-hosting-expert` — Setup CDN, konfigurasi Cloudflare R2/S3
427
+ - `senior-frontend` — Komponen UI upload, optimasi gambar di Next.js
428
+ - `performance-web-vitals` — Strategi loading gambar (lazy loading, srcset, blur placeholder)
429
+ - `database-orm-expert` — Menyimpan metadata file dan referensi
430
+ - `production-ready-hardener` — Audit keamanan upload file
431
+ - `error-resilience-expert` — Logika retry upload dan pemulihan kegagalan