{"slug":"csharp-house-style-2","title":"csharp-house-style","summary":"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.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-27T19:09:08.47977Z","repo":{"url":"https://github.com/LeanMeanCleanApps/CleanGraphQLApi","stars":13,"forks":7,"license":"MIT","updatedAt":"2026-11-25T23:23:22Z"},"bodyHtml":"<hr>\n<h2>name: csharp-house-style\ndescription: 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.\nmetadata:\nscope: shared</h2>\n<h1>C# house style</h1>\n<h2>The rule</h2>\n<p><code>.editorconfig</code> holds the style and the build enforces it (<code>EnforceCodeStyleInBuild</code>, <code>AnalysisLevel</code> <code>latest-recommended</code>, <code>TreatWarningsAsErrors</code>, all in <code>Directory.Build.props</code>). If the build is clean and <code>dotnet format --verify-no-changes</code> passes, the style is right. These are the parts that differ from most .NET code, so they're the ones people trip on.</p>\n<table>\n<thead>\n<tr>\n<th>Rule</th>\n<th>Looks like</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>File-scoped namespace first, then <code>using</code> directives inside it</td>\n<td><code>namespace X.Y;</code> then <code>using Mediator;</code></td>\n</tr>\n<tr>\n<td>Qualify members with <code>this.</code></td>\n<td><code>this.context.Reviews</code>, <code>this.RuleFor(...)</code></td>\n</tr>\n<tr>\n<td>Discard unused results with <code>_ =</code></td>\n<td><code>_ = services.AddScoped&lt;...&gt;();</code></td>\n</tr>\n<tr>\n<td><code>var</code> everywhere</td>\n<td><code>var result = ...</code></td>\n</tr>\n<tr>\n<td>Braces on every <code>if</code>, Allman style</td>\n<td>opening brace on its own line</td>\n</tr>\n<tr>\n<td>Block bodies for methods and constructors</td>\n<td>no <code>=&gt; expression</code> methods</td>\n</tr>\n<tr>\n<td>Primary constructors for injected services</td>\n<td><code>public class XHandler(IRepo repository)</code></td>\n</tr>\n<tr>\n<td><code>#region</code> to group long classes</td>\n<td><code>#region Authors</code> ... <code>#endregion Authors</code></td>\n</tr>\n<tr>\n<td>Nullable reference types on</td>\n<td><code>string?</code> when null is a real value</td>\n</tr>\n<tr>\n<td>Collection expressions</td>\n<td><code>[.. result.Select(...)]</code>, <code>List&lt;T&gt; x = [];</code></td>\n</tr>\n<tr>\n<td>Async methods return <code>ValueTask</code> in handlers, <code>Task</code> in repositories</td>\n<td>as the interfaces declare</td>\n</tr>\n</tbody>\n</table>\n<p>Naming: PascalCase types and members, camelCase locals and parameters, no underscores on fields (<code>this.</code> tells you it's a field). Interfaces start with <code>I</code>.</p>\n<h2>Steps</h2>\n<ol>\n<li>Write the code to match a neighbouring file.</li>\n<li>Run <code>dotnet format</code> to fix whitespace and using order.</li>\n<li>Run <code>dotnet build</code> and fix every warning. Nullable warnings are fixed with real null handling, not <code>!</code>, except for EF navigation properties (<code>= null!</code>).</li>\n</ol>\n<h2>Don't</h2>\n<ul>\n<li>Move usings above the namespace or drop <code>this.</code> to match another codebase.</li>\n<li>Add <code>#pragma warning disable</code> or <code>&lt;NoWarn&gt;</code> to quiet an analyser.</li>\n<li>Use <code>_camelCase</code> fields.</li>\n<li>Leave unused usings; IDE0005 fails the build.</li>\n</ul>\n<h2>Check</h2>\n<pre><code>dotnet format --verify-no-changes\ndotnet build\n</code></pre>\n","files":[{"path":"SKILL.md","sizeBytes":2338,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-27T19:09:55.439512Z","sha256":"0BE8AC97C38A37669E5CC3692352E70CB8301D0BA92C9CEF79C00A0DF2A7E96B","sizeBytes":1337},"review":null,"source":{"repositoryUrl":"https://github.com/LeanMeanCleanApps/CleanGraphQLApi","path":".agents/skills/csharp-house-style","license":"MIT","commit":"1168fead2e0c8143a44bdce3344e0ab5fe1db90a","subtreeSha":"CC5534490E23F22B25AD6089249F77B94ABA35276FA36579BC938EBF75E985BB","lastSyncedAt":"2026-11-27T19:09:06.789278Z"},"reviewedAt":"2026-11-27T19:11:36.10003Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/LeanMeanCleanApps/CleanGraphQLApi/tree/main/.agents/skills/csharp-house-style"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install leanmeancleanapps-cleangraphqlapi@llmmart"},{"target":"git","command":"git clone https://github.com/LeanMeanCleanApps/CleanGraphQLApi.git"}]}