sidon.dev

I wrote the rules, Claude wrote the code: 6 days building vulnerwise · sidon.dev

vulnerwise icon: a shield holding a dependency tree, with one node highlighted in orange.

I wrote the rules, Claude wrote the code: 6 days building vulnerwise

Published · 8 min read

If you are in a hurry (or have no patience for long posts), here is the short version:

  • I built vulnerwise, a plugin that audits a project’s dependencies for known vulnerabilities, in six days: four evenings, from 7 to 10:30 pm, plus all of Saturday and Sunday;
  • I did not edit a single line of code; Claude wrote all of it;
  • I set the style (hexagonal architecture, good practices, plan before coding), made the decisions and reviewed every stage;
  • the most dangerous bugs passed every test and only showed up when I ran the tool for real.

If you still want the details, grab a coffee.

A conversation in a meeting

In a work meeting in November, the conversation drifted to security. People were talking about how many vulnerabilities keep showing up, and how much faster they have been showing up since AI arrived. It stuck with me. That night, at home, I started thinking about how an AI agent could help from the other side, by finding those flaws in a project’s dependencies, and I decided to write a skill for Claude Code. I called it pyvulner: Python only, Portuguese only.

Before the first line of code, I wrote a spec with the rules I wanted respected:

  • a floating version requirement, like requests>=2.0, is reported as undetermined, never as “safe”;
  • every piece of data cites its source and the date it was fetched, and nothing is made up (no CVE, no version);
  • if the tool found nothing, that does not prove the project is safe;
  • if a data source fails, the report says it is degraded.

And the working rule: “before writing code, propose the structure and wait for my approval. Then move forward in small stages.”

Along the way I asked myself: why stop at Python? I asked Claude to research whether something similar already existed. Of course it did. Google’s osv-scanner reads dozens of lockfile formats, and pip-audit handles Python well. But none of them did what I wanted: say what is confirmed, what is uncertain and what to do about it, without overstating the conclusion. I decided to turn the skill into a public project, in English, for several languages. The next evening, vulnerwise was born.

Six days later it was at version 0.3.0, supporting Python, npm, Rust, Go and CycloneDX SBOMs, installable in Claude Code, Copilot CLI, Codex and Antigravity. Along the way there were 55 commits, 23 stages and 468 tests.

(Yes, there is some irony here: the tool exists to stop an AI agent from claiming more than it knows, and it was written by an AI agent. The care I built into it is the same care I needed with whoever was writing it.)

Context gets built along the way

Almost every “expert” on AI-assisted development gives the same advice: have all the context ready in the repository before you start. I don’t work that way. I rarely use the grill-me skill (I find it useful, and I do use it sometimes), and I prefer to build context as I develop.

My technique is a temporary folder, outside version control, where I keep context and memory documents (my memory, not the agent’s) while I work. In vulnerwise, the proposal, the plan and the CLAUDE.md with the rules for the agent all came about this way, when I felt I needed them. I opened the new repository, the README was too short and there was no document with the proposal. So we wrote one.

Documentation works the same way: I keep a draft that changes as development goes on, and the real documentation comes out at the end.

Small stages, always the same quality gate

There were 23 stages. Every stage ended the same way: tests, lint, type checking and plugin validation, all green, and a commit of its own. I looked at the result, approved or corrected it, and only then did the next one start.

In versions 0.2 and 0.3, Claude started proposing each version’s decisions as a numbered list (D1 to D7, E1 to E8), each with its own recommendation, and I confirmed or adjusted them. One example: it proposed using osv-scanner to read the lockfiles vulnerwise does not read. I accepted on one condition: the tool would never be installed on the user’s system without the user asking for it, and the documentation would say so clearly.

Deviations from the plan happened, and the deal was that they had to be declared. Whenever Claude did something outside the plan, it said so and explained why.

Tests as a contract

The rules in the spec became tests. If a change made a floating version show up as “safe”, or a CVE missing from CISA’s catalog of exploited vulnerabilities show up as “not exploited”, some test would fail.

No test touches the network: the real API responses are recorded. The hexagonal architecture is checked by a test too (the domain does no I/O, and if someone adds some, the test complains). And Claude ran mutation tests: it broke the code on purpose to see whether any test noticed. That is how a Go case that no test covered turned up.

Where Claude got it wrong

In one test, it wrote an EPSS percentile of 0.94 from memory. The real value, recorded from the API, was 0.92554. The difference is small, but the “never make things up” rule applies to test code too. There were also the usual logic bugs, like nested copies of npm packages marked as direct dependencies, and members of a Rust workspace duplicating the root’s findings.

The bugs that worried me most passed every test. They were reports that looked correct and said something false:

  • in an SBOM, log4j-core (Java, which vulnerwise does not analyze) showed up only in a footnote warning, and Log4Shell, one of the most famous vulnerabilities in history, went unnoticed. It became a “Not analyzed” line in the summary, and the result no longer counts as clean;
  • also for an SBOM, the report said “import not found” about source code that was not even there, breaking the tool’s own evidence principle;
  • “No confirmed vulnerabilities” showed up even when no package had been analyzed. Now it says “Nothing analyzed”.

You only find these when someone reads the report as a user.

Where the safety guards held

Twice, Claude built a command that ended in git checkout to restore files after a mutation test. That would have wiped out uncommitted changes. Claude Code’s auto mode blocked the command both times, and it redid the work using backup copies.

Before making the repository public, it noticed the commits carried my personal email and rewrote the history with GitHub’s anonymous email. The fix was right, but it had created the problem itself: it had been using the email from my global config without telling me.

When it disagreed (and was right)

I asked it to move the NVD API key into Claude Code’s plugin configuration mechanism. It researched it and showed that, given how the mechanism works, either the key would not reach the scripts or it would be exposed to the model. It recommended leaving things as they were, and I agreed.

And before any public action (push, tag, release, an issue on someone else’s project), it asked for confirmation.

What I would do differently

Run the product for real earlier and more often. The worst bugs showed up in real runs, and unit tests would never have caught them.

Check the distribution channels before building. I found out late about a plugin directory rule that blocks plugins with scripts for regular accounts, and it would have changed architecture decisions if I had known it on day one.

Size the approvals to the risk. Many of my approvals were just “go ahead”. Stages that only touch documentation could have gone in batches; releases, publishing and architecture decisions would still go one at a time.

Next steps

If you got this far stumbling over CVE, EPSS, NVD, SBOM and the CISA catalog, you are not alone. The tool deals with a lot of security terms that not every software professional runs into day to day (I looked up several of them myself during the project).

So the next post will be about that context: more detailed documentation, almost a course, explaining what these terms mean, where the data comes from and how to read a vulnerability report without falling into a false sense of security.

So what does the engineer do?

All the code was Claude’s. The spec, the style, the product decisions and the course corrections were mine, and they are what decided whether vulnerwise would be a trustworthy tool or just one more that says “no problems found”.

The project is on GitHub, under the MIT license. And here is a question for anyone else who codes with an agent: what rules did you have to impose on it? (Yours may well be better than mine, and I would like to hear them.)

All posts