hieudoanm/hieudoanm.github.io/csharp
Claude Code and agent skill by hieudoanm/hieudoanm.github.io
- community
Checking that the SKILL.md file is still in the repository.
Best practices for writing C# — the language conventions for .NET code. Use when writing, structuring, or reviewing C# code — covers type design, null safety, error handling, async discipline, collections, concurrency, diagnostics, and tooling.
Install
npx vskill@latest install hieudoanm/hieudoanm.github.io/csharpSKILL.md
The same SKILL.md was published earlier as hieudoanm/hieudoanm.github.io/csharp.
C# Best Practices
C# is the language of the .NET platform; modern C# (12+) is concise and expressively typed (records, pattern matching, span, target-typed new). Practical C# leans on immutability by default, null-safety enforced at compile time, exceptions for genuine failures, and async through a cancellation token that never gets dropped. The discipline matters more than any single feature: every API boundary is a typed contract, and analyzers (.editorconfig + dotnet build warnings) are treated as part of the contract.
When to use
Use when writing, structuring, or reviewing C# code.
Prerequisites
- Basic familiarity with C# and the project conventions.
- For implementation, access to the relevant source code and development environment.
Scope boundary
- When the project does not use this technology or pattern, or the task falls outside its scope; follow the project’s existing stack and conventions.
Essential checks
- Make invalid states unrepresentable — record structs, discriminated unions and pattern matching beat "0 means unset" oro-checkboxstringly booleans
- Compile-time guarantees over runtime checks — nullable annotations, readonly collection types, sealed
- Immutable by default, mutate explicitly — the happy path is a valueless value you assemble once
- Async end-to-end with a token that flows — cancellation is part of the signature, not an afterthought
- Exceptions for failures, Results for expected outcomes — pick once, consistently
- Analyzers + dotnet test are part of "done" — not a lint step to run before merge
- [ ] record/readonly record struct for DTOs; init/required over mutable setters; classes sealed by default
- [ ] Nullable reference types enabled; ?./?? over null ifs; ! only on verified invariants
Focus areas
- 1. Type Design & Immutability
- 2. Null Safety
- 3. Error Handling
- 4. Async Discipline
- 5. Collections & LINQ
- 6. Concurrency
- 7. Strings & Culture
- 8. Modern C# Patterns
- 9. Classes & Dependency Injection
- 10. Testing
- 11. Tooling & Diagnostics
Detailed references
Related materials
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.skills/programming/languages/csharp/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hieudoanm/hieudoanm.github.io/csharp)