agentleFS
LeanMeanCleanAppsLeanMeanCleanApps/CleanModelContextProtocol/.agents/skills/csharp-house-style/SKILL.md

csharp-house-style

Skill1 starsChanged 6 days agoMITView on GitHub

The house C# style enforced by .editorconfig and the build - this. qualification, usings inside file-scoped namespaces, discards, regions, primary constructors, nullable and naming. Use whenever writing or reviewing C# in this solution.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write the code to match a neighbouring file.

    line 32
  2. Very specific:

    Run dotnet format to fix whitespace and using order.

    line 33
  3. Very specific:

    Run dotnet build and fix every warning.

    line 34
  4. Very specific:

    Add #pragma warning disable or <NoWarn> to quiet an analyser.

    line 39
  5. Distinctive:

    Leave unused usings; IDE0005 fails the build.

    line 41

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

C# house style

The rule

.editorconfig holds the style and the build enforces it (EnforceCodeStyleInBuild, AnalysisLevel latest-recommended, TreatWarningsAsErrors, all in Directory.Build.props). If the build is clean and dotnet format --verify-no-changes passes, the style is right. These are the parts that differ from most .NET code, so they're the ones people trip on.

RuleLooks like
File-scoped namespace first, then using directives inside itnamespace X.Y; then using Mediator;
Qualify members with this.this.context.Reviews, this.RuleFor(...)
Discard unused results with _ =_ = services.AddScoped<...>();
var everywherevar result = ...
Braces on every if, Allman styleopening brace on its own line
Block bodies for methods and constructorsno => expression methods
Primary constructors for injected servicespublic class XHandler(IRepo repository)
#region to group long classes#region Authors ... #endregion Authors
Nullable reference types onstring? when null is a real value
Collection expressions[.. result.Select(...)], List<T> x = [];
Async methods return ValueTask in handlers, Task in repositoriesas the interfaces declare

Naming: PascalCase types and members, camelCase locals and parameters, no underscores on fields (this. tells you it's a field). Interfaces start with I.

Steps

  1. Write the code to match a neighbouring file.
  2. Run dotnet format to fix whitespace and using order.
  3. Run dotnet build and fix every warning. Nullable warnings are fixed with real null handling, not !, except for EF navigation properties (= null!).

Don't

  • Move usings above the namespace or drop this. to match another codebase.
  • Add #pragma warning disable or <NoWarn> to quiet an analyser.
  • Use _camelCase fields.
  • Leave unused usings; IDE0005 fails the build.

Check

dotnet format --verify-no-changes
dotnet build

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.