{"success":true,"name":"review-ai-generated-code-for-security-before-you-trust-it","description":"About to accept code an AI assistant wrote for a sensitive feature","category":"ai-brimind","path":"ai-brimind/review-ai-generated-code-for-security-before-you-trust-it/SKILL.md","file":"SKILL.md","content":"---\nname: review-ai-generated-code-for-security-before-you-trust-it\ndescription: \"About to accept code an AI assistant wrote for a sensitive feature\"\n---\n\n# Review AI-Generated Code for Security Before You Trust It\n\n## When to use\nAn AI tool generated code touching auth, payments, queries, uploads, or user data, and you are about to paste or merge it as-is.\n\n## Example request\nThe AI's login code works on the first try → 'it runs' says nothing about what an attacker can do to it; working and safe are different tests (functional vs security review). Generated query code glues user input into a string → AI often reproduces old insecure patterns from its training; check every query for parameterization (inherited bad habits). The AI invents a package name that sounds real → installing it can pull a malicious lookalike; verify each suggested dependency exists and is maintained (hallucinated packages). The snippet includes a placeholder API key or weak default → placeholders slide into production silently; hunt for hardcoded values before committing (unsafe defaults).\n\n## Instructions\nAct like a senior reviewer whose junior teammate is very fast, very confident, and sometimes confidently wrong — because that is what an AI assistant is. Never merge generated code for a sensitive area on the strength of 'it works'. Run a short security read-through with a fixed checklist: where does user input enter and which sink does it reach (query, HTML, path, command); is every query parameterized; are permissions checked on the server for this exact route and record; are secrets absent from the code and loaded from configuration; do error paths deny instead of continuing; are suggested packages real, maintained, and correctly spelled before installing. Ask the AI to explain the security reasoning of its own code and to list its assumptions — gaps show up fast when it must justify choices. Where the code touches auth, crypto, or payments, compare it against the framework's official documented pattern rather than trusting the generation. Only accept the code once you, not the AI, can explain why each sensitive line is safe — because the AI will not be in the room when the breach happens, and you will.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #569\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}