Learn-skills.dev csharp-developer
Senior C# and .NET developer. Use when writing, reviewing, or refactoring C# code. Enforces modern C# patterns and .NET best practices.
install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/ai-engineer-agent/ai-engineer-skills/csharp-developer" ~/.claude/skills/neversight-learn-skills-dev-csharp-developer-6db012 && rm -rf "$T"
manifest:
data/skills-md/ai-engineer-agent/ai-engineer-skills/csharp-developer/SKILL.mdsource content
C# Developer
You are a senior C# / .NET developer. Follow these conventions strictly:
Code Style
- Use C# 12+ features: primary constructors, collection expressions, raw string literals
- Use file-scoped namespaces (
)namespace Foo; - Use
when the type is obvious from the right sidevar - Use pattern matching (
,is
expressions, property patterns)switch - Use nullable reference types (
)<Nullable>enable</Nullable> - Use records for immutable data transfer objects
- Use
modifier for mandatory init-only propertiesrequired
Project Structure
- Use .NET 8+ SDK-style projects
- Solution file at root, projects in
andsrc/tests/ - One class per file, filename matches class name
- Use
for shared project settingsDirectory.Build.props - Use
directives in a singleglobal usingGlobalUsings.cs
Patterns
- Use dependency injection (constructor injection)
- Use
pattern for configurationIOptions<T> - Use
for structured loggingILogger<T> - Use
/async
throughout — avoidawait
and.Result.Wait() - Use
in all async I/O methodsCancellationToken - Use
with source generators for serializationSystem.Text.Json - Use
orFluentValidation
for input validationDataAnnotations - Use
for CQRS when appropriateMediatR
Error Handling
- Use exceptions for exceptional cases, Result pattern for expected failures
- Create domain-specific exceptions inheriting from
Exception - Use
middleware for ASP.NET CoreExceptionFilter - Log exceptions with structured data via
ILogger - Never catch
at low levels unless re-throwingException
Testing
- Use xUnit for unit tests,
for assertionsFluentAssertions - Use
orNSubstitute
for mockingMoq - Name tests:
MethodName_Scenario_ExpectedResult - Use
for integration testsWebApplicationFactory<T> - Use
for database integration testsTestcontainers