Communitygithub.com

YepAPI/skills

Presigned URL 上傳、大型檔案的多部分上傳、支援 S3/R2/Supabase Storage。

skills 是什麼?

此技能專注於實現高效、安全且可擴展的檔案上傳功能,特別針對直接儲存至雲端服務(如 S3、R2 或 Supabase Storage)的情境設計。其核心是使用 Presigned URL 以避免伺服器代理,並針對大於 5MB 的檔案採用 Multipart 上傳,可將檔案分割成多個區塊並行上傳。技能還涵蓋客戶端與伺服器端的檔案驗證(包括檢查 magic bytes 而非僅副檔名)、圖片上傳時的自動優化(縮放至最大 2048px、轉換為 WebP、去除 EXIF 資訊),以及透過 `XMLHttpRequest` 或 `fetch` 與 `ReadableStream` 實現上傳進度追蹤。此外,在安全性要求較高的環境中,可整合病毒掃描功能。此技能適用於任何需要使用者上傳檔案的 Web 應用或 API 服務,支援多種主流儲存後端,並且可輕鬆整合至基於 AI 的開發工具(如 Claude Code、Cursor 或 Codex)中。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/file-uploads

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

檔案上傳

規範

  • 使用 Presigned URL 進行直接儲存上傳 — 不要透過你的伺服器代理
  • 大於 5MB 的檔案使用多部分上傳 — 將檔案分割成多個區塊,並行上傳
  • 客戶端驗證:檔案類型、檔案大小限制 — 伺服器再次驗證
  • 圖片最佳化:上傳時縮放(最大 2048px),轉換為 WebP,移除 EXIF
  • 進度追蹤:使用 XMLHttpRequest 或 fetch 搭配 ReadableStream 監控上傳進度
  • 儲存:S3、R2(Cloudflare)或 Supabase Storage — Presigned URL 模式相同
  • 伺服器端檔案類型驗證:檢查魔術位元組,不僅是副檔名
  • 在高安全性情境中對使用者上傳內容進行病毒掃描

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

相關技能