Roslyn analyzers that turn Cratis architectural conventions into build-time diagnostics for .NET codebases — MIT licensed and free to use.
Add the NuGet package to your project:
dotnet add package Cratis.Architecture.CodeAnalysisOr add it directly to your .csproj file:
<ItemGroup>
<PackageReference Include="Cratis.Architecture.CodeAnalysis" Version="*" />
</ItemGroup>The analyzers will automatically run during build and provide diagnostics in your IDE.
This project turns architectural intent into executable rules. Instead of relying on review comments and tribal knowledge, you get immediate diagnostics directly in your editor and CI pipeline.
We treat architecture as a first-class part of developer feedback:
- Architectural boundaries stay visible while you code
- Teams get consistent enforcement across repositories
- New contributors can follow conventions without memorizing all rules
Architectural drift gets expensive when it is discovered late. These analyzers are designed to fail fast:
- During local development in your IDE
- During build and test execution
- Before non-compliant code becomes part of your shared history
This shortens feedback loops and keeps architecture aligned with design decisions over time.
LLMs and coding agents are much more effective when constraints are explicit and machine-checkable.
Cratis Architecture gives agents and humans the same contract:
- Rules are deterministic and discoverable
- Violations are specific and actionable
- Code fixes are guided by clear architectural diagnostics
That means agent-generated code gets validated against your architectural standards immediately, which reduces rework and keeps automated development aligned with your intended design.
26 rules (CRARCH0001–CRARCH0026) covering:
- Domain-oriented naming — exception type naming, no technical postfixes on class names, static class naming conventions, domain-oriented namespaces aligned with folder paths
- Exceptions — domain-specific exception types instead of built-in framework exceptions
- Logging and observability — source-generated
LoggerMessagelogging, typed logger categories, and Cratis Fundamentals traces and metrics - Async hygiene — no
async void, no blocking on async calls, unawaited calls handled, noAsyncmethod-name postfix - Dependency injection — no
IServiceProviderinjection, no concrete type injection, constructor fan-out limits - Code structure and style — file length thresholds, no regions, no unused interfaces, no test types in production assemblies,
is nullpattern checks, string interpolation
See the rule reference for every rule with its severity and rationale.
This project is part of Cratis — free, MIT-licensed tools for building event-sourced and CQRS applications.
- Chronicle — event-sourcing database and runtime. Orleans-based kernel, pluggable storage (MongoDB default; PostgreSQL, SQL Server, SQLite, in-memory), language-agnostic gRPC contracts. Docs
- Chronicle clients — first-class .NET SDK, plus TypeScript, Kotlin/Java, and Elixir; Python coming soon (pre-alpha). AI agents connect through the Chronicle MCP server.
- Arc — opinionated CQRS framework for ASP.NET Core with commands, queries, validation, authorization, and TypeScript proxy generation. Works without event sourcing. Docs
- Components — React components aligned with Arc patterns. Docs
- CLI + Workbench — inspect and diagnose Chronicle from the terminal or the browser. Docs
- Model-first layer (experimental) — Studio, Screenplay, Stage, Scene, Prologue
- Supporting — Fundamentals, Specifications, Synopsis, Lens, Narrator, and free AI tooling (preview); Ensemble coming soon (pre-release)
- Samples — runnable event sourcing and CQRS samples for the whole stack
Everything Cratis publishes today is MIT licensed and free to use.