csharp-docs
Skill2 starsChanged 42 days agoMITView on GitHub
Use when writing or reviewing C# XML documentation comments. Produces concise docs that state what a member does - no remarks unless unusual behavior is method-wide and not obvious from the code, inline comments at the confusing statement instead, nothing about past implementations, no cref/example/see-langword spam.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- github/awesome-copilottheir own version, first seen Oct 25, 2026
- itsfatduck/optimizerDucktheir own version, first seen Oct 8, 2026
- RorroRojas3/maf-agentstheir own version, first seen Sep 10, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- github/awesome-copilot★ 41ksame name
- itsfatduck/optimizerDuck★ 11ksame name
- RorroRojas3/maf-agents★ 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 repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- benchmarkingSkill
- commit-messagesSkill
- csharp-15-syntaxSkill
- csharp-aot-trimmingSkill
- csharp-api-designSkill
- csharp-assembly-inspectionSkill
- csharp-asyncSkill
- csharp-collections-modernSkill
- csharp-concurrency-primitivesSkill
- csharp-data-layoutSkill
- csharp-debuggingSkill
- csharp-discardsSkill
- csharp-disposable-patternsSkill
- csharp-error-handlingSkill
- csharp-extension-membersSkill
- csharp-generics-modernSkill
- csharp-guard-clausesSkill
- csharp-json-source-generationSkill
- csharp-language-versionsSkill
- csharp-logging-diagnosticsSkill
- csharp-lspSkill
- csharp-modern-typesSkill
- csharp-nullabilitySkill
- csharp-nullable-migrationSkill
- csharp-nunitSkill
- csharp-pattern-matchingSkill
- csharp-performanceSkill
- csharp-polyfillsSkill
- csharp-source-generatorsSkill
- csharp-static-lambdasSkill
- csharp-string-handlingSkill
- csharp-tunitSkill
- csharp-verificationSkill
- dispatching-subagentsSkill
- dotnet-11-librariesSkill
- dotnet-analyzersSkill
- dotnet-central-package-managementSkill
- dotnet-file-based-appsSkill
- dotnet-msbuild-usingsSkill
- dotnet-multi-targetingSkill
- dotnet-project-hygieneSkill
- dotnet-runSkill
- dotnet-runtime-asyncSkill
- dotnet-slnxSkill
- dotnet-test-platformsSkill
- executing-plansSkill
- performance-bounded-deduplicationSkill
- roslyn-analyzer-performanceSkill
- roslyn-discoverySkill
- roslyn-duplicate-detectionSkill
- roslyn-guard-rewritersSkill
- roslyn-rewritersSkill
- subagent-driven-developmentSkill
- tddSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
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 12
Before writing, ask: "Does this tell the reader something the signature doesn't?" If no, either the name needs fixing or the comment isn't …
- Distinctive: line 14
Document, in priority order: the contract (what's guaranteed, what's required), non-obvious behavior (side effects, throwing conditions, …
- Very specific: line 53
Document a <param> when it adds info (units, valid range, null behavior, ownership).
- Very specific: line 55
Document <exception> for exceptions a caller should reasonably catch or guard against — ArgumentNullException, domain-specific failures.
- Very specific: line 65
Examples for trivial APIs: If Add(a, b) needs an example, the name is the problem.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
C# XML docs — concise and meaningful
Good docs tell a caller what the signature can't: the contract, the surprising behavior, the why. They are not a restatement of the method name in a full sentence. Write less; mean more.
The bar for every doc comment
Before writing, ask: "Does this tell the reader something the signature doesn't?" If no, either the name needs fixing or the comment isn't worth writing. public void Save() does not need <summary>Saves.</summary>.
Document, in priority order: the contract (what's guaranteed, what's required), non-obvious behavior (side effects, throwing conditions, null handling, threading), and why when the reason isn't evident. Skip the obvious.
The readers are experts in the platform the code targets - Roslyn, the UI frameworks, Rx. Don't teach them what they already read fluently. We are writing a library, not a thesis.
Inline comments over remarks
Where code is genuinely confusing, put a short // comment on the confusing statement. That is the reference form: it sits exactly where the reader is stuck, and it leaves with the code it explains. A <remarks> block describing the implementation from a distance is the wrong tool for the same job; a remark is only for unusual behavior that is method-wide and cannot be seen from the code itself.
// InvokeRequired is false until the control or a parent has a handle, so this runs inline until then.
if (!control.InvokeRequired)Summaries
One sentence, present-tense, third-person. State what it does / returns, not how it is implemented.
Where an analyzer requires docs on every element - a summary, a <param> per parameter, <returns> - those required elements stay, and each is one concise line saying what the member does.
/// <summary>Returns the cached user, fetching from the store on a miss.</summary>
public User GetUser(Guid id) { ... }Conventions worth keeping (they read naturally and tools expect them):
- Properties:
Gets the …(read-only) /Gets or sets the …(read-write). - Constructors:
Initializes a new instance of the <see cref="Thing"/> class. - Bool params/returns:
trueto …; otherwise,false.
Use the heavyweight tags sparingly — that's the whole point
<remarks>— removed by default. Keep one only when the unusual behavior spans the whole method (or type) and is not obvious from reading the code itself. Unusual behavior confined to one statement or branch is an inline//comment on that statement, never a remark. When reviewing, delete every remark that does not meet that bar. Most members, and most types, have none.<example>— only when usage is genuinely non-obvious from the signature. A trivial call is not an example. Never add one just to fill a section.<see cref="..."/>— link the first, most relevant reference, not every type you mention. Crefs are clickable noise when overused; a paragraph with five of them is unreadable. Link what the reader would actually navigate to.<see langword="null|true|false|async"/>— fine occasionally for real keywords; don't langword-wrap every "null" and "true" in the prose. Plain backticks-in-prose intent is enough most of the time.<paramref>/<typeparamref>— use when you genuinely refer to a parameter by name in prose.
Params, returns, exceptions
Document a <param> when it adds info (units, valid range, null behavior, ownership). Don't write <param name="id">The id.</param> — that's noise; omit it or say something real (The user id; must not be <see cref="Guid.Empty"/>.). Same for <returns>: describe meaning and edge cases (what an empty/null result means), not "the result."
Document <exception> for exceptions a caller should reasonably catch or guard against — ArgumentNullException, domain-specific failures. Don't enumerate every theoretically-possible throw.
What to avoid
- Novels. A
<summary>that runs three sentences is usually two too many. Cut the rest; if one point is truly confusing, it becomes an inline comment where the confusion is. - History. Comments describe the code as it is now — never mention how it used to work, what it replaced, which approach was tried first, or why an older design was dropped. Banned words: "now", "previously", "used to", "already", "no longer", "still", "as before", "originally". A reader six months out has no interest in the journey, only the current state.
- Comments on something absent. A comment explaining why a property is missing, a flag is off, or an approach was rejected describes the change, not the code — absent code cannot confuse a reader, so it never earns a comment.
- Implementation narration. A summary that walks through the steps the body takes. The body already says that.
- Restating the obvious.
<param name="count">The count.</param>,<summary>Gets or sets the Name.</summary>on a property literally calledNamewith an obvious meaning. - cref / see-langword spam. Decoration that hurts readability.
- Examples for trivial APIs. If
Add(a, b)needs an example, the name is the problem. - Doc'ing private trivia. Public/protected API earns docs; private helpers earn a good name and an occasional
//only where logic is subtle. Where an analyzer forces docs on private members, give them one line and nothing more.
Quick test
A reviewer should be able to read the comment in two seconds and learn something. If they'd skim past it because it just echoes the code, delete it. The best XML doc comment is often shorter than the one you first wrote.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

