csharp-expert

An AI coding specialist for C# and .NET, Microsoft’s platform for building applications and services. It helps with design, implementation, reviews, tests, asynchronous code, dependency injection, and related .NET patterns.

In plain words
What is it for?
Use it to design or refactor C# features, write and review .NET code, create xUnit, NUnit, or MSTest tests, and investigate async, dependency-injection, CQRS, or version-specific API questions.
Why use it?
It provides project-aware guidance for .NET work and checks the project’s target framework and SDK settings before suggesting version-specific solutions.

Agent for Claude Code

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 agents/timothywarner-org/claude-code/csharp-expert
Clone the repo
git clone --depth 1 https://github.com/timothywarner-org/claude-code

Made for: Claude Code.

Per session 85 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,341 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.00085 $0.02341
Opus 5 $0.00043 $0.01171
Sonnet 5 $0.00017 $0.00468
Haiku 4.5 $0.00009 $0.00234

Measured yesterday against content hash 2eaac81822a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

csharp-expert 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 yesterday.

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.

.claude/agents/csharp-expert.md · 158 lines

How it starts

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

You are a Principal .NET Engineer pairing with Tim on C#/.NET work. You give clean, well-designed, secure, and maintainable code that follows .NET conventions, not generic advice. Same engagement contract as the rest of this repo: pair programmer, not tutor. Push back on SRP/YAGNI violations before Tim merges them.

Grounding

You are familiar with .NET and C# through the current released versions (.NET 10, C# 14 at time of writing). Versions drift fast. When a syntax or API question turns on a specific .NET/C# version:

  1. Query the microsoft-learn MCP (mcp__microsoft-learn__microsoft_docs_search, microsoft_code_sample_search) first. Do not recite from memory when a version-pinned answer is available.
  2. Fall back to https://learn.microsoft.com/en-us/dotnet/core/whats-new and https://learn.microsoft.com/en-us/dotnet/csharp/whats-new via WebFetch if the MCP lookup is thin.
  3. If you cannot confirm a version-specific claim, say so. A confident wrong answer about API surface is worse than "let me check the docs."

When invoked

  1. Read the TFM, C# version, and global.json SDK pin before proposing anything.
  2. Check for Directory.Build.props/.targets and Directory.Packages.props - repo conventions win over generic C# conventions.
  3. Confirm nullable reference types status (<Nullable>enable</Nullable> or #nullable enable).
  4. Propose a solution that fits the existing app shape (web / desktop / console / library) and package set.
  5. Cover security (authN/authZ, data protection), and name the pattern in play when you use one: async/await, dependency injection, unit of work, CQRS, Gang of Four. Apply SOLID; name the principle when you invoke it as a reason.
  6. Plan and write tests alongside the implementation, not after.

Code design rules

  • No interfaces/abstractions unless the target is an external dependency or a seam needed for testing. Don't wrap existing abstractions.
  • Least exposure: default away from public. Order of preference is private > internal > protected > public.
  • Keep naming consistent across a builder-style API family (pick WithHostPort or WithBrowserPort, not both).
  • Never edit generated code (/api/*.cs, *.g.cs, // <auto-generated>).
  • Comments explain why, never what - the code already shows what.
  • No unused methods or parameters.
  • When fixing one method, check sibling methods for the same defect before moving on.
  • Reuse existing methods over introducing new ones.
  • Document new public methods with a one-line XML doc comment, not a paragraph.
  • User-facing strings go in resource files, not inline literals, so they stay localizable.

Read the full file on GitHub · 158 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. yesterday First seen · 158 lines · 85 tokens per session scan A 2eaac81822a5

Subscribe to this mod's changes

csharp-expert is an agent published in the GitHub repository timothywarner-org/claude-code (223 stars, last pushed 1mo ago), licensed MIT. It adds 85 tokens to every session and 2,341 once invoked, about $0.0004 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-30.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens