agentleFS
benavlabsbenavlabs/vibe-check/AGENTS.md

vibe-check

AGENTS.md115 starsChanged 2 months agoMITView on GitHub

These rules apply to all code generated in this project. They are non-negotiable. - A CSP header that exists is not enough. Start from this baseline and add only the origins your app actually uses: default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none' - ALWAYS declare default-src. Every fetch directive that isn't declared (script-src, style-src, img-src, connect-src, font-src, frame-src, media-src) falls back to it - ALWAYS declare base-uri, form-action, and frame-ancestors explicitly. They do NOT fall…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

30 rules. About 5 are common, 9 are distinctive, and 16 are very specific to this project.

  • ≈5

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 16

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Common:

    NEVER put API keys, database credentials, or tokens in frontend code (anything under src/, app/, pages/, components/, public/)

    line 7
  2. Very specific:

    NEVER put secret keys in environment variables prefixed with NEXT_PUBLIC_, VITE_, or REACT_APP_ (these are bundled into the client)

    line 8
  3. Common:

    NEVER hardcode credentials in source files.

    line 9
  4. Common:

    Use .env.example with placeholder values only, never real credentials

    line 11
  5. Very specific:

    NEVER set a Supabase RLS policy to USING (true) or FOR ALL without a WHERE condition

    line 16
  6. Very specific:

    NEVER use pickle.loads, pickle.load, or any deserialization on user-supplied data.

    line 18
  7. Distinctive:

    EVERY API route that returns or modifies user data MUST have authentication middleware that runs BEFORE the handler, not inside it

    line 22
  8. Very specific:

    EVERY route that takes a resource ID MUST verify the authenticated user owns that resource: current_user.id == resource.owner_id.

    line 24
  9. Distinctive:

    NEVER concatenate user input into SQL queries.

    line 30
  10. Very specific:

    NEVER use dangerouslySetInnerHTML, v-html, or innerHTML with user-supplied content unless it is first sanitized with DOMPurify

    line 31
  11. Distinctive:

    ALL user input MUST be validated server-side.

    line 32
  12. Distinctive:

    If the application fetches URLs provided by users (link previews, image proxies, URL validators), it MUST:

    line 37
  13. Very specific:

    If the app is served by a host or CDN (Vercel, Netlify, Cloudflare, nginx), set the same headers in that layer's config (vercel.json, …

    line 51
  14. Very specific:

    ALWAYS declare default-src.

    line 57
  15. Very specific:

    ALWAYS declare base-uri, form-action, and frame-ancestors explicitly.

    line 58
  16. Very specific:

    NEVER use 'unsafe-inline', 'unsafe-eval', *, data:, http:, or bare https: in script-src.

    line 59
  17. Very specific:

    NEVER use * in connect-src, frame-src, or form-action

    line 60
  18. Very specific:

    NEVER set CORS origin to * (wildcard).

    line 66
  19. Very specific:

    NEVER reflect the request's Origin header back without checking it against the allowlist

    line 67
  20. Very specific:

    NEVER combine origin: '*' with credentials: true

    line 68
  21. Distinctive:

    Every state-changing endpoint (POST, PUT, PATCH, DELETE) that uses cookie-based auth MUST be protected by SameSite=Lax/Strict session …

    line 73
  22. Distinctive:

    NEVER perform state changes on GET requests (SameSite=Lax still sends cookies on top-level GET navigations)

    line 74
  23. Distinctive:

    Do NOT trust X-Forwarded-For for rate limiting unless behind a trusted reverse proxy

    line 80
  24. Distinctive:

    NEVER expose stack traces, SQL errors, file paths, or library names in API responses

    line 90
  25. Very specific:

    NEVER serve source maps (.js.map) publicly in production.

    line 98
  26. Very specific:

    NEVER let the web server serve .env, .git/, database dumps, backups, or log files.

    line 99
  27. Common:

    ALWAYS use bcrypt, Argon2, or scrypt for password hashing

    line 104
  28. Common:

    NEVER use MD5, SHA-1, or plain SHA-256 for passwords

    line 105
  29. Distinctive:

    Before installing any package, verify it exists on the official registry with a reasonable download count and history

    line 109
  30. Very specific:

    Commit lock files (package-lock.json, poetry.lock, yarn.lock)

    line 111

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

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

Security Rules

These rules apply to all code generated in this project. They are non-negotiable.

Secrets

  • NEVER put API keys, database credentials, or tokens in frontend code (anything under src/, app/, pages/, components/, public/)
  • NEVER put secret keys in environment variables prefixed with NEXT_PUBLIC_, VITE_, or REACT_APP_ (these are bundled into the client)
  • NEVER hardcode credentials in source files. Use environment variables loaded server-side only
  • The .env file MUST be in .gitignore before the first commit. Verify this before creating any .env file
  • Use .env.example with placeholder values only, never real credentials

Database

  • Enable Row Level Security on EVERY Supabase table before deployment. Default policy: deny all. Write explicit policies scoped to auth.uid()
  • NEVER set a Supabase RLS policy to USING (true) or FOR ALL without a WHERE condition
  • Firebase Security Rules MUST require request.auth != null and scope access to request.auth.uid
  • NEVER use pickle.loads, pickle.load, or any deserialization on user-supplied data. Use JSON for all network data exchange

Authentication and Authorization

  • EVERY API route that returns or modifies user data MUST have authentication middleware that runs BEFORE the handler, not inside it
  • Unauthenticated requests to protected endpoints MUST return 401
  • EVERY route that takes a resource ID MUST verify the authenticated user owns that resource: current_user.id == resource.owner_id. This is a SEPARATE check from authentication
  • Admin endpoints MUST verify admin role and return 403 for non-admin users
  • Session cookies MUST set httpOnly: true, secure: true, and sameSite: 'lax'

Input and Output

  • NEVER concatenate user input into SQL queries. ALWAYS use parameterized queries or ORM methods
  • NEVER use dangerouslySetInnerHTML, v-html, or innerHTML with user-supplied content unless it is first sanitized with DOMPurify
  • ALL user input MUST be validated server-side. Client-side validation is for UX only
  • File uploads MUST validate file type by reading magic bytes, not by checking the filename extension. Rename all uploads to UUIDs server-side. Store on a separate domain (S3, R2, GCS), never on the app origin

URL Fetching (SSRF Prevention)

  • If the application fetches URLs provided by users (link previews, image proxies, URL validators), it MUST:
    • Block all private/internal IP ranges: 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, ::1
    • Allow only http and https schemes
    • Resolve the hostname and check the IP BEFORE making the request

Security Headers

  • Set these headers on ALL responses via a single global middleware:
    • Content-Security-Policy (see CSP rules below)
    • Strict-Transport-Security: max-age=31536000; includeSubDomains
    • X-Frame-Options: DENY
    • X-Content-Type-Options: nosniff
    • Referrer-Policy: strict-origin-when-cross-origin
  • In Express, use the helmet package. In Next.js, set headers in next.config.js
  • If the app is served by a host or CDN (Vercel, Netlify, Cloudflare, nginx), set the same headers in that layer's config (vercel.json, netlify.toml, _headers, nginx.conf) for static files, since those responses never pass through your app middleware

Content Security Policy

  • A CSP header that exists is not enough. Start from this baseline and add only the origins your app actually uses: default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'
  • ALWAYS declare default-src. Every fetch directive that isn't declared (script-src, style-src, img-src, connect-src, font-src, frame-src, media-src) falls back to it
  • ALWAYS declare base-uri, form-action, and frame-ancestors explicitly. They do NOT fall back to default-src
  • NEVER use 'unsafe-inline', 'unsafe-eval', *, data:, http:, or bare https: in script-src. For inline scripts, use nonces or hashes
  • NEVER use * in connect-src, frame-src, or form-action
  • 'unsafe-inline' is tolerated in style-src only (many CSS-in-JS and Tailwind setups need it)
  • Roll out a new policy as Content-Security-Policy-Report-Only first, fix what it reports, then switch it to enforcing

CORS

  • NEVER set CORS origin to * (wildcard). Use an explicit allowlist of your actual domains
  • NEVER reflect the request's Origin header back without checking it against the allowlist
  • NEVER combine origin: '*' with credentials: true
  • Declare allowed methods explicitly (only the ones the API uses) instead of allowing all methods

CSRF

  • Every state-changing endpoint (POST, PUT, PATCH, DELETE) that uses cookie-based auth MUST be protected by SameSite=Lax/Strict session cookies, a CSRF token, or both
  • NEVER perform state changes on GET requests (SameSite=Lax still sends cookies on top-level GET navigations)
  • Set cookie flags on EVERY cookie that carries auth or session data, not just the main session cookie

Rate Limiting

  • Login, registration, and password reset endpoints MUST have rate limiting (block after N failed attempts per IP within a time window)
  • Do NOT trust X-Forwarded-For for rate limiting unless behind a trusted reverse proxy

Payments

  • Stripe webhook endpoints MUST verify the signature using stripe.Webhook.construct_event (or equivalent) on every request. Reject any request with an invalid or missing signature
  • Webhook handlers MUST track processed event IDs and skip duplicates (idempotency)
  • Handle the full event lifecycle: payment_intent.succeeded, invoice.payment_failed, customer.subscription.updated (check status for past_due / unpaid), customer.subscription.deleted

Error Handling

  • NEVER expose stack traces, SQL errors, file paths, or library names in API responses
  • Production error responses MUST return only generic messages: {"error": "Something went wrong"}
  • Full error details go to server-side logs only
  • Debug mode / development error pages MUST be disabled in production

Production Exposure

  • Disable or put behind auth these endpoints in production: API docs (FastAPI /docs, /redoc, /openapi.json; Swagger UI), GraphQL playgrounds/GraphiQL and introspection, Spring Boot Actuator, phpinfo, server-status, Werkzeug debugger
  • NEVER serve source maps (.js.map) publicly in production. Disable them in the build config (e.g. Vite build.sourcemap: false, Next.js productionBrowserSourceMaps: false) or upload them privately to your error tracker
  • NEVER let the web server serve .env, .git/, database dumps, backups, or log files. Only the build output directory is publicly served
  • Directory listing MUST be disabled on the web server and on any public bucket

Password Hashing

  • ALWAYS use bcrypt, Argon2, or scrypt for password hashing
  • NEVER use MD5, SHA-1, or plain SHA-256 for passwords

Dependencies

  • Before installing any package, verify it exists on the official registry with a reasonable download count and history
  • Pin exact versions in package.json / requirements.txt (no ^ or ~ in production)
  • Commit lock files (package-lock.json, poetry.lock, yarn.lock)

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.