Coding prompts · Prompt
Review a fresh diff for security risks (prompt)
review-fresh-diff-security-prompt
Checks only the lines just added in a code change for injection, XSS, SSRF, hardcoded secrets, unsafe deserialisation, path traversal and missing ownership checks. Use when an agent is writing code and you want those risks caught in the fresh diff before anyone sees the result, or a checklist for this change rather than a whole-app audit.
Works with: Any AI Not yet model-tested; testing Jan 2027
Paste it into ChatGPT, Claude, Gemini or any AI chat, then tell it about your project. How it works
Install in Claude Code, Cursor or Codex (optional)
Only for AI coding tools that read skill folders. Run one line in a terminal, in your project folder. It downloads this skill's text files from TheSkillVault and nothing else; you can read them first with “View raw SKILL.md”.
Claude Code (all your projects)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/raw' -o ~/'.claude/skills/review-fresh-diff-security-prompt/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/LICENSE.txt' -o ~/'.claude/skills/review-fresh-diff-security-prompt/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/NOTICE.txt' -o ~/'.claude/skills/review-fresh-diff-security-prompt/NOTICE.txt'Cursor (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/raw' -o '.cursor/skills/review-fresh-diff-security-prompt/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/LICENSE.txt' -o '.cursor/skills/review-fresh-diff-security-prompt/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/NOTICE.txt' -o '.cursor/skills/review-fresh-diff-security-prompt/NOTICE.txt'Codex and other Agent Skills tools (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/raw' -o '.agents/skills/review-fresh-diff-security-prompt/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/LICENSE.txt' -o '.agents/skills/review-fresh-diff-security-prompt/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/NOTICE.txt' -o '.agents/skills/review-fresh-diff-security-prompt/NOTICE.txt'
Or connect the whole library over MCP
Add TheSkillVault to Cursor or add this to your app's MCP settings (read-only; help):
{
"mcpServers": {
"theskillvault": {
"url": "https://theskillvault.ai/mcp"
}
}
}This pass looks at code as it is written. It checks the lines just added. It does not audit the whole app, and it does not replace a human review.
When to use
- An agent just edited files, and you want security bugs caught before the result is shown.
- You have a unified diff and want a checklist for the added lines only.
- You suspect injection, XSS, SSRF, a hardcoded secret, unsafe deserialisation, path traversal, or a missing ownership check in this change.
When not to use
- You want the whole app walked for leaked keys, database rules, headers and packages. Use audit-app-security.
- You want a threat model of components and trust boundaries. Use threat-model-your-app.
- You want bugs, performance and readability as well as security. Use review-code-prompt.
Steps
- Get the working directory with
pwdand the diff withgit diff(or the patch the agent just wrote). - Paste the prompt below. Fill in the absolute working directory and the diff.
- Read only medium, high and critical findings. Each one must quote an added line.
- Fix the real ones, then run the prompt again on the new diff.
- Do not post findings anywhere until you say so.
Prompt
You are checking a fresh code change for concrete security bugs an attacker could use.
Working directory: <ABSOLUTE PATH FROM pwd>.
Cite only paths that appear in a diff header, or that you have just read from that directory.
If you do not have a path, say so. Do not invent an absolute path.
Use whatever model is already running. Do not switch to a named vendor model.
Review the unified diff. Lines that start with + were added. A space prefix is old context. A line that starts with - was removed.
Flag a problem only when the added lines introduce it.
Also flag an added line that sends untrusted data into a dangerous sink that was already there (eval, a shell, or SQL built from strings).
Ignore the same problem if it already existed in the removed lines or in unchanged context.
Ignore starter code the task did not ask you to change.
For each finding give: exact file path, category, the added line in quotes, how an attacker would use it, a concrete fix, and severity (critical, high or medium).
Drop low and best-practice notes. If nothing qualifies, say "No new security issues in the added lines."
Checklist. Look for these in the added lines:
1. Command and code injection. User data in a shell string, exec, eval, new Function, os.system, or subprocess with a shell. Prefer an argument array. A value that starts with a dash can still be a flag even without a shell.
2. SQL injection. User data concatenated or interpolated into SQL. Use a parameter or the query builder.
3. XSS. innerHTML, outerHTML, document.write, dangerouslySetInnerHTML, or a template that does not escape (EJS unescaped output, mark_safe, autoescape off). An escaper that forgets quotes still breaks an attribute.
4. Unsafe deserialisation. pickle.load, yaml.load or unsafe_load, torch.load without weights_only, marshal, shelve, or PHP unserialize on data you did not produce. Prefer JSON or a schema.
5. SSRF. A user-influenced URL is fetched. A format check is not enough. After DNS, reject loopback, private ranges and link-local (cloud metadata). Re-check each redirect.
6. Path traversal. A user path is joined onto a base directory. Join and normalise do not stop .. or symlinks. Resolve the real path, then check it stays under the real base directory.
7. Ownership and IDOR. A handler loads or changes a row by an id from the request and never checks the caller owns it. Compare with the sibling handler. A token minted from the body alone, with no logged-in user, is the same class of bug.
8. Secrets. A password, API key or private key written in source. A secret printed to logs or put in a query string. A password stored with a fast hash. A session id or token drawn from a non-crypto random source. A dev fallback such as an env default is not a finding.
9. Other concrete holes. TLS verification turned off for a non-local host. XML parsed with external entities. An open redirect to a next URL. CSRF protection switched off. A GitHub Actions run step that interpolates an issue title, PR body or client payload. Pass those values through an env block.
Do not flag: denial of service, missing rate limits, missing HTTPS in general, crashes, theoretical races, public analytics keys, or non-secret config such as a port or a table name.
Comments that say "already safe" are claims. Check the code.
A file can have more than one issue. Keep going after the first.
Do not post comments. Ask me first.
How to adapt
- Project-specific rules? Add a short list under the checklist. Keep secrets out of that list.
- Want a second pass on one finding? Ask it to trace callers of that function only.
- Not a git repo? Paste the before and after of each file and mark the new lines yourself.
Gotchas
- A whole-app audit will bury this change in old issues. Stay on the added lines.
- A safety comment is not proof. The check has to be in the code you can see.
- Never paste secrets, tokens or private customer data from the diff into a chat that others can read.
Portability
Works with any AI that can read a diff, and with any language. Without git, paste the change. The checklist is the same on any host.
Done when
- The prompt names the working directory you supplied, and every path in the report is real.
- Each finding quotes an added line, names the category and gives a fix, or the report says there are none.
- Nothing was posted without your go-ahead.
Example prompt
"Check the diff I just wrote for injection, XSS, SSRF, hardcoded secrets and unsafe deserialisation. Use pwd as the working directory. Do not invent paths. Do not post anything."
---
Modified from the original security-guidance plugin in anthropics/claude-plugins-official, by David Dworken (Anthropic). Credit: Anthropic, Apache-2.0. The upstream LICENSE copyright line is the unfilled template. Original: https://github.com/anthropics/claude-plugins-official/tree/1d8db0deb7967d5bfb1ff7a851a255cb87b01a85/plugins/security-guidance. Changes by TheSkillVault are listed in the metadata above and in NOTICE.txt. See LICENSE.txt.
Bundled files
Licence
Adapted from David Dworken (Anthropic) (Anthropic, Apache-2.0. Upstream LICENSE keeps the unfilled template line Copyright [yyyy] [name of copyright owner].), Apache License 2.0. Modified from the original by TheSkillVault on 2026-11-17. Kept the security review prompt and checklist only. Dropped the hook runtime. Rewrote the checklist in plain language, stated the working directory so paths are not invented, and left model names host-neutral. Scope is the fresh diff, not a whole-app audit. Not the original file.
Licence: Apache License 2.0. Attribution when you reuse it: Based on work by David Dworken (Anthropic) (Anthropic, Apache-2.0. Upstream LICENSE keeps the unfilled template line Copyright [yyyy] [name of copyright owner]., Apache License 2.0), https://github.com/anthropics/claude-plugins-official/tree/1d8db0deb7967d5bfb1ff7a851a255cb87b01a85/plugins/security-guidance; adapted by TheSkillVault, https://theskillvault.ai