dotnet-conventions
Skill9 starsChanged 8 days agoMITView on GitHub
C#/.NET naming, structure, and style conventions to apply when writing or reviewing C# code. Load before implementing or reviewing any .csproj-based feature.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- techmefr/mentistheir own version, first seen Sep 11, 2026
- dennisrongo/claude-skillstheir own version, first seen Aug 16, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- dennisrongo/claude-skills★ 1same name
- techmefr/mentis★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build-debugSkill
- comprehension-workflowSkill
- dev-cleanupSkill
- angular-patternsSkill
- python-conventionsSkill
- github-actions-cicdSkill
- npm-debugSkill
- structural-searchSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Use language keywords for built-in types (string, int) instead of runtime type names (String, Int32) [web:61].
- Very specific: line 19
Use int rather than unsigned types unless interop specifically requires it [web:61].
- Very specific: line 23
Use var only when the type is obvious from the right-hand side.
- Distinctive: line 24
Use modern language features (pattern matching, records, nullable reference types) over outdated constructs [web:61].
- Distinctive: line 25
Use LINQ for collection manipulation where it improves readability.
- Very specific: line 26
Use async/await for I/O-bound work.
- Distinctive: line 28
Keep methods short (aim under ~50 lines).
- Distinctive: line 34
Prefer dependency injection via constructor over static/service-locator patterns.
- Distinctive: line 35
Prefer the repository/service pattern already used in the codebase over introducing a new abstraction layer — check 2-3 existing services …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
.NET Conventions
Apply these conventions consistently. Prefer clarity and modern C# features over legacy patterns [web:61].
Naming
- PascalCase for types, methods, and public members.
- camelCase for local variables and parameters.
- Prefix interfaces with
I(e.g.,IRepository). - Prefix private fields with
_(e.g.,_httpClient). - Use language keywords for built-in types (
string,int) instead of runtime type names (String,Int32) [web:61]. - Use
intrather than unsigned types unless interop specifically requires it [web:61].
Style
- Use
varonly when the type is obvious from the right-hand side; otherwise use the explicit type [web:61]. - Use modern language features (pattern matching, records, nullable reference types) over outdated constructs [web:61].
- Use LINQ for collection manipulation where it improves readability; avoid LINQ chains so long they hurt readability.
- Use
async/awaitfor I/O-bound work; be careful withConfigureAwaitin library code to avoid deadlocks [web:61]. - Catch specific exception types with meaningful messages; do not catch bare
Exceptionwithout a filter [web:61]. - Keep methods short (aim under ~50 lines); if a method grows past that, extract private helper methods.
Structure
- One primary type per file; file name matches the type name.
- Group namespace imports alphabetically,
System.*first, at the top of the file, outside the namespace block. - Prefer dependency injection via constructor over static/service-locator patterns.
- Prefer the repository/service pattern already used in the codebase over introducing a new abstraction layer — check 2-3 existing services before adding a new pattern.
When Reviewing
Flag violations of the above, but prioritize behavior-affecting issues (nullability bugs, unawaited tasks, exception swallowing) over pure style nits.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

