secure-coding
Skill4 starsChanged 31 days agoMITView on GitHub
This skill should be used while WRITING any backend, API, auth, or data-handling code for a web app or SaaS — to prevent vulnerabilities before they ship, not to audit them after. Trigger phrases include "add an endpoint", "handle user input", "store user data", "is this secure", "build the API", "save to the database", "handle the form", "user uploads", "process payment", "handle secrets", "set up CORS", "rate limit". It applies OWASP Top 10 prevention, input validation, secrets hygiene, and GDPR basics as you build.
- Reads credentials
20 other projects use a version of this.
Adopted by
Most recently taken up by
- TheLunchTrae/claude-code-configstheir own version, first seen Nov 8, 2026
- profdorly/ultimate-dev-skillstheir own version, first seen Nov 8, 2026
- AxlZero21/Skillstheir own version, first seen Nov 8, 2026
- its-ash/skillstheir own version, first seen Nov 1, 2026
- gabrielbauman/skillstheir own version, first seen Nov 1, 2026
- nandhu-44/secure-vibe-codingtheir own version, first seen Nov 1, 2026
Other versions20 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 20
- techygarg/lattice★ 209same name
- nimadorostkar/Claude-Skills-collection★ 33same name
- HyunjunJeon/claude-workflow-mods★ 9same name
- sergeyizmailov/knowledge-delta-skills★ 3same name
- slilbudget/knowledge-delta-skills★ 3same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- g-cqd/skills★ 2same name
- mondoohq/secure-stack★ 2same name
- txRandria/skills★ 2same name
- AxlZero21/Skills★ 1same name
10 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 repository21 other files it gives its agents.
- accessibilitySkill
- ai-featuresSkill
- api-designSkill
- architecture-primerSkill
- authSkill
- data-modelingSkill
- deploymentSkill
- design-taste-frontendSkill
- frontend-performanceSkill
- image-to-codeSkill
- integrationsSkill
- landing-pageSkill
- multi-tenancySkill
- paymentsSkill
- pre-ship-securitySkill
- product-discoverySkill
- pwaSkill
- rls-auditSkill
- saas-routerSkill
- technical-seoSkill
- ui-designSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
Rate-limit: every public and auth endpoint (express-rate-limit, or the platform's edge limiter).
“Common” is measured: kept by at least 6 in 10 of the 16 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
Secure Coding
This skill keeps you from introducing vulnerabilities while you build. It is prevention, not audit — it runs at the moment you write an endpoint, a form handler, or a database write, and bakes in the safe default before the bug exists.
Analogy: it is the seatbelt you put on before driving, not the crash investigator who shows up afterward. Audit tools (Trail of Bits, Semgrep, CodeQL) inspect the wreck. This skill stops the crash.
Scope
This skill is for the solo dev or small team who has no security tooling installed and just wants to ship without leaving holes. If a dedicated audit plugin is present, this skill still runs first — preventing a vuln is always cheaper than finding it later.
Trigger
Activate whenever code touches: a request handler/endpoint, user input, a database write, authentication, file uploads, secrets/env vars, CORS, or any third-party webhook. Default-deny mindset: code with no explicit security decision is the bug.
Discovery (max 3 questions, only if unknown)
- Is this endpoint/data public, authenticated, or admin-only?
- Does it touch personal data (email, name, payment, location, anything identifying a person)?
- What is the backend — serverless functions (Vercel), a Node server, or a BaaS (Supabase/InsForge)?
The OWASP Top 10, as prevention rules
Apply the matching rule the instant you write the code. Each maps an OWASP 2021 category to a concrete default.
| Risk | Prevent it by |
| A01 Broken Access Control | Check authorization on the server, on every endpoint. Verify the resource belongs to req.user (stop IDOR). Default-deny: no explicit check = bug. Never trust client-sent role/price/owner fields. |
| A02 Cryptographic Failures | HTTPS everywhere (free on Vercel). Hash passwords with bcrypt or argon2, never plaintext/reversible. Encrypt PII at rest. Never roll your own crypto. |
| A03 Injection | Never string-concat SQL. Parameterized queries / ORM only (pg params, Drizzle, Prisma, Kysely). Validate every input at the boundary with zod before it reaches logic or the DB. |
| A04 Insecure Design | Threat-model the feature first: who can call this, what is the worst input. Enforce limits by design — quotas, server-side amount/price checks. |
| A05 Security Misconfiguration | Add Helmet for secure headers. CORS = explicit origin allowlist (never * with credentials: true). Disable verbose error stacks in prod. |
| A06 Vulnerable Components | Pin deps, run npm audit + Dependabot, remove unused packages, update before shipping. |
| A07 Auth Failures | Use a vetted auth provider (see the auth skill). Rate-limit login routes harder. httpOnly + Secure + SameSite cookies for sessions. MFA where possible. |
| A08 Data Integrity | Verify webhook signatures (e.g. Stripe signing secret). Don't deserialize untrusted data. Commit the lockfile. |
| A09 Logging Failures | Log auth + authz denials — but never log PII, tokens, passwords, or full request bodies. Redact first. |
| A10 SSRF | Don't fetch user-supplied URLs server-side without an allowlist; block internal/metadata IP ranges. |
API security defaults
- Validate at the boundary with
zod, and use.strict()schemas that whitelist exactly the allowed fields. This kills mass assignment — never spreadreq.bodyinto a DB write; explicitly droprole,isAdmin,id,ownerId. - Rate-limit every public and auth endpoint (
express-rate-limit, or the platform's edge limiter). Auth routes get a stricter limit. - CORS: allowlist origins explicitly. With credentials,
*is forbidden by spec and a real hole. - Return correct status codes —
401vs403,422on validation,429 + Retry-Afteron limit.
User data & GDPR basics (for developers)
- Collect the minimum PII. Drop optional fields. Less data = less liability (GDPR Art. 5 minimization).
- Encrypt in transit (TLS) and at rest. GDPR Art. 32 cites encryption as the recommended safeguard.
- Set retention + deletion. Provide a way to delete a user's data on request.
- Never log PII. Redact emails, tokens, bodies before they hit logs or Sentry.
Secrets hygiene
.gitignore.env,.env*.local,*.pem,*.key. Commit a.env.examplewith names only.- Secrets live in the platform's encrypted store (Vercel env vars marked Sensitive), never in the repo.
- On Vite, only
VITE_-prefixed vars reach the browser — a secret behind that prefix is a public leak. - Rotate by add-new → redeploy → revoke-old. Optionally run gitleaks as a pre-commit net.
Server decides, client asks
The rule behind most real holes: anything the client sends is a request, not a fact.
- Prices, totals, roles, owners, statuses — computed or checked on the server.
- File uploads — the server builds the path (scoped to the user), chooses the bucket, restricts the type, caps the size.
- Identity — from a token the server validates, never from a cookie or field the browser can edit.
- Never switch to the admin/service client to make a permission error go away. That removes the permission. Find out why the user's own credentials were refused.
Public endpoints (no login)
A form or endpoint anyone can call needs, at minimum: a captcha or equivalent, a honeypot field (named so autofill won't fill it), a rate cap that does not depend on the caller's IP, and sanitizing of every value that ends up in a message sent to someone else.
Field notes
references/field-notes.md holds the security failures behind these rules — plus a working Content-Security-Policy recipe (per-request nonce, strict-dynamic, Report-Only rollout) and where secrets actually leak from. The three that cost the most:
- A storage path taken from the form, uploaded with the admin client.
- An order line saved at a client-chosen price.
- An API key published inside a Markdown notes file by
git add -A.
For database permissions on a BaaS, run rls-audit. For third-party webhooks, see integrations. For LLM calls, see ai-features.
Output
For each piece of code, deliver: the secure implementation, a one-line note on which risk it defends against, and any validation schema (zod) inline. When you spot a violation in existing code the user shows you, flag it with the fix — but the job is to write it safe the first time.
Reference
OWASP Cheat Sheet Series (~29k⭐), OWASP Top 10:2021, GDPR.eu / gdpr-info Art. 32. Tools: zod, helmet, express-rate-limit, bcrypt/argon2, gitleaks.
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.

