agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when writing code that handles untrusted input, authentication, or sensitive data. Covers injection prevention, authentication and session handling, authorization, cryptography, and the defaults that make code safe by construction. Trigger on "prevent sql injection", "how
Claude Code
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill secure-coding --agent claude-code
Codex
$ npx skills add nimadorostkar/Claude-Skills-collection --skill secure-coding -a codex -y
Cursor
$ npx skills add nimadorostkar/Claude-Skills-collection --skill secure-coding -a cursor -y
Gemini CLI
$ npx skills add nimadorostkar/Claude-Skills-collection --skill secure-coding -a gemini-cli -y
GitHub Copilot
$ npx skills add nimadorostkar/Claude-Skills-collection --skill secure-coding -a github-copilot -y
OpenCode
$ npx skills add nimadorostkar/Claude-Skills-collection --skill secure-coding -a opencode -y
Windsurf
$ npx skills add nimadorostkar/Claude-Skills-collection --skill secure-coding -a windsurf -y
name: secure-coding description: Use when writing code that handles untrusted input, authentication, or sensitive data. Covers injection prevention, authentication and session handling, authorization, cryptography, and the defaults that make code safe by construction. Trigger on "prevent sql injection", "how should i hash passwords", "check permissions on this endpoint". Do not use for auditing a finished change — see the security-review skill; for storing credentials, see the secrets-management skill. metadata: category: security version: 1.0.0 tags: [security, owasp, injection, authentication, crypto]
Write code where the secure path is the default path. Most vulnerabilities are not clever — they are a string concatenated into a query, an authorization check that was never written, or a password hashed with the wrong algorithm.
1. **Identify the trust boundaries** — Every place data enters from outside: HTTP, files, queues, environment, third-party APIs. Everything crossing one is untrusted, including data from your own other services. 2. **Parameterize, never concatenate** — Every query, command, and template. String interpolation into SQL is the oldest vulnerability there is, and it is still the most common. 3. **Authorize on the object, not the route** — A route guard checks that you are logged in. It does not check that *this* order belongs to *you*. Broken object-level authorization is the most prevalent API vulnerability in practice. 4. **Use the right crypto primitive** — Argon2id or bcrypt for passwords. AES-GCM or libsodium for encryption. HMAC for signing. Never design your own scheme, and never use MD5, SHA-1, or plain SHA-256 for passwords. 5. **Fail closed** — On error, deny. An authorization check that throws and is caught by a generic handler returning 200 has granted access. 6. **Set the defaults** — Secure cookies, CSP, HSTS, and TLS configuration. These are one-time changes that eliminate whole vulnerability classes.
**The vulnerability that route-level auth does not catch:**
# The route requires a login. It does not check that the order is the user's.
@router.get("/orders/{order_id}")
@requires_auth # authenticated, but not authorized
async def get_order(order_id: str, user: User = Depends(current_user)):
return await db.orders.get(order_id) # any user can read any order
# Correct: authorization is a property of the object, not the route.
@router.get("/orders/{order_id}")
async def get_order(order_id: str, user: User = Depends(current_user)):
order = await db.orders.get(order_id)
if order is None or order.customer_id != user.id:
# Same response for "does not exist" and "not yours": do not leak existence.
raise HTTPException(404, "Order not found")
return order**Passwords and token comparison:**
from argon2 import PasswordHasher
from argon2.exceptions import VerifyMismatchError
import hmac
ph = PasswordHasher() # Argon2id, correct parameters by default
def hash_password(plain: str) -> str:
return ph.hash(plain) # salt is generated and embedded
def verify_password(plain: str, stored: str) -> bool:
try:
ph.verify(stored, plain)
return True
except VerifyMismatchError:
return False
def verify_webhook(signature: str, expected: str) -> bool:
# `==` on secrets leaks information through timing. This does not.
return hmac.compare_digest(signature, expected)**Parameterized, always:**
# Injectable. The ORM does not save you here.
await db.execute(f"SELECT * FROM orders WHERE status = '{status}'")
# Safe.
await db.execute("SELECT * FROM orders WHERE status = :status", {"status": status})A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory,…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling,…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.