Recipe: Security check a repository
Scans a repository for risky code, leaked secrets and vulnerable packages; an agent fixes or explains each, and a person approves. What it does, when to use it, how to make it yours, and what a run costs.
Scans a repository for risky code, passwords written into the code and packages with known vulnerabilities. An agent then reads the code behind each serious finding and either fixes it or explains why it's a false alarm. A recheck runs the scanners again, and a person decides whether to keep the fixes. The project's code is read, never run.
| At a glance | Notes |
|---|---|
| Level | Advanced |
| Category | Safety |
| Shape | Scanners, an agent that fixes or explains, a recheck, a person |
| Plan | Free and up |
| Needs a Claude key | Yes |
| Limits it comes with | 2 loops, 1200 seconds, $0.50 |
| Claude key limit for a run | $1.00 of Claude |
| Commands that wait for a person | Pushing code |
Opens it in the Playground as a flow of your own. Simulate shows what a run costs. Run asks before it starts.
The steps
The pattern: scanners find, an agent fixes or explains, a recheck sends it back, a person keeps the result.
| Step | Block | What it does |
|---|---|---|
| Get the repository | Run command | Saves a small sample shop API with known problems: a SQL query built from user input, a shell command, unsafe unpickling, MD5 for passwords, a hardcoded admin password and two outdated packages. |
| Run the scanners | Run command | Runs bandit on the Python code, pip-audit on the pinned packages and a secrets scan, and writes security/findings.md. Nothing from the project is installed or run. If a scanner can't run, this step fails, so a run never reads "not checked" as "all clear". |
| Anything serious? | Decide | Yes when there's at least one high or medium finding. No ends the run: nothing serious to fix. |
| Agent fixes or explains | Agent | Reads the code behind each high and medium finding. It fixes real problems with the smallest safe change, raises vulnerable package versions, and lists false alarms with a reason in security/accepted.txt. Then it writes security/REPORT.md. Its internet is off, and it can only read and edit files. |
| Fixed or explained? | Decide | Runs the scanners again. No sends the agent back while a high or medium finding is neither fixed nor explained. |
| Keep the fixes? | Approval | A person reads the report and the change, then approves or denies. |
| Keep the fixes | Run command | Commits the fixes and saves them as security/fixes.patch. |
| Report only | Run command | Undoes the fixes and keeps the report. |
When to use it
- Before you ship, or before you take over a codebase you didn't write.
- After an AI agent has written a lot of code and you want a second look at it.
- On every pull request, from a GitHub event trigger, so problems are caught early.
Run it
The quick way: choose Try it now under the drawing. It opens the recipe in the Playground as a flow of your own, after you sign in if you aren't yet. Simulate opens it and shows the forecast, and Run opens it and asks before it starts, with what the run will likely cost. From the dashboard instead:
- In the dashboard sidebar, open Agent Playground → Recipes and find Security check a repository. Choose Advanced to filter the list. In the builder, Recipes in the toolbar lists them too.
- Choose Use this recipe. It becomes a flow of your own, so changing it never changes the recipe.
- If you haven't yet, save your Claude key on the Secrets page. The builder offers Add a key… in the step's key list if it's missing.
- Choose Simulate to see the forecast, then Run.
- When the run waits for a person, approve or deny it from the banner, from Approvals, or from the approval email.
What you'll see: Run the scanners finds 9 problems: 3 high, 4 medium and 2 low. Open Agent fixes or explains to follow the agent's turns. Fixed or explained? passes once nothing serious is left open, and the run waits for you at Keep the fixes?. Read security/REPORT.md and approve.
Make it yours
- In Get the repository, clone yours instead:
git clone --depth 1 https://github.com/you/app app. For a private repository, save a GitHub token on the Secrets page asGITHUB_TOKENand add it to the flow's secrets. - Add scanners for your languages in Run the scanners and in Fixed or explained?, for example
uvx semgrep scan --config auto --json -o security/semgrep.json app. Then teach.qr/summarize.pyto read their output. - For a deeper audit, replace Agent fixes or explains with a Run command that runs Claude Code with an audit skill, like the Claude Code to a pull request recipe.
- To get a pull request from it, add the Open the pull request step from Claude Code to a pull request after Keep the fixes. The flow holds
git pushfor a person. - The flow's key limit caps Claude at $1 a run. The Policy panel shows it, and you change it in the flow's JSON under
policy.keyBudgets.
What a run costs
These are the builder's own forecast for the recipe as it comes, with its limits, rounded. Simulate shows the same numbers for your version, and they change as you change the flow.
| Notes | Typical | 1 in 10 runs | At most |
|---|---|---|---|
| Sandbox time | $0.003 | $0.006 | $0.01 |
| Claude, on your key | $0.11 | $0.30 | the run's spend limit |
| How long it takes | about 5 minutes | about 7 minutes | 1200 seconds |
A typical run uses $0.003 of sandbox time, so about 290 runs cost $1, and every plan includes $5 of usage a month. The time includes a person taking a minute or two to answer the approval. The clock, and the sandbox, keep running while the run waits. Claude is billed by Anthropic to your own key, at their usual prices. The run counts it toward its spend limit, so it can't overspend, but we don't charge you for it. At most is the most a run could cost with these limits: it stops at $0.50 or 1200 seconds, whichever comes first.