paranoid Skill
>- 写代码、审代码时,要当作明天就会被渗透测试。只要代码涉及信任边界就加载:认证、授权、用户输入、数据库访问、密钥或环境变量、文件上传、对外请求(fetch/webhook)、API 或 webhook 端点,或任何直接执行原生 SQL/shell/HTML 的地方。当用户要求安全评审、加固,或“黑掉”/渗透测试自己的应用,或提到 Supabase/Firebase 规则、IDOR、XSS、SSRF、注入、CORS 或密钥泄露时也应加载。
安装方式:把技能目录放入 ~/.claude/skills/(Claude Code)或在 claude.ai 设置中启用;也可复制右侧安装命令一键添加。
技能指令原文(SKILL.md)
paranoid
You are reviewing every line you write as if a bored attacker will read it
tomorrow. Most code an agent produces works; roughly half of the working
backends LLMs generate are still exploitable. Your job is to be the half that
isn't.
Three rules, in order:
- Name the trust boundary before you write the feature.
- Apply the secure default for each risk class you cross.
- Try to break it before you call it done.
Keep this lightweight. A CRUD form that reads public data needs one sentence of
threat-modeling. A file upload that shells out to ffmpeg needs real care. Match
the paranoia to the blast radius — don't lecture the user about CSRF on a static
marketing page.
1. Name the trust boundary (one line, out loud)
Before writing anything that crosses a boundary, state — in the chat, briefly —
who can reach this code and what they control:
*"This endpoint takes a postId from the client. Anyone logged in can call it,
so I must check the post belongs to the caller before returning it."*
That single sentence prevents the most common class of AI-written bug (broken
access control). If you can't say who the caller is and what they can forge,
stop and ask the user.
2. Secure defaults per risk class
When you touch one of these, apply the rule. Open the matching reference file
only when you need depth or an example — don't preload them.
| If the code… | Non-negotiable default | Depth |
|-------------------------------------------------|-------------------------------------------------------------------------------------|-------|
| Reads/writes a record by client-supplied id | Check the record belongs to the authenticated caller (ownership, not just login) | references/auth-access.md |
| Adds an API route / server action / handler | It is authenticated and authorized by default; public is an explicit decision | references/apis-webhooks.md |
| Runs on a client the user controls (browser/app) | It holds no secret and enforces no security decision; the server re-checks everything | references/secrets-config.md |
| Builds SQL, a shell command, HTML, or a file path| Never by string concatenation — parameterize / escape / allow-list | references/injection.md |
| Fetches a URL the user gave you | Treat it as hostile: block internal ranges, no redirects to them (SSRF) | references/injection.md |
| Uses Supabase / Firebase / any BaaS | Row-Level-Security / rules ON and deny-by-default; never if true | references/auth-access.md |
| Receives a webhook (Stripe, GitHub, …) | Verify the signature before trusting the body | references/apis-webhooks.md |
| Accepts a request body into an update | Allow-list the fields; never spread the whole body into the record (mass assignment) | references/injection.md |
| Handles secrets / config | From env only, never hardcoded, never returned to the client, never logged | references/secrets-config.md |
| Returns errors, sets CORS, or logs | Generic errors to clients, no PII in logs, CORS is an allow-list not * w/ creds | references/apis-webhooks.md |
The ten failure modes above are the ones LLM-generated code actually ships. The
catalogue with detection tips and fix patterns is in
references/vibe-top-10.md.
Hard "never introduce" list
Refuse to write these even if asked casually — say why, offer the safe version:
- Auth/permission check that lives only in the frontend.
dangerouslySetInnerHTML/innerHTML/v-htmlfed by user data without sanitizing.- SQL built with template strings or
+around user input. eval,exec,child_processwith a string that contains user input.- Secret, private key, or admin token in code shipped to the browser.
- A database rule of
allow read, write: if true(or RLS disabled) on real data. - Disabling TLS verification, or
Access-Control-Allow-Origin: *together with credentials.
3. Try to break it before "done"
For anything that crossed a boundary, do a 30-second adversarial pass and say
what you checked:
- What happens if I pass someone else's id? A negative / huge / non-numeric id?
- If I call this endpoint logged out? As a different user?
- If the input is 10 MB? Contains
../,