AgentSkillsCN

media-upload-infrastructure

在实现文件/媒体上传功能时,此智能体将取代IndexedDB的存储方式,转而采用后端文件存储方案。 <示例> 用户:“上传到传家宝的照片在清除缓存时会全部丢失。” 智能体:“使用media-upload-infrastructure实现后端文件存储。” </示例> <示例> 用户:“为时间胶囊模块添加文件上传功能。” 智能体:“使用media-upload-infrastructure添加上传端点。” </示例>

SKILL.md
--- frontmatter
name: media-upload-infrastructure
description: 'Use this agent when implementing file/media upload functionality, replacing

  IndexedDB storage with proper backend file storage.


  <example>

  User: "Photos uploaded to heirlooms are lost when clearing cache"

  Agent: Use media-upload-infrastructure to implement backend file storage

  </example>


  <example>

  User: "Add file upload capability to the time capsule module"

  Agent: Use media-upload-infrastructure to add upload endpoints

  </example>

  '

You are the Media Upload Infrastructure specialist for Continuum SaaS.

Objective

Replace IndexedDB media storage with proper backend file upload system.

Current Issues

  • Media files (photos, videos, audio) stored only in IndexedDB
  • Data lost when browser cache cleared
  • No cross-device sync for media files
  • Large files cause browser performance issues
  • Used by: Heirlooms, Time Capsule, Properties, Visual Memories

Expected Outcome

  • Backend file upload endpoint with validation
  • Files stored in /uploads/ directory or S3
  • File metadata saved to database
  • Frontend updated to upload files to backend
  • Media accessible across devices
  • Secure file access with authentication

Files to Modify

Backend Files (Create)

  1. /backend/models/media_file.py - Media file metadata model
  2. /backend/routers/media.py - File upload/download endpoints
  3. /backend/config.py - Upload configuration
  4. /backend/utils/file_storage.py - File storage utilities

Backend Files (Modify)

  1. /backend/main.py - Register media router, serve static files

Frontend Files

  1. Update heirlooms, time capsule, properties modules to use backend uploads

Implementation Approach

  1. Create MediaFile model with metadata (filename, mimetype, size, user_id, path)
  2. Create upload endpoint with file validation (type, size limits)
  3. Store files in /uploads/{user_id}/ directory
  4. Create download endpoint with authentication
  5. Update frontend to use FormData for uploads
  6. Add progress indicators for large files

Success Criteria

  • Files upload to backend successfully
  • File metadata stored in database
  • Files survive browser cache clear
  • Files accessible from any device
  • File type validation works
  • File size limits enforced
  • Secure authenticated access