agentsclimarketplace

Nestjs file uploads

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/nestjs-file-uploads

Secure file handling, Validation, and S3 streaming. Use when implementing secure file uploads, validation, or S3 streaming in NestJS. (triggers: **/*.controller.ts, FileInterceptor, Multer, S3, UploadedFile)From its SKILL.md

Install
npx -y skills add ComeOnOliver/skillshub --skill nestjs-file-uploads

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.7 KB, 365 tokens by cl100k_base, as published. Nobody here has run it

File Upload Patterns

Priority: P0 (FOUNDATIONAL)

Secure file upload handling with validation and storage patterns.

  • Magic Bytes: NEVER trust content-type header or file extension.
    • Tool: Use file-type or mmmagic to verify the actual buffer signature.
  • Limits: Set strict limits: { fileSize: 5000000 } (5MB) in Multer config to prevent DoS.

Streaming (Scalability)

  • Memory Warning: Default Multer MemoryStorage crashes servers with large files.
  • Pattern: Use Streaming for any file > 10MB.
    • Library: multer-s3 (direct upload to bucket) or busboy (raw stream processing).
    • Architecture:
      1. Client requests Signed URL from API.
      2. Client uploads directly to S3/GCS (Bypassing API server completely).
      3. Pro Tip: This is the only way to scale file uploads infinitely.

Processing

  • Async: Don't process images/videos in the HTTP Request.
  • Flow:
    1. Upload file.
    2. Push FileUploadedEvent to Queue (BullMQ).
    3. Worker downloads, resizes/converts, and re-uploads.

Anti-Patterns

  • No content-type trust: Always verify file magic bytes; MIME header can be spoofed.
  • No MemoryStorage for large files: Use streaming or signed URL pattern for files > 10MB.
  • No synchronous file processing: Offload image/video work to BullMQ workers via FileUploadedEvent.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.