AIToday
Zenn AI/MLPublished: Nov 23, 2026, 04:00 JST

Claude Code wrote the code, but 5 choices sat outside the spec

Send on LINE
Claude Code wrote the code, but 5 choices sat outside the spec

3 Key Points

  1. What happened

    The author gave Claude Code five written criteria for blocking duplicate words on a Go (Gin) SQLite API and asked it to add tests. Reviewing the result, he found five decisions the spec never covered — stored values, SQL structure, no UNIQUE constraint, init refactoring, and busy_timeout — and caught only two himself.

  2. Why it matters

    Writing the criteria before prompting let him tell later which choices were his and which were the AI's, and naming them is what made his own merge decision explainable rather than a bet.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

The piece is built around three failure scenes and the procedure drawn from them: at a hackathon he shipped authentication work whose code he had not fully read and could only say it was "probably" not broken; at another, a scoring display failed live and he could not judge whether the AI's fix matched the cause; at his internship, a reviewer asked why one line existed and he could not answer. Those scenes map onto his three steps — criteria written before the work, evidence from reading the tests, and an explanation in his own words before merging.

The part that gives the piece its edge is a mismatch of scale. The first attempt, adding request inspection before an LLM API call and running to more than 20 criteria, stalled and was never merged, because he had not estimated the checking cost when he wrote the spec. The duplicate-word change is the retry with deliberately capped effort: about five observable completion conditions, reading the tests himself and naming at least one thing they do not prove, and writing a three-sentence flow of the implementation before reading any AI summary.

The outside decisions all trace back to meeting the criteria — trimming whitespace before comparing, fusing the check and insert into one statement, waiting up to 5 seconds on a locked database under busy_timeout — but accepting them is a separate judgment from spotting them, and the author's point is that writing criteria first is what leaves a seam between the two. He ties this to Addy Osmani's "comprehension debt", the widening gap between code that exists and code a person actually understands, and to Osmani's advice to check the commands that ran before reading any "it works" summary.

FAQ
Why did the author not merge the first change he tried this on?
That change had a spec of more than 20 items, and he could not get through checking each criterion against its test and explaining the flow one by one. He counted it as unmerged because unchecked AI output is not evidence.
What does the duplicate check actually rely on, if there is no UNIQUE constraint?
It uses a single SQL statement that checks for the word and inserts only if it is absent. SQLite runs that whole statement without overlapping other writes, so 20 simultaneous requests produced one row.
Were the duplicated words already in the development database a problem for this change?
No. The change only blocks new registrations and does not touch existing rows, so the author treated the old duplicate as outside the scope of the merge decision.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Next articleAnthropic IPO filing flags AI that refuses stop orders, games tests