csharp-conventions

csharp-conventions is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 126 tokens per session (2,152 once invoked), scanned A, original, Apache-2.0.

A guide for writing modern C# and .NET code, including web services, libraries, and background programs. C# is a programming language, and .NET is the platform commonly used to run it.

In plain words
What is it for?
Use it when adding or changing C#/.NET classes, services, workers, models, configuration, or tests.
Why use it?
It keeps code aligned with the project's type-safety, asynchronous programming, dependency injection, testing, and code-analysis rules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or changing C#/.NET classes, services, workers, models, configuration, or tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/csharp-conventions
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.

Any agent
npx skills add tmj-90/gaffer --skill csharp-conventions
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

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 csharp-conventions

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/csharp-conventions/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/csharp-conventions)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/csharp-conventions"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/csharp-conventions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for csharp-conventions

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/csharp-conventions"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/csharp-conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 126 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,152 The whole file, excluding the scripts and references it only reads on demand.
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.00126 $0.02152
Opus 5.5 $0.00050 $0.00861
Sonnet 5.5 $0.00025 $0.00430
Haiku 4.5 $0.00013 $0.00215

Measured 16d ago against content hash 6794f1c4fa05, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

csharp-conventions 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 16d 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.

runner/skills/csharp-conventions/SKILL.md · 129 lines

How it starts

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

Write idiomatic modern C#

Modern C# puts nullability in the type system, values in records, and asynchrony in a first-class model with cancellation. Code that suppresses warnings, blocks on tasks, or news up its dependencies gives that back. For the builder and the reviewer of a .NET diff; the solution's config and existing code win over it.

Procedure

  1. Discover the solution's conventions first. Call search_lore for .NET conventions. Read global.json (SDK pin), Directory.Build.props and Directory.Packages.props (central package versions; a new or bumped package is a blocker, see the dependency-upgrade skill), the .csproj (TargetFramework, LangVersion, Nullable, TreatWarningsAsErrors, AnalysisLevel/AnalysisMode, ImplicitUsings), .editorconfig (naming and diagnostic severities), .config/dotnet-tools.json, and the CI workflow. Identify the test framework (xUnit v2/v3, NUnit, MSTest), assertion and mocking libraries, the error policy (exceptions vs a Result type) and minimal APIs vs controllers. Copy a sibling class and its test.
  2. Pin the exact commands from CI (the run-tests and run-lint skills). Use the defaults below only when the repo defines none.
  3. Write the change with the idioms below, then walk the concurrency section for every task, disposable, shared field, DbContext and outbound call you touched.
  4. Test each acceptance criterion's own behaviour. One test (or [Theory] row) per AC that fails without your change, plus its error path; WebApplicationFactory for API behaviour. If the AC involves shared state or persistence, add a test that runs N concurrent calls (Task.WhenAll over Enumerable.Range) and asserts the invariant. Use TimeProvider/FakeTimeProvider instead of real delays.
  5. Verify, then stop. Done when: the build has no new warnings at the configured level, dotnet format --verify-no-changes --no-restore is clean, tests are green, and every AC has a test. Record the output with the record-evidence skill; the runner submits the work.

Read the full file on GitHub · 129 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. 16d ago Changed · +53 lines · +22 tokens per session 6794f1c4fa05
  2. 19d ago First seen · 76 lines · 104 tokens per session scan A 85b0c499e359

Subscribe to this mod's changes

csharp-conventions is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 126 tokens to every session and 2,152 once invoked, about $0.0005 per session on Opus 5.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-09-28.

Related

Other skills, from other repositories

sota-dotnet

State-of-the-art C# / .NET engineering rules (.NET LTS releases, modern C#) that Claude applies when writing or auditing .NET code. Covers modern idioms (records, nullable reference types, pattern matching, spans, file-scoped namespaces), API/null/immutability/IDisposable design, async/await & concurrency…

martinholovsky/SOTA-skills · 238 tokens

aspnet-core

Guidelines for ASP.NET Core web development covering API design, authentication, caching, and best practices.

Mindrally/skills · 23 tokens

blazor

Guidelines for Blazor development including component lifecycle, state management, and performance optimization.

Mindrally/skills · 19 tokens

dotnet

Guidelines for .NET backend development with C#, ASP.NET Core, and Entity Framework Core.

Mindrally/skills · 21 tokens

unity-project-architecture

Use when writing or restructuring Unity C# code - assembly definitions and dependency direction, small components with cached references, ScriptableObjects for data and events, DI instead of singletons, Input System, Addressables, serialization safety and Unity 6 API changes.

makifbaysal/tasktrooper · 56 tokens

godot-csharp-and-gdextension

Use when a Godot project uses or considers C# (.NET) or native code - when C# is the right call and its export limits (no web export), C# node patterns with generated SignalName/StringName caching, plain C# rule libraries tested with dotnet test, and GDExtension (godot-cpp, godot-rust) pinning and build hygiene.

makifbaysal/tasktrooper · 88 tokens