agentleFS
aideploytutoraideploytutor/skill-deploy-share/skills/file-upload/SKILL.md

file-upload

Skill2 starsChanged 35 days agoMITView on GitHub

Let signed-in users upload images and PDFs on an app-foundation site, stored in Vercel Blob (free 1 GB, no card) with the file list in Postgres, plus a /files page. Use when the user says "add file upload", "let users upload images/avatars/photos", "my uploads disappear after deploy", "upload works locally but fails on Vercel", or a later skill (shop products, reviews with photos) requires file-upload.

  • Reads credentials
  • Installs packages

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use sqli, xss and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SubhiSecSkill

    sqli

    Hunt SQL injection in REST/GraphQL/SOAP/raw parameters using sqlmap, ghauri, manual UNION/Time/Boolean techniques, and custom WAF-bypass tamper scripts. Use when an input flows into a database query or when the user has identified a parameter that might be vulnerable.

    Also in 6 projects that use this

  • SubhiSecSkill

    xss

    Hunt reflected, stored, and DOM-based Cross-Site Scripting (XSS) including CSP bypass, polyglot payloads, mutation XSS (mXSS), markdown XSS, and template XSS. Use when the user has identified a parameter or input that reflects to the page, or wants to test for XSS in a specific input.

    Also in 7 projects that use this

  • langbyyiSkill

    csrf

    CSRF testing playbook. Use when reviewing state-changing web flows, anti-CSRF defenses, SameSite behavior, JSON CSRF, login CSRF, and OAuth state handling.

    Also in 4 projects that use this

  • yaklangSkill

    open-redirect

    Open redirect playbook. Use when URL parameters, form actions, or JavaScript sinks control navigation targets and may redirect users to attacker-controlled destinations.

    Also in 6 projects that use this

  • langbyyiSkill

    path-traversal

    Path traversal and LFI playbook. Use when file paths, download endpoints, include operations, archive extraction, or wrapper behavior may expose filesystem control.

    Also in 4 projects that use this

  • zebbernSkill

    js-analysis

    Analyze JavaScript files to discover hidden endpoints, API keys, secrets, and sensitive data. Use when testing web applications, when user mentions JavaScript analysis, or when looking for hidden API endpoints.

    Also in 3 projects that use this

  • +5 more from SubhiSec
  • +1 more from langbyyi

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All Blob calls live in src/lib/storage.ts and the upload route, so another provider (Cloudflare R2 for 10 GB) can replace them later …

    line 26
  2. Very specific:

    Never copy, print or ask for BLOB_READ_WRITE_TOKEN.

    line 31
  3. Distinctive:

    Don't raise the limits or allow other file types (HTML, SVG, executables) without asking.

    line 32
  4. Distinctive:

    Delete it: it disappears from the list and from the Blob store's Browser tab.

    line 64

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

file-upload

Goal: signed-in users can upload images and PDFs, see them in /files, and delete them. Files survive every deploy. Follow ../../STACK.md.

Why not save files in the project folder

AI tools often write uploads to public/uploads with fs.writeFile. That works on your computer and fails once deployed: on Vercel and Cloudflare the site's folder is read-only and replaced on every deploy (on Vercel the error is ENOENT ... mkdir '/var/task/public' or EROFS: read-only file system). Files belong in object storage; the database keeps only their address. apply.mjs warns if it finds such code.

Choices made

  • Vercel Blob, public store. Created from the Vercel dashboard in a few clicks, no card needed. Hobby includes 1 GB storage, 10 GB downloads, 10,000 simple and 2,000 advanced operations a month (each upload is one). Past the limit Blob stops for the rest of the 30 days; it never charges a Hobby account. Re-check https://vercel.com/docs/vercel-blob/usage-and-pricing before quoting numbers.
  • Browser uploads straight to Blob (client upload), so files aren't capped by the 4.5 MB function body limit. /api/files/upload only issues a one-time permit.
  • Only signed-in users, only into files/<userId>/, JPG/PNG/WebP/GIF/PDF, 5 MB per file, 20 files and 25 MB per person (UPLOAD_LIMITS in src/lib/storage.ts). Without sign-in, strangers could fill the free quota.
  • The list comes from Postgres, not from Blob, so viewing /files costs no Blob operation. Each upload is verified with head() before it's recorded. Deleting is free.
  • All Blob calls live in src/lib/storage.ts and the upload route, so another provider (Cloudflare R2 for 10 GB) can replace them later without touching pages.

Rules

  • Creating the Blob store changes the owner's Vercel project: ask for an OK first, and let the owner watch or click.
  • Never copy, print or ask for BLOB_READ_WRITE_TOKEN. Vercel adds it to the project by itself.
  • Don't raise the limits or allow other file types (HTML, SVG, executables) without asking. A public store means anyone with a link can open the file; tell the owner not to use it for private documents.

Steps

1. Check dependencies

stack.json → installed needs db-connect and auth-login. If either is missing, offer to install it first.

2. Add the code

node <skill-dir>/scripts/apply.mjs --dir "<project>" --json

It adds src/db/schema/files.ts, src/lib/storage.ts, /api/files/upload, /files (page, uploader, actions), the @vercel/blob dependency, an .env.example note, stack.json → installed, and a git save point. It runs drizzle-kit generate --name file_upload when node_modules exists; if manual says so, run npm install && npm run db:generate -- --name file_upload and commit drizzle/. Read warnings: if it lists files that save to public/, offer to switch them to src/lib/storage.ts.

Push. The next build creates the table.

3. Owner: connect a Blob store (with OK)

In Vercel → the project → Storage → Create Storage → Blob → Continue:

  • Access: Public (the code uploads public files; a Private store rejects them)
  • tick Add a read-write token env var to this connection (Vercel's dialog leaves it off by default, and uploads need it)
  • Create

Then Deployments → Redeploy (or push). Variables only reach new deployments.

4. Verify

  • Signed out, /files redirects to /login.
  • Signed in: upload a picture → it appears with the space bar updated. Too-large or wrong-type files get a clear message.
  • Redeploy, open /files again: the picture is still there. This is the whole point.
  • Delete it: it disappears from the list and from the Blob store's Browser tab.

Using it in code

import { listFiles, UPLOAD_LIMITS } from "@/lib/storage";
const files = await listFiles(user.id); // { id, url, name, contentType, size, createdAt }[]

Other systems react to files.uploaded / files.deleted in core_events, or keep a file's url in their own table (e.g. shop_products.image_url).

Troubleshooting

See references/troubleshooting.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.