This rule file summarizes the C#-specific policies for this repository.
Toolchain
Formatting — CSharpier: All C# source files must be formatted with CSharpier. Do not use dotnet format. Command: dotnet tool run csharpier . or csharpier .
Run the toolchain in order: format → lint → type-check → test. Restart from step 1 if any step fails or changes files.
Coding Standards
Naming: PascalCase for types and public members. camelCase for locals and private fields/parameters.
Null safety: Keep nullable reference types enabled. Model optional values with nullable annotations and guard clauses.
Composition over inheritance: Keep classes cohesive and scoped to one responsibility. Favor composition unless polymorphism is a clear requirement.
Async/await: Use async/await for I/O-bound operations. Prefer using/await using for disposable resources.
Exceptions: Fail fast with explicit exceptions. Avoid broad catch (Exception) unless at a defined boundary with added context.
Public surface: Keep public API surface intentional and minimal. Prefer internal for non-public APIs.
XML docs: Public APIs should include XML documentation comments when behavior or contract is non-obvious.
Testing Standards
Use MSTest (Microsoft.VisualStudio.TestTools.UnitTesting) as the test framework.
Use Moq for mocking.
Prefer FluentAssertions for assertions; use MSTest Assert only when FluentAssertions is not practical.
Use [TestClass] and [TestMethod] attributes.
Follow Arrange–Act–Assert structure.
No external dependencies in unit tests.
Repository-wide line coverage must remain >= 80%.
Any new module, class, or method must reach >= 90% coverage.
Coverage regression on changed lines is a blocking finding.
Deterministic Test Rules
Unit tests must not depend on network, mutable machine PATH or profile state, implicit working-directory assumptions, or external services. Use seam-based mocking for all external boundaries (processes, HTTP, filesystem, clocks). Tests must produce identical results in the IDE test runner and in CLI runs so local and CI behavior agree.
DI Seams
Introduce the smallest seam that enables reliable unit testing. Apply in this order of preference:
Interface seam (preferred) — extract boundary calls into narrow purpose-specific interfaces (for example, IProcessRunner, IFileSystem, IClock). Keep interfaces minimal.
Injectable delegate seam — use a narrow Func<>/Action<> delegate for a single call path when a full interface is excessive. Default behavior must remain safe and deterministic.
Adapter seam for static or third-party APIs — wrap the static or third-party call behind a small adapter so tests can mock the adapter with Moq.
Prohibited Behaviors
Broad refactors across unrelated projects or files.
Introducing heavy generic abstraction frameworks without need.
Creating analyzer debt and deferring cleanup.
Weakening assertions or relaxing test expectations to make tests pass.
Adding sleeps, retries, or timing hacks to mask flaky behavior.
Reporting success without running the required toolchain.
1---2name: csharp-53description: Converted skill4---5# Converted skill67Applied rewrites:8- None910---11paths:12 - "**/*.cs"13 - "**/*.csproj"14description: C#-specific toolchain and coding standards.15---1617# C# Code Standards1819This rule file summarizes the C#-specific policies for this repository.2021## Toolchain22231. **Formatting — CSharpier**: All C# source files must be formatted with CSharpier. Do not use `dotnet format`. Command: `dotnet tool run csharpier .` or `csharpier .`242. **Linting — .NET Analyzers**: C# code must pass Roslyn/.NET analyzer diagnostics. Command: `msbuild TaskMaster.sln /t:Build /p:Configuration=Debug /p:Platform="Any CPU" /p:EnableNETAnalyzers=true /p:EnforceCodeStyleInBuild=true`253. **Type Checking — Nullable Analysis**: Enable nullable reference types and fail on warnings. Command: `msbuild TaskMaster.sln /t:Build /p:Configuration=Debug /p:Platform="Any CPU" /p:Nullable=enable /p:TreatWarningsAsErrors=true`264. **Testing — MSTest + Moq + FluentAssertions**: Run tests with: `vstest.console.exe <test-assembly-paths> /EnableCodeCoverage`2728Run the toolchain in order: format → lint → type-check → test. Restart from step 1 if any step fails or changes files.2930## Coding Standards3132- **Naming**: `PascalCase` for types and public members. `camelCase` for locals and private fields/parameters.33- **Null safety**: Keep nullable reference types enabled. Model optional values with nullable annotations and guard clauses.34- **Composition over inheritance**: Keep classes cohesive and scoped to one responsibility. Favor composition unless polymorphism is a clear requirement.35- **Async/await**: Use `async`/`await` for I/O-bound operations. Prefer `using`/`await using` for disposable resources.36- **Exceptions**: Fail fast with explicit exceptions. Avoid broad `catch (Exception)` unless at a defined boundary with added context.37- **Public surface**: Keep public API surface intentional and minimal. Prefer `internal` for non-public APIs.38- **XML docs**: Public APIs should include XML documentation comments when behavior or contract is non-obvious.3940## Testing Standards4142- Use **MSTest** (`Microsoft.VisualStudio.TestTools.UnitTesting`) as the test framework.43- Use **Moq** for mocking.44- Prefer **FluentAssertions** for assertions; use MSTest `Assert` only when FluentAssertions is not practical.45- Use `[TestClass]` and `[TestMethod]` attributes.46- Follow Arrange–Act–Assert structure.47- No external dependencies in unit tests.48- Repository-wide line coverage must remain >= 80%.49- Any new module, class, or method must reach >= 90% coverage.50- Coverage regression on changed lines is a blocking finding.5152## Deterministic Test Rules5354Unit tests must not depend on network, mutable machine PATH or profile state, implicit working-directory assumptions, or external services. Use seam-based mocking for all external boundaries (processes, HTTP, filesystem, clocks). Tests must produce identical results in the IDE test runner and in CLI runs so local and CI behavior agree.5556## DI Seams5758Introduce the smallest seam that enables reliable unit testing. Apply in this order of preference:59601. **Interface seam (preferred)** — extract boundary calls into narrow purpose-specific interfaces (for example, `IProcessRunner`, `IFileSystem`, `IClock`). Keep interfaces minimal.612. **Injectable delegate seam** — use a narrow `Func<>`/`Action<>` delegate for a single call path when a full interface is excessive. Default behavior must remain safe and deterministic.623. **Adapter seam for static or third-party APIs** — wrap the static or third-party call behind a small adapter so tests can mock the adapter with Moq.6364## Prohibited Behaviors6566- Broad refactors across unrelated projects or files.67- Introducing heavy generic abstraction frameworks without need.68- Creating analyzer debt and deferring cleanup.69- Weakening assertions or relaxing test expectations to make tests pass.70- Adding sleeps, retries, or timing hacks to mask flaky behavior.71- Reporting success without running the required toolchain.
Run npx get-skill add drmoisan/csharp-5 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.
Converted skill It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. 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.
drmoisan (@drmoisan) published this skill. Their other Agent Skills are listed on their SkillMD profile.