securing-code
Skill2 starsChanged 8 months agoMITView on GitHub
Enforces secure coding patterns for API routes, auth, input handling, and database queries. Triggered when writing server-side code, handling user input, or adding dependencies.
- Installs packages
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- running-testsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
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
- Distinctive: line 13
Always follow this sequence in every server-side handler:
- Very specific: line 53
After adding ignore-scripts=true, explicitly allow trusted scripts:
- Distinctive: line 90
Check: maintainer count, download volume, last publish date
- Distinctive: line 92
Verify: no phantom transitive dependencies added
- Distinctive: line 93
Wait: prefer packages with 7+ days since last publish
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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
Secure Code Patterns
API Route Handler Order
Always follow this sequence in every server-side handler:
1. Auth check
2. CSRF check (mutations only)
3. Input validation (schema-based)
4. Business logic (parameterized queries only)
5. ResponseNon-Obvious Rules
- CSRF tokens on ALL mutations (POST, PUT, DELETE) — not just forms
- Rate limit auth endpoints specifically (login, reset, signup)
sameSite=stricton session cookies, notlax- Set
X-Content-Type-Options: nosniff— prevents MIME sniffing attacks - Audit log sensitive operations (rate changes, user management, role changes)
Supply Chain
Pin versions, block scripts, enforce soak periods. These are enforceable guards, not advice — configure them in the project.
Node.js (.npmrc)
# Block postinstall scripts by default (would have stopped the Axios attack)
ignore-scripts=true
# 7-day soak period — don't install packages published in the last week
minimum-release-age=10080
# Pin exact versions — no ^ or ~
save-exact=true
# Enforce peer deps and run audit on every install
strict-peer-dependencies=true
audit=trueAfter adding ignore-scripts=true, explicitly allow trusted scripts:
pnpm config set allow-scripts "esbuild,sharp,prisma"Python (pip)
# Pin with hashes for integrity verification
pip install --require-hashes -r requirements.txt
# Generate pinned requirements with hashes
pip-compile --generate-hashes requirements.inGo
# Verify module checksums against public transparency log
GONOSUMCHECK= GOFLAGS=-mod=readonly go build ./...Rust
# Cargo.toml — use exact versions
[dependencies]
serde = "=1.0.210"# Audit for known vulnerabilities
cargo auditWhen adding ANY new dependency
- Check: maintainer count, download volume, last publish date
- Review:
postinstall/ build scripts in the package - Verify: no phantom transitive dependencies added
- Wait: prefer packages with 7+ days since last publish
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.

