security-best-practices
Skill4 starsChanged 5 months agoMITView on GitHub
Security rules for all code in this repo. Use when handling any external input, env vars, auth, API routes, server actions, or dependencies.
- Reads credentials
25 other projects use a version of this.
Adopted by
Most recently taken up by
- hmjBill/skillstheir own version, first seen Oct 5, 2026
- z91772524-ai/pojia-next-mactheir own version, first seen Sep 28, 2026
- lklimek/claudiustheir own version, first seen Sep 23, 2026
- PracticalSwan/agent-skillstheir own version, first seen Sep 14, 2026
- AymanShams/codex-coding-ostheir own version, first seen Sep 12, 2026
- belentani7/manus-ai-skill-packtheir own version, first seen Sep 12, 2026
Used with
Projects with it also use supabase-postgres-best-practices, performance-optimization and 9 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.
JetBrainsSkillsupabase-postgres-best-practices
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
Also in 3 projects that use this
dylantarreSkillperformance-optimization
Use when animation runs slow, janky, or causes frame drops
Also in 3 projects that use this
guaderramaSkillspec-driven-development
Generate comprehensive specifications for software projects using spec-driven development methodology. Leverages Bright Data MCP tools to research documentation, analyze competitor implementations, gather real-world examples, and enrich specs with architectural insights. Use when user requests specifications, technical plans, project specs, or architecture documentation.
Also in 3 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 3 projects that use this
VercelSkillvercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Also in 4 projects that use this
VercelSkillagent-browser
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
Also in 4 projects that use this
- +1 more from vercel-labs
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 25
- openai/skills★ 28ksame name
- JetBrains/skills★ 360same name
- Mindrally/skills★ 266same name
- letitbk/claude-academic-setup★ 46same name
- sampleXbro/agentsmesh★ 25same name
- ckorhonen/claude-skills★ 18same name
- PracticalSwan/agent-skills★ 18same name
- autohandai/community-skills★ 11same name
- svngoku/coding-agents-skills★ 11same name
- z91772524-ai/pojia-next-mac★ 9same name
15 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- clean-codeSkill
- evaluateSkill
- impeccable-intentSkill
- nextjs-qualitySkill
- ui-ux-pro-maxSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 24 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Every external input is hostile until validated.
- Distinctive: line 30
Never log secrets, tokens, session IDs, or personal data.
- Distinctive: line 31
Never hardcode credentials, even "temporarily," even in tests.
- Very specific: line 40
Add the server-only package import to modules that must never reach the client.
- Very specific: line 44
Never use dangerouslySetInnerHTML with user-influenced content.
- Distinctive: line 46
Use parameterized queries / an ORM — never string-build SQL.
- Distinctive: line 52
Add a Content-Security-Policy when the app's asset sources stabilize (see SECURITY.md).
- Very specific: line 58
Use a proven library (Auth.js, Clerk, Better Auth...) — never hand-roll sessions, password hashing, or token logic.
“Common” is measured: kept by at least 6 in 10 of the 24 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.
Files
Security Best Practices
Every external input is hostile until validated. Every secret leaks unless proven otherwise. Apply these rules to all code — they are not optional hardening for "later."
Validate at every boundary with zod
zod is installed for exactly this. Validate — don't trust — all of:
- Server action arguments and form data
- Route handler (
route.ts) request bodies, params, and search params - Anything read from
localStorage, cookies, or URL state - Third-party API responses your code consumes
- Environment variables (parse once at startup in a
src/lib/env.tsif the app grows)
const CreatePost = z.object({ title: z.string().min(1).max(200) });
const input = CreatePost.parse(await req.json()); // throws on bad inputSecrets & environment
- Real values go in
.env.local(git-ignored). Committed template is.env.example. NEXT_PUBLIC_prefix = shipped to every browser. Never prefix a secret with it.- Never log secrets, tokens, session IDs, or personal data.
- Never hardcode credentials, even "temporarily," even in tests.
Server/client boundary
- Privileged logic (DB access, API keys, price calculations, permission checks) lives in Server Components, server actions, or route handlers only.
- Authorization is checked on the server for every request — client-side checks are UX, not security. Re-verify session/role inside every server action and route handler, not just in layout or UI code.
- Add the
server-onlypackage import to modules that must never reach the client.
Output & injection
- Never use
dangerouslySetInnerHTMLwith user-influenced content; if unavoidable, sanitize with a maintained library first. - Use parameterized queries / an ORM — never string-build SQL.
- Validate and allowlist URLs before redirecting or fetching them (SSRF).
Headers & platform
- Baseline security headers are set in
next.config.ts— keep them when editing config. - Add a Content-Security-Policy when the app's asset sources stabilize (see SECURITY.md).
- New dependencies: prefer well-maintained, widely-used packages; check
npm auditafter adding. Fewer dependencies is itself a security feature.
When touching auth (future apps built on this template)
- Use a proven library (Auth.js, Clerk, Better Auth...) — never hand-roll sessions, password hashing, or token logic.
- Cookies:
httpOnly,secure,sameSite— always.
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.

