Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Workflow recipe

Security-review a pull request with an agent

Run an AI security code review of one pull request with Trail of Bits' differential-review skill, then test each finding with fp-check before anyone acts on it.

By Checked Advanced1 h 15 min6 steps
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

To run an AI security code review on a pull request, install Trail of Bits’ differential-review and fp-check skills at pinned versions, check out the pull request with context, and run the differential review. Pass every finding to fp-check to prove or reject it, read the true positives yourself and post the result where the merge decision is made.

Ask a model to “find security issues” in a diff and you get a list. Some items are real. Many are patterns that look dangerous out of context: a SQL string that turns out to be parameterised two calls up, an “unvalidated” input that a framework already validates. A long list with a high false-positive rate is worse than no list, because people learn to ignore it.

This recipe uses two skills from Trail of Bits that split the work the way a human security reviewer does. differential-review reviews the change: it classifies risk, reads git history, measures how many callers the changed code has, checks test coverage and writes a report. fp-check then takes each finding and tries to prove it is real, tracing data from source to sink, and returns a true or false positive verdict with evidence. You read the result.

TerminalAbout 10 min

1. Install both skills, pinned

Read both skill pages first: they are long, procedural skills, and differential-review writes a report file into the repository. Then install them at the commit we reviewed:

npx skills add trailofbits/skills@149d7b21f4067765b82e67029730b42d228ef4b4 --skill differential-review -a claude-code
npx skills add trailofbits/skills@149d7b21f4067765b82e67029730b42d228ef4b4 --skill fp-check -a claude-code

Use -a codex or -a cursor for those agents. In Claude Code you can also install them as plugins from the Trail of Bits marketplace, which tracks the default branch instead of a pinned commit.

TerminalAbout 5 min

2. Check out the pull request and give the agent context

Review the code as it will be merged, not a description of it:

gh pr checkout 1234
gh pr view 1234 --json title,body,baseRefName,files

Write two or three sentences of context for the agent: what the change is for, who can reach this code (anonymous users, logged-in users, internal services), and what would be bad (data from one customer visible to another, money moved twice). This is your threat model, and the review is only as good as it is.

Claude CodeAbout 25 min

3. Run the differential review

Differential review · Claude Code
Use the differential-review skill to review the changes on this branch against [BASE BRANCH]. Context: - Purpose of the change: [WHAT THE PR DOES] - Who can reach this code: [E.G. ANY LOGGED-IN USER VIA THE PUBLIC API] - What would be bad: [E.G. ONE TENANT READING ANOTHER TENANT'S INVOICES] Report only findings in code this PR adds or changes, or existing code whose behaviour this PR changes. For each finding give the file and line, the attack scenario in two sentences, and your confidence. State clearly what you did not review.

The skill scales its depth to the size of the codebase and treats auth, crypto, external calls and removed validation as high risk even in tiny diffs. Let it run; on a medium-sized change it reads history and callers, which takes a while. You get a Markdown report with findings, blast radius and coverage gaps.

Read the “what was not reviewed” section first. A confident report about half the change is a common failure.

Claude CodeAbout 20 min

4. Check every finding with fp-check

Now ask for verification, one finding at a time. fp-check is built for checking claims, not hunting for new ones, and it pushes back against its own bias towards seeing bugs.

Verify findings · Claude Code
Use the fp-check skill to verify each finding in [REPORT FILE], one at a time. For each finding: restate the claim precisely, trace the data flow from the attacker-controlled input to the sink, check every validation and authorisation step on the way, and give a verdict of TRUE POSITIVE or FALSE POSITIVE with the evidence (file and line for each step). If a proof-of-concept is possible without touching external systems, describe it, but do not run anything against production or shared environments. End with a table: finding, verdict, severity after verification, evidence summary.

Expect some findings to fall away. That is the point. Keep the false positives in the table with their reason, because the author and reviewer will otherwise raise the same doubts.

EditorAbout 10 min

5. Read the true positives yourself

For each true positive, follow the evidence by hand: open each file and line in the trace and confirm the step. You are checking that the trace is real, not re-doing the analysis. Where you can, turn the finding into a failing test, such as a request as tenant A that reads tenant B’s record. A failing test is the strongest possible bug report and stays in the suite after the fix.

Also skim the false positives. If the reason is “validated upstream in middleware X”, check that middleware X really applies to this route.

GitHubAbout 5 min

6. Post the result where the decision is made

Post a short comment on the pull request: the true positives with severity and evidence, a one-line note on what was checked and found clean, and what the review did not cover. Do not paste the full report into the comment; attach it or link it. Mark clearly that this was an agent-assisted review checked by a named person.

Fixes go through the normal pull request process. Ask the agent to re-run differential-review on the fix commits only, which is quick, and re-check the original findings with fp-check.

Check it worked

Verification checklist

0 of 7 done

When it goes wrong

If the report is a wall of low-value findings, the threat model was missing or vague. Re-run with specific “what would be bad” statements; the skill prioritises by risk, and it needs to know what risk means here.

If fp-check marks everything as a false positive, read one trace closely. Sometimes the agent finds a validation step that does not apply on this path, such as middleware registered for a different router. Ask it to show where that validation is attached to this route.

If the review runs out of context on a large pull request, split it: review the security-relevant files (auth, handlers, data access) first, then the rest.

If the pull request changes GitHub Actions workflows, add a pass with gha-security-review, which looks for expression injection, unsafe triggers and credential exposure that a code review skill does not cover.

Variations

For a quicker everyday pass on your own branch before opening a pull request, Sentry’s find-bugs skill gathers the full diff, maps attack surface and runs a checklist per file. Follow it with fp-check on anything it reports.

To run the review on every security-labelled pull request, adapt the GitHub Action setup from code review with Claude Code, trigger on the labeled event, and post only verified findings. Keep the tool list read-only and the permissions minimal: the reviewer reads attacker-controlled code.

Sentry also publishes a security-review skill with a different checklist. Comparing two skills’ output on the same pull request is a cheap way to see what each misses.

Both skills are third-party code, so scan them before installing like any other. When your security review touches third-party packages, pair it with Audit and upgrade risky dependencies with an agent. Reviewing AI-written code covers what a person still has to look at, and the AI code review and AI security skill hubs cover the wider topics. More recipes are in the AI workflow examples hub.

Outcome and tools

Outcome
A written security review of a pull request where every reported issue has been checked as a true or false positive, with evidence a reviewer can follow.
For
Developers, Team leads
Variants for
Claude Code, Codex, Cursor
Back to top