dotnet-architecture

dotnet-architecture is a cursor rule for Cursor from adonai-labs/agent-runway. It costs 1,187 tokens per session, scanned A, original, MIT.

A set of .NET architecture rules for organising application layers, features, infrastructure, deployment configuration, monitoring, and tests. It covers patterns such as CQRS, which separates commands that change data from queries that read it, and Clean Architecture, which keeps core business logic independent of external systems.

In plain words
What is it for?
Use it to structure .NET solutions, organise APIs and business logic, apply CQRS or MediatR, define infrastructure with Bicep or Terraform, add monitoring, and plan testing.
Why use it?
It helps teams keep dependencies and responsibilities clear as a .NET system grows. It also provides consistent guidance for cloud infrastructure, observability, and testing.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to structure .NET solutions, organise APIs and business logic, apply CQRS or MediatR, define infrastructure with Bicep or Terraform, add monitoring, and plan testing.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/adonai-labs/agent-runway/dotnet-architecture
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/adonai-labs/agent-runway

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dotnet-architecture

README.md
[![agentmods](https://agentmods.dev/badge/rules/adonai-labs/agent-runway/dotnet-architecture.svg)](https://agentmods.dev/rules/adonai-labs/agent-runway/dotnet-architecture)
Your own site
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/dotnet-architecture"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/dotnet-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,187 This file is loaded in full into every session.
When invoked 1,187 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01187 $0.01187
Opus 5 $0.00593 $0.00593
Sonnet 5 $0.00237 $0.00237
Haiku 4.5 $0.00119 $0.00119

Measured 7d ago against content hash ae0bb8979467, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

dotnet-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/stacks/dotnet/dotnet-architecture.mdc · 153 lines

How it starts

The opening of the file, as written. The whole thing — 153 lines — stays where its author put it; the contents beside it link to each section on GitHub.

.NET Architecture Standards

.NET-specific structural standards. For universal architecture principles, see engineering-architecture.mdc.

Conflict resolution: Where this file provides .NET-specific guidance that differs from engineering-architecture.mdc, this file takes precedence for .cs, .csproj, .sln, .bicep, .tf, .yaml, and .yml files. The universal rule provides the default; this rule provides the override.


Clean Architecture in .NET

Dependency direction: outer layers depend on inner layers; inner layers have no knowledge of outer layers.

Presentation (Api)  →  Application  →  Domain
Infrastructure                      →  Domain
Infrastructure                      →  Application (interfaces)

Domain — entities, value objects, domain events, domain exceptions. No framework dependencies.

Application — commands, queries (CQRS), handlers, validators, application exceptions, IRepository interfaces. No infrastructure imports.

Infrastructure — EF Core, message brokers, HTTP clients, external service adapters, DI registration.

Presentation (Api) — controllers, Minimal API endpoints, middleware, global error handler, request/response mapping.


CQRS and MediatR

  • Commands: change state, enforce domain rules, return Result<T> or void
  • Queries: read-only, project to consumer DTOs, use AsNoTracking()
  • Register pipeline behaviours: ValidationBehavior, LoggingBehavior, TransactionBehavior
  • Never return domain entities from handlers; return identifiers or DTOs
// Command
public record PlaceOrderCommand(Guid CustomerId, IReadOnlyList<OrderLineDto> Lines)
    : IRequest<Result<Guid>>;

// Query
public record GetOrderByIdQuery(Guid OrderId) : IRequest<OrderDetailDto?>;

Feature-first organisation

Organise by feature, not by technical role:

Application/
├── Orders/
│   ├── Commands/PlaceOrder/
│   │   ├── PlaceOrderCommand.cs
│   │   ├── PlaceOrderCommandHandler.cs
│   │   └── PlaceOrderCommandValidator.cs
│   └── Queries/GetOrderById/
│       ├── GetOrderByIdQuery.cs
│       ├── GetOrderByIdQueryHandler.cs
│       └── OrderDetailDto.cs
└── Common/
    ├── Behaviours/
    └── Exceptions/

Read the full file on GitHub · 153 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 153 lines · 1,187 tokens per session scan A ae0bb8979467

Subscribe to this mod's changes

dotnet-architecture is a cursor rule published in the GitHub repository adonai-labs/agent-runway (2 stars, last pushed 17d ago), licensed MIT. It adds 1,187 tokens to every session, about $0.0059 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.