Why we built Attritect, twice

Most of a business app is the same screen

About ten years ago, as a team lead, I started counting the pages in the systems we built: ERPs, hospital systems, back-office portals, internal tools. The same thing came up every time.

Between 40% and 75% of the pages were CRUD screens: a list you can search, sort and page through, a form to add or edit a row, a delete button. In most internal and back-office systems it was 50% to 65%.

Each of those screens was built by hand, the same way, again and again:

  • a DTO for the list, another for the form;
  • a validator;
  • a controller with five endpoints, paging and error handling;
  • a service with the permission checks and the customer’s data filter;
  • search, filter and sort query code;
  • the list page and the edit form;
  • translations, export, history.

That’s hundreds of lines per screen, and none of it is what makes the product different. Worse, it’s where the bugs were. One screen forgets a permission check; another forgets to filter by customer and shows one company’s data to another; a third pages differently from the rest. Code review catches some of it. Not all.

So we built an engine for it

We stopped writing the screens and started describing them. A class with attributes said what the screen had (columns, search fields, form fields, rules), and our own private engine did the rest: the API, the queries, the validation, the permissions.

In the very first test, one developer built 13 pages in a couple of hours.

That engine was the base of our work for years. When .NET moved to .NET Core, it stayed behind on the old platform, and we went back to writing screens by hand.

Then AI arrived, and the problem came back

AI assistants changed how fast code gets written. They didn’t change what gets written. Ask an assistant for a “manage products” screen and it writes the same 650 to 950 lines: DTOs, validator, controller, service, queries, form. For the next screen, it writes them again, a little differently.

So the old problems came back, in a new form:

  • Tokens. Every screen is paid for in full, and every change means reading and rewriting several files.
  • Mistakes. More generated code means more places for a subtle error. The dangerous ones (a missing tenant filter, a skipped permission check) look perfectly normal in review.
  • Drift. Each screen is generated from a different prompt, so each behaves slightly differently.

The answer was the same as ten years ago: don’t write the screen, describe it. So we rebuilt the engine from scratch for .NET 10 and called it Attritect: attribute plus architect.

Compressed code, fewer errors, fewer tokens

With Attritect, the assistant writes one class of 30 to 40 lines per screen instead of 650 to 950 across six to eight files.

  • Fewer errors: there’s simply less code to get wrong. The risky parts (permissions, tenant isolation, linked-row checks, safe queries) live in one engine with over 300 tests, so a new screen can’t forget them. Many mistakes the assistant does make are caught at build time by Attritect’s compile-time checks, before the app runs.
  • Fewer tokens: in our early comparisons, generating a screen takes roughly 15 to 20 times fewer tokens. We’ll publish a full benchmark, with the prompts and the method, so anyone can repeat it.
  • The same behavior everywhere: every screen pages, sorts, validates and reports errors the same way, whatever the prompt was.

To make assistants use it well, Attritect comes with an AI kit: rules and skills for Claude Code, Cursor, GitHub Copilot, Windsurf and others. It teaches them how the engine works, what it already guarantees, and where its guarantees end.

What it doesn’t do

Attritect is for the data screens, the 50% to 65% that are the same everywhere. Your booking flow, your payment logic and your dashboards are still normal code, and they can call the same API and permissions. The engine gives you the time back for them.

Free and open source

The engine is free and open source under the MIT license. Try it in a minute:

dotnet new install Attritect.Templates
dotnet new attritect-cleanarch -n MyApp
dotnet run --project MyApp/src/MyApp.Web

Then read Why Attritect for the numbers on a real app, or Getting started.

Khaled Kamara, creator of Attritect