dotnet-core

dotnet-core is a cursor rule for coding agents from adonai-labs/agent-runway. It costs 0 tokens per session (1,754 once invoked), scanned A, original, MIT.

A collection of .NET and C# development guidelines covering naming, asynchronous code, dependency injection, database access with EF Core, errors, configuration, security, testing, and performance.

In plain words
What is it for?
Use it while writing or reviewing .NET Core and C# code, including APIs, services, data access, configuration, and tests.
Why use it?
It keeps .NET and C# code consistent and guides common implementation choices across a project.

Cursor rule

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.

agentmods
npx agentmods add rules/adonai-labs/agent-runway/dotnet-core
Clone the repo
git clone --depth 1 https://github.com/adonai-labs/agent-runway

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-core

README.md
[![agentmods](https://agentmods.dev/badge/rules/adonai-labs/agent-runway/dotnet-core.svg)](https://agentmods.dev/rules/adonai-labs/agent-runway/dotnet-core)
Your own site
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/dotnet-core"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/dotnet-core.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,754 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.01754
Opus 5 $0.00000 $0.00877
Sonnet 5 $0.00000 $0.00351
Haiku 4.5 $0.00000 $0.00175

Measured 4d ago against content hash 1cde6a8bb9c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

dotnet-core 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 4d 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-core.mdc · 119 lines

How it starts

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

.NET and C# Development Guidelines

Directives for .NET Core and C# development. Use Australian English spelling throughout.

Naming Conventions

  • Public members: PascalCase (classes, methods, properties, constants)
  • Private fields: camelCase with leading underscore (_userRepository)
  • Constants: UPPER_CASE or PascalCase for public API constants
  • Interfaces: Prefix with I (e.g. IUserRepository)
  • Async methods: Suffix with Async (e.g. GetUserByIdAsync)
  • File names: Match primary type (e.g. UserService.cs)

Modern C# Features

  • Records: Prefer records for immutable DTOs, value objects, and API responses. Use positional syntax for simple data; add computed properties or with expressions when needed.
  • Pattern matching: Use switch expressions and property patterns instead of long if-else chains. Prefer pattern matching in exception handlers for mapping to HTTP status codes.
  • Nullable reference types: Enable <Nullable>enable</Nullable>. Use T? for optional returns; avoid null! except where framework requires it. Validate constructor parameters with ?? throw new ArgumentNullException(nameof(param)).
  • Primary constructors: Use for DI-injected services and simple DTOs where it reduces boilerplate.

Async/Await Rules

  • Use async/await for all I/O (database, HTTP, file system). Never use .Result or .Wait() — they block and can deadlock.
  • Use Task.WhenAll for independent parallel operations; avoid sequential awaits when operations are independent.
  • Use ConfigureAwait(false) only in library code, not in ASP.NET Core request handlers.
  • Never use async void except for event handlers.

Dependency Injection

  • Register services by interface. Use AddScoped for DbContext and request-scoped services; AddSingleton for caches and configuration; AddTransient for stateless, lightweight services.
  • Prefer constructor injection. Validate dependencies with ?? throw new ArgumentNullException(nameof(x)).
  • Use extension methods (e.g. AddApplicationServices) to group registrations.

Read the full file on GitHub · 119 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. 4d ago First seen · 119 lines · 0 tokens per session scan A 1cde6a8bb9c4

Subscribe to this mod's changes

dotnet-core is a cursor rule published in the GitHub repository adonai-labs/agent-runway (2 stars, last pushed 14d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,754 tokens. 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.