AI-generated Solidity: how to review code written by agents
To ship Solidity written with AI coding agents, review each agent-written change against the protocol rather than the diff alone, and make that review a required check before merge. QuillShield runs a full audit of the codebase, then checks every pull request against it, and on GitHub a required check blocks a merge with a High or Critical finding.
What goes wrong in Solidity written by agents?
An agent's change can compile and pass the tests the same agent wrote while still being wrong for your protocol, so the review has to come from outside the session that produced it. These are the places to look.
- Units, decimals and configuration. A price feed in the wrong unit, a missing multiplication or a swapped address reads like ordinary code. Moonwell's loss, below, came from exactly that. The page on oracle price manipulation lists the checks every feed needs.
- New entry points. An agent asked to add a feature may add an admin function, an initializer or a public helper without the access rule the rest of the protocol uses. The access control page lists what to check.
- Patterns from the wrong context. Code that is safe in one protocol can be unsafe in yours: a spot price read, a transfer before a state update, a guard on one function but not on its neighbor. See reentrancy.
- Tests that share the code's assumptions. When the same agent writes the code and the tests, a wrong assumption shows up in both. Tests of the protocol's invariants, written separately, catch what the agent believed.
- Large diffs. Agents can change many files in one pull request. QuillShield recommends a new full audit for a change that adds Solidity files, more than 150 lines or more than 5 changed files, and smaller pull requests are easier for people to review too.
What has gone wrong before?
On 15 February 2026 at 18:01 UTC, Moonwell executed governance proposal MIP-X43, which enabled Chainlink OEV wrapper contracts across its core markets on Base and Optimism. One configuration priced cbETH from the cbETH/ETH exchange rate alone, without multiplying by the ETH/USD price, so the protocol read cbETH at about $1.12 instead of about $2,200.
Liquidators seized 1,096.317 cbETH from borrowers, and Moonwell was left with about $1.78M of bad debt, as The Block and Decrypt reported from Moonwell's post-mortem. The pull request behind the change listed Claude Opus 4.6 as a co-author on its commits.
A person could have written the same missing multiplication. What would have stopped it is a review that reads a new oracle configuration against how the protocol prices collateral, and a bound that rejects a cbETH price of $1.12.
How do pull request checks fit a team that codes with agents?
Start with one full audit of the codebase. It gives QuillShield a security graph of the protocol, and every later check compares a change with that graph instead of reading the diff alone. Then turn on the checks:
- Install the GitHub App from CI/CD Checks and switch on Scan Pull Requests. On GitLab.com, connect GitLab and switch on Scan Merge Requests.
- Set Fail check on to the lowest severity that should stop a merge. High or above is the default.
- On GitHub, add the QuillShield check to the branch protection rule or ruleset for your main branch, so a failing check blocks the merge.
From then on, a pull request gets a check when it is opened, updated, reopened or marked ready, whether a person or an agent opened it. The guide to adding security checks to CI on GitHub has each step.
For the writing side, QuillAudits publishes QuillShield Security Skills, free and open-source skills that bring the QuillShield auditing method to an agent you run yourself, such as Claude or Cursor. They are separate from the QuillShield product, which runs the full audit with proofs of concept and the pull request checks.
What do the checks cost?
Each full audit of a GitHub or GitLab.com repository includes five pull request checks. After those, a check costs $5 for up to 50 added lines of Solidity and $0.10 for each added line after that, so a change that adds 150 lines costs $15, as the pricing page shows. The full audit that sets the baseline is priced from the lines in scope, for example $379 for 1,000 lines as of November 2026. Sign-up is free, and the first-audit guide walks through the quote.
What should you check in an agent's pull request?
- Does the change add a function that moves funds, mints or changes roles, and who can call it?
- Are units, decimals and feed addresses right, and does each resulting price make sense in dollars?
- Did the agent write the tests as well, and do they test the protocol's invariants or only the new code?
- Does the change touch something other contracts rely on, such as a conversion, a price or a shared balance?
- Are new external calls made after state updates, and guarded where they share state?
- Is the pull request small enough to review, or should it be split or get a new full audit?
Common questions
Is Solidity written by AI agents less safe than code written by people?
There is no published measure to point to either way. What matters is the same for both: whether each change is reviewed against the rest of the protocol before it merges. The Moonwell mistake was one a person could also have made.
Do pull request checks run on pull requests that an agent opens?
Yes. With Scan Pull Requests on, a check starts when a pull request is opened, updated, reopened or marked ready, whoever opened it.
Are QuillShield Security Skills the same as QuillShield?
No. The skills are free and open source, and they run inside an agent you control, such as Claude or Cursor. QuillShield is the product that runs the full audit with proofs of concept and then checks each pull request against it.
What does it cost to check every agent pull request?
Five checks come with each full audit of a GitHub or GitLab.com repository. After that, each check costs $5 for up to 50 added lines of Solidity plus $0.10 for every added line beyond 50.