AI maintainability
/
C# architecture, not prompt tricks
Make a C# codebase cheaper for agents to change correctly
Every extra file an agent must open before it can edit one rule costs tokens, review time, and first-pass mistakes. Prompts cannot fix that. Shape the architecture so the change is small, local, and explicit. (This guide calls each extra file a hop.)
Files touched vs Layered
45%
Operation-local
Modular lands at 55%. Layered is the 100% baseline. How this was measured.
deployed_code_history
Pillar 1
token
Token cost
How much context an agent must load and emit to ship one product rule. Types that exist only to satisfy layers (DTO, command, query, contract, exception) are wasted context. Extra detail in the file you actually edit — like a closed list of outcomes — is not.
Typical change vs Layered
Modular 60% · Operation-local 86%
Pillar 2
group
Developer involvement
Navigation before the first edit, files a human must review, and forgotten registration points. Agents still need a person when finding the right file is a search problem.
Files opened to understand
Modular 56% · Operation-local 38%
Pillar 3
verified
Correct output
First-pass completeness, compile-time outcome coverage, and tests that actually hit persistence. Mocked layers can be green while the query is wrong.
First-pass completeness (estimated)
Layered 40% · Modular 75% · Operation-local 90%