- .NET 8+ C# 12, file-scoped namespaces, primary constructors,
<Nullable>enable</Nullable>. - Formatting:
dotnet format+ Roslyn analyzers,<TreatWarningsAsErrors>true</TreatWarningsAsErrors>. - Style enforcement:
.editorconfigfor consistent rules across team. Use an analyzer set (e.g., StyleCop.Analyzers or Roslynator). - Testing: xUnit with
[Theory]/[InlineData], an assertion library (e.g., FluentAssertions), a coverage tool (e.g., coverlet) at 80%+. - Benchmarking: a benchmark harness (e.g., BenchmarkDotNet) for performance testing — never
Stopwatchloops. recordtypes for immutable data,requiredproperties, pattern matching in switch expressions.- Async:
async/awaitthroughout — never.Resultor.Wait(),ValueTaskfor hot paths, avoid deadlocks. - Security:
dotnet list package --vulnerablefor CVE scanning. Zero tolerance for critical/high. - Dependencies: NuGet
PackageReference, commitpackages.lock.json,Directory.Build.propsfor shared config. - Collection expressions (
[1, 2, 3]),requiredmodifier, raw string literals for multi-line. - Anti-patterns:
dynamic,objectparams, unguardedcatch (Exception),#pragma warning disable.
Csharp Conventions
C# code conventions covering .NET 8+/C# 12, nullable reference types, Roslyn analyzers, xUnit, record types, async/await discipline, and dependency security. Load when writing or reviewing C# code.
Csharp Conventions by goldziher · 45047fe
npx skillmds@latest add goldziher/csharp-conventions File contents
---name: csharp-conventionsdescription: C# code conventions covering .NET 8+/C# 12, nullable reference types, Roslyn analyzers, xUnit, record types, async/await discipline, and dependency security. Load when writing or reviewing C# code.---- .NET 8+ C# 12, file-scoped namespaces, primary constructors, `<Nullable>enable</Nullable>`.- Formatting: `dotnet format` + Roslyn analyzers, `<TreatWarningsAsErrors>true</TreatWarningsAsErrors>`.- Style enforcement: `.editorconfig` for consistent rules across team. Use an analyzer set (e.g., StyleCop.Analyzers or Roslynator).- Testing: xUnit with `[Theory]`/`[InlineData]`, an assertion library (e.g., FluentAssertions), a coverage tool (e.g., coverlet) at 80%+.- Benchmarking: a benchmark harness (e.g., BenchmarkDotNet) for performance testing — never `Stopwatch` loops.- `record` types for immutable data, `required` properties, pattern matching in switch expressions.- Async: `async`/`await` throughout — never `.Result` or `.Wait()`, `ValueTask` for hot paths, avoid deadlocks.- Security: `dotnet list package --vulnerable` for CVE scanning. Zero tolerance for critical/high.- Dependencies: NuGet `PackageReference`, commit `packages.lock.json`, `Directory.Build.props` for shared config.- Collection expressions (`[1, 2, 3]`), `required` modifier, raw string literals for multi-line.- Anti-patterns: `dynamic`, `object` params, unguarded `catch (Exception)`, `#pragma warning disable`.
goldziher/ai-rulez/tree/main/internal/builtins/languages/csharp/skills/csharp-conventions commit 45047fe7eb
Frequently asked questions
Run npx skillmds@latest add goldziher/csharp-conventions in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
C# code conventions covering .NET 8+/C# 12, nullable reference types, Roslyn analyzers, xUnit, record types, async/await discipline, and dependency security. Load when writing or reviewing C# code. It is listed under Security on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
goldziher (@goldziher) published this skill. Their other Agent Skills are listed on their SkillMD profile.