file-processing

Handle file upload, validation, processing pipelines, and temporary file management in Node.js servers. Use when building file processing APIs with Express and multer, managing temporary files with cleanup, or implementing secure file handling patterns. Triggers include "file upload", "multipart form", "temp file cleanup", "multer config", or any server-side file handling task.

7 stars

Best use case

file-processing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Handle file upload, validation, processing pipelines, and temporary file management in Node.js servers. Use when building file processing APIs with Express and multer, managing temporary files with cleanup, or implementing secure file handling patterns. Triggers include "file upload", "multipart form", "temp file cleanup", "multer config", or any server-side file handling task.

Teams using file-processing should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/file-processing/SKILL.md --create-dirs "https://raw.githubusercontent.com/heldernoid/agentic-build-templates/main/projects/automation-productivity/pdf-toolkit/skills/file-processing/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/file-processing/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How file-processing Compares

Feature / Agentfile-processingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Handle file upload, validation, processing pipelines, and temporary file management in Node.js servers. Use when building file processing APIs with Express and multer, managing temporary files with cleanup, or implementing secure file handling patterns. Triggers include "file upload", "multipart form", "temp file cleanup", "multer config", or any server-side file handling task.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# file-processing

Patterns for secure file upload, processing, and cleanup in Node.js Express servers.

## When to use

- Configuring multer for file uploads with type and size validation
- Managing temporary files with automatic cleanup
- Building file processing pipelines (upload, process, download)
- Streaming file downloads without blocking
- Implementing secure file storage with non-guessable paths

## Setup: multer with validation

```typescript
import multer from 'multer';
import path from 'node:path';
import crypto from 'node:crypto';

const storage = multer.diskStorage({
  destination: (req, file, cb) => {
    const jobId = crypto.randomUUID();
    const dir = path.join(process.env.TEMP_DIR ?? './tmp', jobId);
    fs.mkdirSync(dir, { recursive: true });
    (req as any).jobId = jobId;
    cb(null, dir);
  },
  filename: (req, file, cb) => {
    cb(null, `input-${Date.now()}.pdf`);
  },
});

const fileFilter = (req: Request, file: Express.Multer.File, cb: multer.FileFilterCallback) => {
  if (file.mimetype !== 'application/pdf') {
    cb(new Error('Only PDF files are accepted'));
    return;
  }
  cb(null, true);
};

export const upload = multer({
  storage,
  fileFilter,
  limits: {
    fileSize: (parseInt(process.env.MAX_UPLOAD_MB ?? '100')) * 1024 * 1024,
  },
});
```

## Temp file cleanup

```typescript
import fs from 'node:fs';
import path from 'node:path';

const TEMP_DIR = process.env.TEMP_DIR ?? './tmp';
const TTL_MS = (parseInt(process.env.JOB_TTL_MINUTES ?? '60')) * 60 * 1000;

export function scheduleCleanup(): void {
  setInterval(() => {
    const entries = fs.readdirSync(TEMP_DIR, { withFileTypes: true });
    for (const entry of entries) {
      if (!entry.isDirectory()) continue;
      const metaPath = path.join(TEMP_DIR, entry.name, 'meta.json');
      if (!fs.existsSync(metaPath)) continue;
      const meta = JSON.parse(fs.readFileSync(metaPath, 'utf8'));
      if (Date.now() - new Date(meta.created_at).getTime() > TTL_MS) {
        fs.rmSync(path.join(TEMP_DIR, entry.name), { recursive: true });
      }
    }
  }, 15 * 60 * 1000); // Run every 15 minutes
}
```

## Streaming download

```typescript
app.get('/api/download/:token', (req, res) => {
  const jobDir = path.join(TEMP_DIR, req.params.token);
  const metaPath = path.join(jobDir, 'meta.json');

  if (!fs.existsSync(metaPath)) {
    res.status(404).json({ error: 'File not found or expired' });
    return;
  }

  const meta = JSON.parse(fs.readFileSync(metaPath, 'utf8'));
  const outputPath = path.join(jobDir, 'output.pdf');

  res.setHeader('Content-Disposition', `attachment; filename="${meta.filename}"`);
  res.setHeader('Content-Type', 'application/pdf');

  const stream = fs.createReadStream(outputPath);
  stream.pipe(res);

  // Delete after streaming
  stream.on('end', () => {
    fs.rmSync(jobDir, { recursive: true });
  });
});
```

## Security checklist

- Validate MIME type AND file extension (not just MIME)
- Name output files by UUID, not user-supplied names
- Set Content-Disposition on downloads (prevent inline execution)
- Limit upload size via multer limits
- Never log file contents; log only metadata (size, page count)
- Clean temp files after download and on TTL expiry

Related Skills

file-sharing

7
from heldernoid/agentic-build-templates

Upload files, create expiring share links with optional password protection, and track downloads on a self-hosted file drop service.

file-permissions

7
from heldernoid/agentic-build-templates

Reference guide for Unix file permission bits, octal notation, symbolic notation, and security-relevant permission combinations used by the permissions-auditor rules engine.

file-encryption

7
from heldernoid/agentic-build-templates

AES-256-GCM file encryption and PBKDF2 key derivation as used in health-records-vault. Use when you need to understand or implement the encryption model, derive a key from a password, encrypt or decrypt a file manually, restore an encrypted backup, or verify the cryptographic integrity of a .enc file. Triggers include "AES-256-GCM", "PBKDF2", "decrypt .enc file", "restore backup", "encryption key derivation", "IV", "salt", or any task about the cryptographic internals of the vault.

file-tree-diff

7
from heldernoid/agentic-build-templates

Compare two directory trees and show added, removed, and changed files with color output. Use when you need to compare two versions of a directory, find what changed between releases, audit differences between staging and production file sets, or verify a deployment. Triggers include "compare directories", "directory diff", "what changed in", "file differences between", "ftd", "tree diff".

machine-profiles

7
from heldernoid/agentic-build-templates

Use dotfile-sync profiles to manage machine-specific configurations. Use when different machines need different subsets of dotfiles, handling OS-specific configs, or setting up work vs personal machine profiles. Triggers include "machine profile", "per-machine config", "dfs profile", "different configs per machine", "work vs home dotfiles".

dotfile-sync

7
from heldernoid/agentic-build-templates

Manage dotfiles with symlinks from a central git repository. Use when tracking config files, syncing dotfiles between machines, or bootstrapping a new machine. Triggers include "dotfiles", "sync config", "dfs", "track dotfiles", "symlink config", "new machine setup".

Skill: Uptime Monitoring

7
from heldernoid/agentic-build-templates

## Overview

Skill: Status Page

7
from heldernoid/agentic-build-templates

## Overview

Skill: unit-conversion

7
from heldernoid/agentic-build-templates

## Overview

Skill: recipe-scaler

7
from heldernoid/agentic-build-templates

## Overview

reading-list

7
from heldernoid/agentic-build-templates

Operate the reading-list API to save, manage, tag, search, and export articles.

email-digest

7
from heldernoid/agentic-build-templates

Configure, test, and troubleshoot the reading-list daily email digest delivered via nodemailer.