Agent skill
NestJS File Uploads
Secure file handling, Validation, and S3 streaming.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/file-uploads
Metadata
Additional technical details for this skill
- labels
-
nestjs upload multer s3
- triggers
-
{ "files": [ "**/*.controller.ts" ], "keywords": [ "FileInterceptor", "Multer", "S3", "UploadedFile" ] }
SKILL.md
File Upload Patterns
Priority: P0 (FOUNDATIONAL)
Secure file upload handling with validation and storage patterns.
- Magic Bytes: NEVER trust
content-typeheader or file extension.- Tool: Use
file-typeormmmagicto verify the actual buffer signature.
- Tool: Use
- Limits: Set strict
limits: { fileSize: 5000000 }(5MB) in Multer config to prevent DoS.
Streaming (Scalability)
- Memory Warning: Default Multer
MemoryStoragecrashes servers with large files. - Pattern: Use Streaming for any file > 10MB.
- Library:
multer-s3(direct upload to bucket) orbusboy(raw stream processing). - Architecture:
- Client requests Signed URL from API.
- Client uploads directly to S3/GCS (Bypassing API server completely).
- Pro Tip: This is the only way to scale file uploads infinitely.
- Library:
Processing
- Async: Don't process images/videos in the HTTP Request.
- Flow:
- Upload file.
- Push
FileUploadedEventto Queue (BullMQ). - Worker downloads, resizes/converts, and re-uploads.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?