C# Cursor Rules

April 15, 2026

C# Cursor Rules

Code Style

  • 4 spaces indentation
  • PascalCase for classes, methods, properties
  • camelCase for local variables/parameters
  • 120 char line limit

Best Practices

  • Use C# 12+ features
  • Prefer records for immutable data
  • Use nullable reference types
  • Pattern matching everywhere
  • Use async/await for I/O
  • Use constructor injection for DI

AI Instructions

  • Generate nullable-safe code
  • Include XML documentation
  • Use LINQ over loops
  • Add HTTP attributes for ASP.NET