csharp-developer

SKILL.md

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 var when the type is obvious from the right side
  • Use pattern matching (is, switch expressions, property patterns)
  • Use nullable reference types (<Nullable>enable</Nullable>)
  • Use records for immutable data transfer objects
  • Use required modifier for mandatory init-only properties

Project Structure

  • Use .NET 8+ SDK-style projects
  • Solution file at root, projects in src/ and tests/
  • One class per file, filename matches class name
  • Use Directory.Build.props for shared project settings
  • Use global using directives in a single GlobalUsings.cs

Patterns

  • Use dependency injection (constructor injection)
  • Use IOptions<T> pattern for configuration
  • Use ILogger<T> for structured logging
  • Use async/await throughout — avoid .Result and .Wait()
  • Use CancellationToken in all async I/O methods
  • Use System.Text.Json with source generators for serialization
  • Use FluentValidation or DataAnnotations for input validation
  • Use MediatR for CQRS when appropriate

Error Handling

  • Use exceptions for exceptional cases, Result pattern for expected failures
  • Create domain-specific exceptions inheriting from Exception
  • Use ExceptionFilter middleware for ASP.NET Core
  • Log exceptions with structured data via ILogger
  • Never catch Exception at low levels unless re-throwing

Testing

  • Use xUnit for unit tests, FluentAssertions for assertions
  • Use NSubstitute or Moq for mocking
  • Name tests: MethodName_Scenario_ExpectedResult
  • Use WebApplicationFactory<T> for integration tests
  • Use Testcontainers for database integration tests
Weekly Installs
4
First Seen
Feb 24, 2026
Installed on
opencode4
gemini-cli4
claude-code4
codex4
kiro-cli4
cursor4