nuxt-imgur-clone
AGENTS.md2 starsChanged 5 months agoMITView on GitHub
Guidance for AI agents and humans working in this repo. Read README.md first for setup and the overall picture; this file captures the runtime contract and the rules that keep changes safe. An Imgur-style image host: paste, drop, or pick an image and get a shareable link. Single Nuxt 4 project — browser uploader plus two Nitro server routes — backed by Vercel Blob. No database. - app/app.vue — root component; renders <NuxtPage /> and holds shared page styles. -…
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 60
Storage is public-only by design: Do not switch uploads to access: 'private' without also adding a server streaming route and an access …
- Very specific: line 67
Uploads are anonymous by design: Before deploying anywhere abuse matters, add an auth check inside onBeforeGenerateToken and pass identity …
- Very specific: line 72
Never commit secrets. Real values live in Vercel environment variables or local .env* files.
- Very specific: line 74
Never commit BLOB_READ_WRITE_TOKEN, Vercel tokens, .vercel/, node_modules, or build output (.nuxt, .output).
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Guidance for AI agents and humans working in this repo. Read README.md first for
setup and the overall picture; this file captures the runtime contract and the rules
that keep changes safe.
What this is
An Imgur-style image host: paste, drop, or pick an image and get a shareable link. Single Nuxt 4 project — browser uploader plus two Nitro server routes — backed by Vercel Blob. No database.
Project structure
app/app.vue— root component; renders<NuxtPage />and holds shared page styles.app/pages/index.vue— the uploader (paste/drop/browse, progress, gallery).app/pages/i/[name].vue— the shareable preview page for one image.server/api/upload.post.ts— mints client-upload tokens withhandleUpload.server/api/image/[name].get.ts— resolves blob metadata withhead, sets CDN headers.shared/utils/images.ts— the single source of truth for image rules (auto-imported into both app and server by Nuxt).nuxt.config.ts— the Analytics module and the caching route rules.
Commands
pnpm install
pnpm dev # nuxt dev --dotenv .env.local (loads the Blob token)
pnpm build # production buildEnvironment
BLOB_READ_WRITE_TOKENis the only variable the app needs. It signs client-upload tokens on the server and must never reach the browser. Provisioned byvercel blob create-store ... --access public; pull locally withvercel env pull .env.local.- OIDC (
VERCEL_OIDC_TOKEN+BLOB_STORE_ID) is not sufficient —handleUploadrequires the static read-write token to sign client tokens.
Upload contract
- Uploads go directly from the browser to Vercel Blob via
upload()from@vercel/blob/client, using/api/uploadas the token endpoint. Bytes never pass through a Vercel Function (bypasses the 4.5 MB body limit). - Blob pathnames are always
<10 alphanumeric chars>.<ext>fromnewImageName(). Original filenames never leave the browser. server/api/upload.post.tsrejects any pathname that failsIMAGE_NAME_REand embeds the content-type whitelist, the 10 MB size cap, and a 1-yearcacheControlMaxAgeinto the signed token. Vercel Blob enforces those at upload time.- The UI only ever exposes the app's own
/i/<name>link. The raw blob URL is used as the<img>source andog:image, but is never shown as the shareable link. server/api/image/[name].get.tsreturns 404 for missing or non-image blobs.
Rules for changes
- Keep
shared/utils/images.tsthe one source of truth. The browser validates against it and the token route enforces it. Changing the allowed types, size cap, or name format on one side without the other breaks uploads. UpdateIMAGE_NAME_REandnewImageNametogether. - Storage is public-only by design. Do not switch uploads to
access: 'private'without also adding a server streaming route and an access check — private blobs are not web-accessible and give up the direct-CDN delivery path. - Do not surface the blob storage URL as the primary share link. Hand out
/i/<name>. - Preserve the caching model unless intentionally changing it:
/prerendered,/i/**ISR (isr: 3600),/api/image/*withs-maxage/stale-while-revalidate, and immutable blob URLs. These depend on names being random and never reused. - Uploads are anonymous by design. Before deploying anywhere abuse matters, add an auth
check inside
onBeforeGenerateTokenand pass identity viatokenPayload.
Security
- Never commit secrets. Real values live in Vercel environment variables or local
.env*files. Keep.env.exampleplaceholder-only. - Never commit
BLOB_READ_WRITE_TOKEN, Vercel tokens,.vercel/,node_modules, or build output (.nuxt,.output).
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
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.

