---
id: 18740
lang: en
title: "A strict Go architecture trained Claude Code to stay in line: fixes after 55% of features versus 95%"
published_at: "2026-11-30 20:27:38"
source_name: "Habr AI"
source_url: "https://habr.com/ru/articles/1114212/?utm_campaign=1114212&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/18740"
categories: ["llm", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# A strict Go architecture trained Claude Code to stay in line: fixes after 55% of features versus 95%

> **Краткая суть (BLUF):** The author of a retrospective service written in Go built the architecture so the agent cannot get around the rules: a forgotten method in an adapter breaks the build. On this backend, Claude Code needed fixes after 55% of features, while on the frontend without enforced rules, the figure was 95%. Where the compiler stays silent, the agent still cut corners: it put the nickname validation outside the domain. The takeaway: important requirements are more reliably encoded in types and interfaces than in CLAUDE.md.  • Fix count: 44 fix commits for 80 feat in the backend core, 158 for 166 on the frontend • Claude Code implemented the nickname change feature in a single commit touching 15 files • The agent left nickname validation in the business layer and passed bare values to the adapter

Developers still argue about how to get an AI agent to write code "the way we do it here." The usual answer is a long file of instructions. The author of a Habr article tested a different approach: he made the Go backend architecture so rigid that Claude Code has nowhere to slip. He measured the result from commit history. On the backend, a fix was needed after roughly every second new feature (55%), while on the frontend, where there were no hard rules, almost after every one (95%). The sample is small: one project and one developer. But the observation is practical and easy to transfer to your own team.

## What the project is and where Rails fits in

Simple Retro is a service for retrospectives in Agile teams. Participants write cards anonymously, group them, vote, and at the end create tasks with owners. Inside are five microservices in Go, each with its own PostgreSQL except the gateway. There is also RabbitMQ, Redis, Jaeger, and a Next.js frontend.

Each microservice is split into four layers, loosely based on clean architecture. The controller accepts a request and passes it on as a DTO, a predefined data structure. The business layer sees the outside world only through interfaces. The domain holds the business rules and data validation. Adapters talk to the database and the broker, accept and return only domain structures, and make no decisions.

"Rigidity" here is literal: the compiler checks the rules. If the agent declares a method in an interface but does not implement it in the adapter, Go will not build the project and will report the missing method. If the business layer expects a specific DTO, you cannot pass it something else.

## What the agent did

For the test, the author asked Claude Code to add a feature for changing a participant's nickname within a specific team. The agent finished it in one commit across 15 files: proto contracts, the controller, DTOs, the business layer with a 127-line test, the adapter, and SQL queries. Each file ended up in its own layer.

The agent never broke the rules the compiler enforces. It did break the rules nobody checks automatically. It wrote nickname validation in the business layer, although by the canon it should live in the domain. It passed bare values to the adapter instead of a domain structure. Another slip: the business layer imports the controller package just to get a logger. The agent copied this from the author, who had done it since the first commit.

Notably, CLAUDE.md and the project documentation described all of this, with code examples. Context alone did not guarantee quality. A rerun on the more senior Opus model gave a small gain: it noticed that nicknames were not normalized with NFKC (a Unicode normalization form that maps look-alike characters to one form), and the fix went into the code. But it did not notice the mixing of layers.

## What happened without rules on the frontend

The author keeps commits in the conventional commits format, so he could count fixes (fix) against new features (feat):

- backend core: 80 feat, 44 fix, a fix after 55% of features;
- other Go services: 92 feat, 48 fix, 52%;
- frontend: 166 feat, 158 fix, 95%.

According to the author, a stronger model did not change the situation on the frontend, while even a cheap model handled the backend successfully. Detailed descriptions of what he wanted did not help either: the agent tried to guess expectations, and tokens went to waste.

So the author introduced a working order on the frontend: brainstorming, at least three mockups to choose from, a diagram of interaction with the backend, a dozen targeted edits, and only then code. He also limited the agent to a single design system and connected a browser MCP server so it could take screenshots itself. But this is an agreement, not a constraint: the compiler does not enforce it.

## What follows from this

The metric is rough: different parts of the project are being compared, and the share of fix commits depends on the author's habits. He acknowledges that this is not the best evidence. The article does not offer universal advice.

The practical conclusion is this. It makes sense to express important requirements in types, interfaces, and import bans, so that a violation breaks the build. Rules in CLAUDE.md work "when you're lucky," and luck is more likely when the code already contains an example. That is why the author now writes the first handler of each new kind himself, and the agent then repeats it from that template.

There is also a warning: architecture does not guarantee meaning. The agent reproduced access-control holes from the template just as neatly as it reproduced correct code. For example, an outsider would first get a "not found" or "invalid data" response and only then face the team membership check. Such mistakes had to be caught separately; review and tests were not optional.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/articles/1114212/?utm_campaign=1114212&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18740
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
