C# Coding Practices
Application skill for C# /.NET style learning (from the archived awesome-guidelines style capsules). For ASP.NET/Blazor/MAUI patterns, load stack capsules in skills/*-foundation.
Core Principle
C# readability is Framework Design naming plus modern idioms enforced by EditorConfig/analyzers, explicit public API, safe boolean ops, specific exceptions.
When to Use / NOT
- C# application/library source,
.editorconfig, Roslyn analyzers, dotnet format CI.
- Reviewing naming, layout, modern syntax, exception handling, XML docs.
NOT when:
- Non-C# code.
- Generated designer files, validate generators instead.
- F# / VB, different language conventions.
Workflow
- Format & layout, Allman braces, file-scoped namespace, usings (
csharp-style-formatting-layout.md).
- Naming, Pascal/camel, interfaces, suffixes (
csharp-style-naming-types.md).
- Modern idioms, var, collections, strings, required (
csharp-style-modern-idioms.md).
- Exceptions & API, catch, using, statics, XML docs (
csharp-style-exceptions-api.md).
- Verify,
dotnet format, analyzer warnings as errors, tests on changed projects.
Red Flags
using inside namespace without global::
- Tabs or wrong brace style for project
- Hungarian notation or underscores in names
catch (Exception) without strategy
var when type not obvious
&/| for boolean conditions
- Static call via derived type name
- Public API without XML summary
StatusEnum / prefixed enum values
Verification
dotnet format --verify-no-changes on changed projects
- Analyzer/StyleCop/IDE rules per
.editorconfig
- Capsule checklist on public API review
References
awesome-guidelines/references/csharp-style-learning-note.md
awesome-guidelines/references/csharp-style-formatting-layout.md
awesome-guidelines/references/csharp-style-naming-types.md
awesome-guidelines/references/csharp-style-modern-idioms.md
awesome-guidelines/references/csharp-style-exceptions-api.md
1---2name: csharp-coding-practices3description: Use when authoring or reviewing C#, Allman 4-space layout, file-scoped namespaces, Framework Design naming, modern C# idioms, specific exception handling, and XML docs on public API.4---56# C# Coding Practices78Application skill for C# /.NET style learning (from the archived `awesome-guidelines` style capsules). For ASP.NET/Blazor/MAUI patterns, load stack capsules in `skills/*-foundation`.910## Core Principle1112C# readability is **Framework Design naming plus modern idioms enforced by EditorConfig/analyzers**, explicit public API, safe boolean ops, specific exceptions.1314## When to Use / NOT1516- C# application/library source, `.editorconfig`, Roslyn analyzers, `dotnet format` CI.17- Reviewing naming, layout, modern syntax, exception handling, XML docs.1819**NOT when:**2021- Non-C# code.22- Generated designer files, validate generators instead.23- F# / VB, different language conventions.2425## Workflow26271. **Format & layout**, Allman braces, file-scoped namespace, usings (`csharp-style-formatting-layout.md`).282. **Naming**, Pascal/camel, interfaces, suffixes (`csharp-style-naming-types.md`).293. **Modern idioms**, var, collections, strings, required (`csharp-style-modern-idioms.md`).304. **Exceptions & API**, catch, using, statics, XML docs (`csharp-style-exceptions-api.md`).315. **Verify**, `dotnet format`, analyzer warnings as errors, tests on changed projects.3233## Red Flags3435- `using` inside namespace without `global::`36- Tabs or wrong brace style for project37- Hungarian notation or underscores in names38- `catch (Exception)` without strategy39- `var` when type not obvious40- `&`/`|` for boolean conditions41- Static call via derived type name42- Public API without XML summary43- `StatusEnum` / prefixed enum values4445## Verification4647- `dotnet format --verify-no-changes` on changed projects48- Analyzer/StyleCop/IDE rules per `.editorconfig`49- Capsule checklist on public API review505152## References5354- `awesome-guidelines/references/csharp-style-learning-note.md`55- `awesome-guidelines/references/csharp-style-formatting-layout.md`56- `awesome-guidelines/references/csharp-style-naming-types.md`57- `awesome-guidelines/references/csharp-style-modern-idioms.md`58- `awesome-guidelines/references/csharp-style-exceptions-api.md`