lang-csharp
Skill0 starsChanged 7 days agoMITView on GitHub
Use when writing, reviewing, testing or setting up C# (.NET) backend code in a loops run (the csharp language pack) - toolchain, layout, race policy, coverage, idioms and footguns.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- alexderz/agentic-toolboxtheir own version, first seen Oct 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- alexderz/agentic-toolbox★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- skills/work/platforms/claude.mdCLAUDE.md
- llms.txtllms.txt
- clarifySkill
- consistencySkill
- debuggingSkill
- documentationSkill
- featureSkill
- hexagonalSkill
- initSkill
- jobs-and-state-machinesSkill
- lang-clojureSkill
- lang-cppSkill
- lang-elixirSkill
- lang-erlangSkill
- lang-goSkill
- lang-javaSkill
- lang-kotlinSkill
- lang-phpSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-scalaSkill
- lang-swiftSkill
- lang-typescriptSkill
- memorySkill
- parallel-workSkill
- performanceSkill
- qualitySkill
- reportSkill
- review-integrationSkill
- statusSkill
- testingSkill
- workSkill
The file
Files
C# (.NET) backend
Rules: specs/languages/csharp/RULES.md (cite by ID, CS-CONC-05). Pack data: specs/languages/csharp/pack.json (loops lang show csharp). Universal rules: specs/ARCHITECTURE.md, specs/SOLID.md. Written for .NET 10 LTS and C# 14, as of 2026-11.
1. When it applies
loops lang detect reports csharp (a global.json, *.slnx, *.sln, *.csproj or Directory.Build.props at the root). If global.json names Microsoft.Testing.Platform the mtp variant is active; check which with loops lang detect.
2. Project rules first
The repo's own config wins over the pack and over this skill: .editorconfig and analyzer severities, Directory.Build.props, global.json, the test framework in use (xUnit, NUnit, MSTest, TUnit), coverlet.runsettings, nuget.config. Read them first (pack.json config_files). Every deviation: loops run override --rule "<loops rule>" --project "<project rule, file:line>" --note "<what you did>".
3. Toolchain the gate runs
loops gate runs these in order; agents run single checks with loops gate --only <check> while iterating, never the whole suite (WORKFLOW §6).
| Check | Command | Notes |
restore | dotnet restore --locked-mode | only when packages.lock.json is committed (CS-REPO-07) |
build | dotnet build -warnaserror -c Release | analyzers and nullable run here; warnings are errors (CS-TOOL-03, CS-TOOL-05) |
format | dotnet format --verify-no-changes --no-restore | required when .editorconfig is committed |
arch | loops arch | using lines plus the <ProjectReference> graph (CS-ARCH-02) |
test | dotnet test --no-build -c Release + coverage args | VSTest base; mtp variant adds --minimum-expected-tests 1 |
concurrency-repeat | dotnet test --no-build -c Release --filter "Category=Concurrency" x3 | race substitute (section 4) |
coverage | internal | Cobertura, new code at least 70% (CS-TEST-09) |
vuln | dotnet package list --vulnerable --include-transitive --format json | off by default; --vuln; exits 0 even when vulnerable, so the gate matches the JSON (CS-TOOL-06) |
Per-file after an edit: dotnet format --no-restore --include <file>. The SDK is pinned in global.json (CS-REPO-11); never bump it inside a feature lane. Use -maxcpucount:2 (test_jobs) when several agents build at once.
Environment: pack env sets MSBUILDDISABLENODEREUSE=1, DOTNET_NOLOGO=1, DOTNET_CLI_TELEMETRY_OPTOUT=1. The run scopes DOTNET_CLI_HOME and TMPDIR only. NUGET_PACKAGES and the NuGet HTTP cache stay shared (CS-OPS-05). Never set them yourself. bin/, obj/, TestResults/, *.trx, *.binlog and Cobertura files are cleanup artifacts, not deliverables (CS-OPS-06).
4. Race policy
.NET has no race detector. The pack is race.mode = none with required substitutes (WORKFLOW §6, CS-CONC-04):
testruns with xUnit parallel collections on. Never setparallelizeTestCollections=falseor serialise the assembly to hide a failure.concurrency-repeatruns tests tagged[Trait("Category","Concurrency")]three times. Tag every test that exercises shared state,Task.WhenAll,Channel<T>, locks or background services, and write them to loop (Parallel.For, many tasks).buildtreats the concurrency analyzers as errors: setdotnet_diagnostic.CA2007/CA2012/CA2016.severity = error(CA2007 only in library projects),VSTHRD*if the repo usesMicrosoft.VisualStudio.Threading.Analyzers. Optional: Microsoft Coyote for systematic interleavings. A retry attribute or--blame-hangloop that hides a flaky test is not a fix. Zero tagged tests passes the check, so concurrent code without a tagged test is a review finding.
5. Coverage recipe
Cobertura, line and branch. The gate reads {coverage_dir}/**/*cobertura.xml (** matches zero directories, so both layouts work):
- VSTest (base, xUnit v2, NUnit, MSTest): needs
coverlet.collectorin every test project. The gate adds--collect:"XPlat Code Coverage" --results-directory {coverage_dir}; coverlet writes<guid>/coverage.cobertura.xml. mtpvariant (xunit.v3, TUnit,global.jsonrunner): needsMicrosoft.Testing.Extensions.CodeCoveragein every test project. The gate adds--results-directory {coverage_dir} -- --coverage --coverage-output-format cobertura; each project writes<guid>.cobertura.xml. Never pass a fixed--coverage-outputto several projects (CS-TEST-07).--collect:"XPlat Code Coverage"fails under MTP.
Wave 0 prerequisites, owned by the architect and csharp-engineer (D13, logged as an override):
- the coverage package above in each test project (via
Directory.Packages.props, CS-REPO-05); global.jsonwith the SDK pin and, for MTP,"test": {"runner": "Microsoft.Testing.Platform"};Directory.Build.propswithNullable,TreatWarningsAsErrors,AnalysisLevel,EnforceCodeStyleInBuild;.editorconfig(it also turns theformatcheck on),Directory.Packages.props,nuget.configwith source mapping;ExcludeByFilefor**/Migrations/*.cs(coverlet) when migrations exist (CS-TEST-08);- a test project per layer plus
Programvisible to tests whenWebApplicationFactoryis used (CS-TEST-05).
6. Loops layers in .NET
Assembly references are the boundary (CS-ARCH-01). One project per layer:
src/Shop.Domain/ pure rules, no PackageReference, no ProjectReference
src/Shop.Application/ use cases + ports (interfaces) -> Domain
src/Shop.Infrastructure/ EF Core, HTTP clients (adapters) -> Application
src/Shop.Api/ composition root (Program.cs), inbound -> Application, Infrastructure
tests/Shop.<Layer>.Tests/ one test project per layer (+ IntegrationTests, Architecture.Tests)Map: domain-engineer owns Shop.Domain, application-engineer Shop.Application, persistence/integration engineers Shop.Infrastructure, api-engineer Shop.Api. loops arch fails on a project reference or using that points outward, and on impure calls (DateTime.UtcNow, Guid.NewGuid, Task.Run) in the domain: inject TimeProvider and an id generator (CS-ARCH-07).
7. Footguns
.Result/.Wait()/async void: await all the way up (CS-CONC-05).new HttpClient()per call:IHttpClientFactory(CS-API-06).- EF N+1, tracked reads:
Include/projection,AsNoTracking()(CS-DATA-04). DbContextin a singleton or shared across tasks: scoped, orIDbContextFactory<T>(CS-DATA-05).- Captive dependency:
ValidateScopes/ValidateOnBuild(CS-ARCH-05). !and suppressed nullable warnings: fix the annotation (CS-IDIOM-03).throw ex;/ blanketcatch:throw;, specific types (CS-IDIOM-01).DateTime.Now, culture-sensitive strings:TimeProvider,StringComparison.Ordinal(CS-IDIOM-07, CS-IDIOM-08).FromSqlRawwith concatenation,BinaryFormatter:FromSql,System.Text.Json(CS-SEC-01, CS-SEC-02).- Missing
CancellationTokenand unboundedTask.Runfire-and-forget: pass the token, useBackgroundService(CS-CONC-07, CS-CONC-08).
8. Load on demand
repo.md: solution layout,global.json, central package management, lock files, CI stages (CS-REPO, CS-TOOL).architecture.md: hexagon as projects, ports, DI composition, arch tests (CS-ARCH).idioms.md: nullability, records, exceptions, disposal, strings, time, LINQ (CS-IDIOM).testing.md: xUnit, fakes, integration tests, coverage, determinism (CS-TEST).concurrency.md: async rules, locking, cancellation, background work (CS-CONC).security.md: injection, deserialisation, secrets, crypto, auth, supply chain (CS-SEC).data-api.md: EF Core, migrations, minimal APIs, resilience, logging, health, config, packaging (CS-DATA, CS-API, CS-OBS, CS-OPS).frameworks.md: ASP.NET Core, EF Core, generic host, Aspire, framework footguns (CS-FW, CS-PERF, CS-DOC).
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
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.

