dotnet-csharp-coding-standards
Modern .NET coding standards based on Microsoft Framework Design Guidelines and C# Coding Conventions. This skill covers
naming, file organization, and code style rules that agents should follow when generating or reviewing C# code.
Activation Guidance
Load this skill by default for any task that plans, designs, generates, modifies, or reviews C#/.NET code. Do not wait
for explicit user wording such as "coding standards", "style", or "conventions". If code will be produced, this skill
should be active before implementation starts. This skill is a baseline dependency that should be loaded before
domain-specific C#/.NET skills.
Cross-references: [skill:dotnet-csharp-modern-patterns] for language feature usage, [skill:dotnet-csharp-async-patterns]
for async naming conventions, [skill:dotnet-solid-principles] for SOLID, DRY, and SRP design principles at the class and
interface level.
Scope
- Naming conventions (PascalCase, camelCase, I-prefix for interfaces)
- File organization and namespace conventions
- Code style rules (expression bodies, using directives, var usage)
- EditorConfig integration for style enforcement
Out of scope
- Language feature patterns (records, pattern matching) -- see [skill:dotnet-csharp-modern-patterns]
- Async naming and await conventions -- see [skill:dotnet-csharp-async-patterns]
- SOLID/DRY design principles -- see [skill:dotnet-solid-principles]
- Code smells and anti-patterns -- see [skill:dotnet-csharp-code-smells]
Naming Conventions
General Rules
| Element |
Convention |
Example |
| Namespaces |
PascalCase, dot-separated |
MyCompany.MyProduct.Core |
| Classes, Records, Structs |
PascalCase |
OrderService, OrderSummary |
| Interfaces |
I + PascalCase |
IOrderRepository |
| Methods |
PascalCase |
GetOrderAsync |
| Properties |
PascalCase |
OrderDate |
| Events |
PascalCase |
OrderCompleted |
| Public constants |
PascalCase |
MaxRetryCount |
| Private fields |
_camelCase |
_orderRepository |
| Parameters, locals |
camelCase |
orderId, totalAmount |
| Type parameters |
T or T + PascalCase |
T, TKey, TValue |
| Enum members |
PascalCase |
OrderStatus.Pending |
Async Method Naming
Suffix async methods with Async:
// Correct
public Task<Order> GetOrderAsync(int id);
public ValueTask SaveChangesAsync(CancellationToken ct);
// Wrong
public Task<Order> GetOrder(int id); // missing Async suffix
public Task<Order> GetOrderTask(int id); // wrong suffix
```text
Exception: Event handlers and interface implementations where the framework does not use the `Async` suffix (e.g.,
ASP.NET Core middleware `InvokeAsync` is already named by the framework).
### Boolean Naming
Prefix booleans with `is`, `has`, `can`, `should`, or similar:
```csharp
public bool IsActive { get; set; }
public bool HasOrders { get; }
public bool CanDelete(Order order);
```csharp
### Collection Naming
Use plural nouns for collections:
```csharp
public IReadOnlyList<Order> Orders { get; } // not OrderList
public Dictionary<string, int> CountsByName { get; } // descriptive
```csharp
---
## File Organization
### One Type Per File
Each top-level type (class, record, struct, interface, enum) should be in its own file, named exactly as the type.
Nested types stay in the containing type's file.
```text
OrderService.cs -> public class OrderService
IOrderRepository.cs -> public interface IOrderRepository
OrderStatus.cs -> public enum OrderStatus
OrderSummary.cs -> public record OrderSummary
```csharp
### File-Scoped Namespaces
Always use file-scoped namespaces (C# 10+):
```csharp
// Correct
namespace MyApp.Services;
public class OrderService { }
// Avoid: block-scoped namespace adds unnecessary indentation
namespace MyApp.Services
{
public class OrderService { }
}
```text
### Using Directives
Place `using` directives at the top of the file, outside the namespace. With `<ImplicitUsings>enable</ImplicitUsings>`
(default in modern .NET), common namespaces are already imported. Only add explicit `using` statements for namespaces
not covered by implicit usings.
Order of `using` directives:
1. `System.*` namespaces
2. Third-party namespaces
3. Project namespaces
### Directory Structure
Organize by feature or layer, matching namespace hierarchy:
```text
src/MyApp/
Features/
Orders/
OrderService.cs
IOrderRepository.cs
OrderEndpoints.cs
Users/
UserService.cs
Infrastructure/
Persistence/
OrderRepository.cs
```csharp
---
## Code Style
### Braces
Always use braces for control flow, even for single-line bodies:
```csharp
// Correct
if (order.IsValid)
{
Process(order);
}
// Avoid
if (order.IsValid)
Process(order);
```text
### Expression-Bodied Members
Use expression bodies for single-expression members:
```csharp
// Properties
public string FullName => $"{FirstName} {LastName}";
// Methods (single expression only)
public override string ToString() => $"Order #{Id}";
// Avoid for multi-statement methods -- use block body instead
```text
### `var` Usage
Use `var` when the type is obvious from the right-hand side:
```csharp
// Type is obvious: use var
var orders = new List<Order>();
var customer = GetCustomerById(id);
var name = "Alice";
// Type is not obvious: use explicit type
IOrderRepository repo = serviceProvider.GetRequiredService<IOrderRepository>();
decimal total = CalculateTotal(items);
```text
### Null Handling
Prefer pattern matching over null checks:
```csharp
// Preferred
if (order is not null) { }
if (order is { Status: OrderStatus.Active }) { }
// Acceptable
if (order != null) { }
// Avoid
if (order is object) { }
if (!(order is null)) { }
```text
Use null-conditional and null-coalescing operators:
```csharp
var name = customer?.Name ?? "Unknown";
var orders = customer?.Orders ?? [];
items ??= [];
```csharp
### String Handling
Prefer string interpolation over concatenation or `string.Format`:
```csharp
// Preferred
var message = $"Order {orderId} totals {total:C2}";
// For complex interpolations, use raw string literals (C# 11+)
var json = $$"""
{
"id": {{orderId}},
"name": "{{name}}"
}
""";
// Avoid
var message = string.Format("Order {0} totals {1:C2}", orderId, total);
var message = "Order " + orderId + " totals " + total.ToString("C2");
```text
---
## Access Modifiers
Always specify access modifiers explicitly. Do not rely on defaults:
```csharp
// Correct
public class OrderService
{
private readonly IOrderRepository _repo;
internal void ProcessBatch() { }
}
// Avoid: implicit internal class, implicit private field
class OrderService
{
readonly IOrderRepository _repo;
}
```text
### Modifier Order
Follow the standard order:
```text
access (public/private/protected/internal) -> static -> extern -> new ->
virtual/abstract/override/sealed -> readonly -> volatile -> async -> partial
```text
```csharp
public static readonly int MaxSize = 100;
protected virtual async Task<Order> LoadAsync() => await repo.GetDefaultAsync();
public sealed override string ToString() => Name;
```csharp
---
## Type Design
These conventions implement SOLID and DRY principles at the code level. For comprehensive coverage with anti-patterns
and fixes, see [skill:dotnet-solid-principles].
### Seal Classes by Default
Seal classes that are not designed for inheritance. This improves performance (devirtualization) and communicates
intent:
```csharp
public sealed class OrderService(IOrderRepository repo)
{
// Not designed for inheritance
}
```text
Only leave classes unsealed when you explicitly design them as base classes.
### Prefer Composition Over Inheritance
```csharp
// Preferred: composition
public sealed class OrderProcessor(IValidator validator, INotifier notifier)
{
public async Task ProcessAsync(Order order)
{
await validator.ValidateAsync(order);
await notifier.NotifyAsync(order);
}
}
// Avoid: deep inheritance hierarchies
public class BaseProcessor { }
public class ValidatingProcessor : BaseProcessor { }
public class NotifyingValidatingProcessor : ValidatingProcessor { }
```text
### Interface Segregation
Keep interfaces focused. Prefer multiple small interfaces over one large one:
```csharp
// Preferred
public interface IOrderReader
{
Task<Order?> GetByIdAsync(int id, CancellationToken ct = default);
Task<IReadOnlyList<Order>> GetAllAsync(CancellationToken ct = default);
}
public interface IOrderWriter
{
Task<Order> CreateAsync(Order order, CancellationToken ct = default);
Task UpdateAsync(Order order, CancellationToken ct = default);
}
// Avoid: one large interface with unrelated responsibilities
public interface IOrderRepository : IOrderReader, IOrderWriter { }
```text
---
## CancellationToken Conventions
Accept `CancellationToken` as the last parameter in async methods. Use `default` as the default value for optional
tokens:
```csharp
public async Task<Order> GetOrderAsync(int id, CancellationToken ct = default)
{
return await _repo.GetByIdAsync(id, ct);
}
```text
Always forward the token to downstream async calls. Never ignore a received `CancellationToken`.
---
## XML Documentation
Add XML docs to public API surfaces. Keep them concise:
```csharp
/// <summary>
/// Retrieves an order by its unique identifier.
/// </summary>
/// <param name="id">The order identifier.</param>
/// <param name="ct">Cancellation token.</param>
/// <returns>The order, or <see langword="null"/> if not found.</returns>
public Task<Order?> GetByIdAsync(int id, CancellationToken ct = default);
```text
Do not add XML docs to:
- Private or internal members (unless it's a library's `InternalsVisibleTo` API)
- Self-evident members (e.g., `public string Name { get; }`)
- Test methods
---
## Analyzer Enforcement
Configure these analyzers in `Directory.Build.props` or `.editorconfig` to enforce standards automatically:
```xml
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>latest-all</AnalysisLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
```text
Key `.editorconfig` rules for C# style:
```ini
[*.cs]
csharp_style_namespace_declarations = file_scoped:warning
csharp_prefer_braces = true:warning
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_style_require_accessibility_modifiers = always:warning
csharp_style_prefer_pattern_matching = true:suggestion
```csharp
See [skill:dotnet-add-analyzers] for full analyzer configuration.
---
## Knowledge Sources
Conventions in this skill are grounded in publicly available content from:
- **Microsoft Framework Design Guidelines** -- The canonical reference for .NET naming, type design, and API surface
conventions. Source: https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/
- **C# Language Design Notes (Mads Torgersen et al.)** -- Design rationale behind C# language features that affect
coding standards. Key decisions relevant to this skill: file-scoped namespaces (reducing nesting for readability),
pattern matching over type checks (expressiveness), `required` members (compile-time initialization safety), and `var`
usage guidelines (readability-first). The language design team explicitly chose these features to reduce ceremony
while maintaining safety. Source: https://github.com/dotnet/csharplang/tree/main/meetings
> **Note:** This skill applies publicly documented design rationale. It does not represent or speak for the named
> sources.
## Code Navigation (Serena MCP)
**Primary approach:** Use Serena symbol operations for efficient code navigation:
1. **Find definitions**: `serena_find_symbol` instead of text search
2. **Understand structure**: `serena_get_symbols_overview` for file organization
3. **Track references**: `serena_find_referencing_symbols` for impact analysis
4. **Precise edits**: `serena_replace_symbol_body` for clean modifications
**When to use Serena vs traditional tools:**
- ✅ **Use Serena**: Navigation, refactoring, dependency analysis, precise edits
- ✅ **Use Read/Grep**: Reading full files, pattern matching, simple text operations
- ✅ **Fallback**: If Serena unavailable, traditional tools work fine
**Example workflow:**
```text
# Instead of:
Read: src/Services/OrderService.cs
Grep: "public void ProcessOrder"
# Use:
serena_find_symbol: "OrderService/ProcessOrder"
serena_get_symbols_overview: "src/Services/OrderService.cs"
```
## References
- [Framework Design Guidelines](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/)
- [C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)
- [C# Identifier Naming Rules](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names)
- [.editorconfig for .NET](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options)
- [C# Language Design Notes](https://github.com/dotnet/csharplang/tree/main/meetings)
1---2name: dotnet-csharp-coding-standards-83description: Defines baseline C# conventions loaded first -- naming, file layout, style rules.4license: MIT5targets: ['*']6category: fundamentals7subcategory: coding-standards8tags:9 - csharp10 - dotnet11 - skill12 - coding-standards13 - naming14version: '1.0.0'15author: 'dotnet-agent-harness'16invocable: true17related_skills:18 - dotnet-csharp-modern-patterns19 - dotnet-csharp-nullable-reference-types20 - dotnet-editorconfig21claudecode:22 allowed-tools: ['Read', 'Grep', 'Glob', 'Bash', 'Write', 'Edit']23codexcli:24 short-description: '.NET skill guidance for csharp tasks'25opencode:26 allowed-tools: ['Read', 'Grep', 'Glob', 'Bash', 'Write', 'Edit']27copilot: {}28geminicli: {}29antigravity: {}30metadata:31 source: https://skillmd.com/skills/rudironsoni/dotnet-csharp-coding-standards-832---3334# dotnet-csharp-coding-standards3536Modern .NET coding standards based on Microsoft Framework Design Guidelines and C# Coding Conventions. This skill covers37naming, file organization, and code style rules that agents should follow when generating or reviewing C# code.3839## Activation Guidance4041Load this skill by default for any task that plans, designs, generates, modifies, or reviews C#/.NET code. Do not wait42for explicit user wording such as "coding standards", "style", or "conventions". If code will be produced, this skill43should be active before implementation starts. This skill is a baseline dependency that should be loaded before44domain-specific C#/.NET skills.4546Cross-references: [skill:dotnet-csharp-modern-patterns] for language feature usage, [skill:dotnet-csharp-async-patterns]47for async naming conventions, [skill:dotnet-solid-principles] for SOLID, DRY, and SRP design principles at the class and48interface level.4950## Scope5152- Naming conventions (PascalCase, camelCase, I-prefix for interfaces)53- File organization and namespace conventions54- Code style rules (expression bodies, using directives, var usage)55- EditorConfig integration for style enforcement5657## Out of scope5859- Language feature patterns (records, pattern matching) -- see [skill:dotnet-csharp-modern-patterns]60- Async naming and await conventions -- see [skill:dotnet-csharp-async-patterns]61- SOLID/DRY design principles -- see [skill:dotnet-solid-principles]62- Code smells and anti-patterns -- see [skill:dotnet-csharp-code-smells]6364---6566## Naming Conventions6768### General Rules6970| Element | Convention | Example |71| ------------------------- | ------------------------- | ------------------------------ |72| Namespaces | PascalCase, dot-separated | `MyCompany.MyProduct.Core` |73| Classes, Records, Structs | PascalCase | `OrderService`, `OrderSummary` |74| Interfaces | `I` + PascalCase | `IOrderRepository` |75| Methods | PascalCase | `GetOrderAsync` |76| Properties | PascalCase | `OrderDate` |77| Events | PascalCase | `OrderCompleted` |78| Public constants | PascalCase | `MaxRetryCount` |79| Private fields | `_camelCase` | `_orderRepository` |80| Parameters, locals | camelCase | `orderId`, `totalAmount` |81| Type parameters | `T` or `T` + PascalCase | `T`, `TKey`, `TValue` |82| Enum members | PascalCase | `OrderStatus.Pending` |8384### Async Method Naming8586Suffix async methods with `Async`:8788````csharp8990// Correct91public Task<Order> GetOrderAsync(int id);92public ValueTask SaveChangesAsync(CancellationToken ct);9394// Wrong95public Task<Order> GetOrder(int id); // missing Async suffix96public Task<Order> GetOrderTask(int id); // wrong suffix9798```text99100Exception: Event handlers and interface implementations where the framework does not use the `Async` suffix (e.g.,101ASP.NET Core middleware `InvokeAsync` is already named by the framework).102103### Boolean Naming104105Prefix booleans with `is`, `has`, `can`, `should`, or similar:106107```csharp108109public bool IsActive { get; set; }110public bool HasOrders { get; }111public bool CanDelete(Order order);112113```csharp114115### Collection Naming116117Use plural nouns for collections:118119```csharp120121public IReadOnlyList<Order> Orders { get; } // not OrderList122public Dictionary<string, int> CountsByName { get; } // descriptive123124```csharp125126---127128## File Organization129130### One Type Per File131132Each top-level type (class, record, struct, interface, enum) should be in its own file, named exactly as the type.133Nested types stay in the containing type's file.134135```text136137OrderService.cs -> public class OrderService138IOrderRepository.cs -> public interface IOrderRepository139OrderStatus.cs -> public enum OrderStatus140OrderSummary.cs -> public record OrderSummary141142```csharp143144### File-Scoped Namespaces145146Always use file-scoped namespaces (C# 10+):147148```csharp149150// Correct151namespace MyApp.Services;152153public class OrderService { }154155// Avoid: block-scoped namespace adds unnecessary indentation156namespace MyApp.Services157{158 public class OrderService { }159}160161```text162163### Using Directives164165Place `using` directives at the top of the file, outside the namespace. With `<ImplicitUsings>enable</ImplicitUsings>`166(default in modern .NET), common namespaces are already imported. Only add explicit `using` statements for namespaces167not covered by implicit usings.168169Order of `using` directives:1701711. `System.*` namespaces1722. Third-party namespaces1733. Project namespaces174175### Directory Structure176177Organize by feature or layer, matching namespace hierarchy:178179```text180181src/MyApp/182 Features/183 Orders/184 OrderService.cs185 IOrderRepository.cs186 OrderEndpoints.cs187 Users/188 UserService.cs189 Infrastructure/190 Persistence/191 OrderRepository.cs192193```csharp194195---196197## Code Style198199### Braces200201Always use braces for control flow, even for single-line bodies:202203```csharp204205// Correct206if (order.IsValid)207{208 Process(order);209}210211// Avoid212if (order.IsValid)213 Process(order);214215```text216217### Expression-Bodied Members218219Use expression bodies for single-expression members:220221```csharp222223// Properties224public string FullName => $"{FirstName} {LastName}";225226// Methods (single expression only)227public override string ToString() => $"Order #{Id}";228229// Avoid for multi-statement methods -- use block body instead230231```text232233### `var` Usage234235Use `var` when the type is obvious from the right-hand side:236237```csharp238239// Type is obvious: use var240var orders = new List<Order>();241var customer = GetCustomerById(id);242var name = "Alice";243244// Type is not obvious: use explicit type245IOrderRepository repo = serviceProvider.GetRequiredService<IOrderRepository>();246decimal total = CalculateTotal(items);247248```text249250### Null Handling251252Prefer pattern matching over null checks:253254```csharp255256// Preferred257if (order is not null) { }258if (order is { Status: OrderStatus.Active }) { }259260// Acceptable261if (order != null) { }262263// Avoid264if (order is object) { }265if (!(order is null)) { }266267```text268269Use null-conditional and null-coalescing operators:270271```csharp272273var name = customer?.Name ?? "Unknown";274var orders = customer?.Orders ?? [];275items ??= [];276277```csharp278279### String Handling280281Prefer string interpolation over concatenation or `string.Format`:282283```csharp284285// Preferred286var message = $"Order {orderId} totals {total:C2}";287288// For complex interpolations, use raw string literals (C# 11+)289var json = $$"""290 {291 "id": {{orderId}},292 "name": "{{name}}"293 }294 """;295296// Avoid297var message = string.Format("Order {0} totals {1:C2}", orderId, total);298var message = "Order " + orderId + " totals " + total.ToString("C2");299300```text301302---303304## Access Modifiers305306Always specify access modifiers explicitly. Do not rely on defaults:307308```csharp309310// Correct311public class OrderService312{313 private readonly IOrderRepository _repo;314 internal void ProcessBatch() { }315}316317// Avoid: implicit internal class, implicit private field318class OrderService319{320 readonly IOrderRepository _repo;321}322323```text324325### Modifier Order326327Follow the standard order:328329```text330331access (public/private/protected/internal) -> static -> extern -> new ->332virtual/abstract/override/sealed -> readonly -> volatile -> async -> partial333334```text335336```csharp337338public static readonly int MaxSize = 100;339protected virtual async Task<Order> LoadAsync() => await repo.GetDefaultAsync();340public sealed override string ToString() => Name;341342```csharp343344---345346## Type Design347348These conventions implement SOLID and DRY principles at the code level. For comprehensive coverage with anti-patterns349and fixes, see [skill:dotnet-solid-principles].350351### Seal Classes by Default352353Seal classes that are not designed for inheritance. This improves performance (devirtualization) and communicates354intent:355356```csharp357358public sealed class OrderService(IOrderRepository repo)359{360 // Not designed for inheritance361}362363```text364365Only leave classes unsealed when you explicitly design them as base classes.366367### Prefer Composition Over Inheritance368369```csharp370371// Preferred: composition372public sealed class OrderProcessor(IValidator validator, INotifier notifier)373{374 public async Task ProcessAsync(Order order)375 {376 await validator.ValidateAsync(order);377 await notifier.NotifyAsync(order);378 }379}380381// Avoid: deep inheritance hierarchies382public class BaseProcessor { }383public class ValidatingProcessor : BaseProcessor { }384public class NotifyingValidatingProcessor : ValidatingProcessor { }385386```text387388### Interface Segregation389390Keep interfaces focused. Prefer multiple small interfaces over one large one:391392```csharp393394// Preferred395public interface IOrderReader396{397 Task<Order?> GetByIdAsync(int id, CancellationToken ct = default);398 Task<IReadOnlyList<Order>> GetAllAsync(CancellationToken ct = default);399}400401public interface IOrderWriter402{403 Task<Order> CreateAsync(Order order, CancellationToken ct = default);404 Task UpdateAsync(Order order, CancellationToken ct = default);405}406407// Avoid: one large interface with unrelated responsibilities408public interface IOrderRepository : IOrderReader, IOrderWriter { }409410```text411412---413414## CancellationToken Conventions415416Accept `CancellationToken` as the last parameter in async methods. Use `default` as the default value for optional417tokens:418419```csharp420421public async Task<Order> GetOrderAsync(int id, CancellationToken ct = default)422{423 return await _repo.GetByIdAsync(id, ct);424}425426```text427428Always forward the token to downstream async calls. Never ignore a received `CancellationToken`.429430---431432## XML Documentation433434Add XML docs to public API surfaces. Keep them concise:435436```csharp437438/// <summary>439/// Retrieves an order by its unique identifier.440/// </summary>441/// <param name="id">The order identifier.</param>442/// <param name="ct">Cancellation token.</param>443/// <returns>The order, or <see langword="null"/> if not found.</returns>444public Task<Order?> GetByIdAsync(int id, CancellationToken ct = default);445446```text447448Do not add XML docs to:449450- Private or internal members (unless it's a library's `InternalsVisibleTo` API)451- Self-evident members (e.g., `public string Name { get; }`)452- Test methods453454---455456## Analyzer Enforcement457458Configure these analyzers in `Directory.Build.props` or `.editorconfig` to enforce standards automatically:459460```xml461462<PropertyGroup>463 <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>464 <AnalysisLevel>latest-all</AnalysisLevel>465 <TreatWarningsAsErrors>true</TreatWarningsAsErrors>466</PropertyGroup>467468```text469470Key `.editorconfig` rules for C# style:471472```ini473474[*.cs]475csharp_style_namespace_declarations = file_scoped:warning476csharp_prefer_braces = true:warning477csharp_style_var_for_built_in_types = true:suggestion478csharp_style_var_when_type_is_apparent = true:suggestion479dotnet_style_require_accessibility_modifiers = always:warning480csharp_style_prefer_pattern_matching = true:suggestion481482```csharp483484See [skill:dotnet-add-analyzers] for full analyzer configuration.485486---487488## Knowledge Sources489490Conventions in this skill are grounded in publicly available content from:491492- **Microsoft Framework Design Guidelines** -- The canonical reference for .NET naming, type design, and API surface493 conventions. Source: https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/494- **C# Language Design Notes (Mads Torgersen et al.)** -- Design rationale behind C# language features that affect495 coding standards. Key decisions relevant to this skill: file-scoped namespaces (reducing nesting for readability),496 pattern matching over type checks (expressiveness), `required` members (compile-time initialization safety), and `var`497 usage guidelines (readability-first). The language design team explicitly chose these features to reduce ceremony498 while maintaining safety. Source: https://github.com/dotnet/csharplang/tree/main/meetings499500> **Note:** This skill applies publicly documented design rationale. It does not represent or speak for the named501> sources.502503504505## Code Navigation (Serena MCP)506507**Primary approach:** Use Serena symbol operations for efficient code navigation:5085091. **Find definitions**: `serena_find_symbol` instead of text search5102. **Understand structure**: `serena_get_symbols_overview` for file organization5113. **Track references**: `serena_find_referencing_symbols` for impact analysis5124. **Precise edits**: `serena_replace_symbol_body` for clean modifications513514**When to use Serena vs traditional tools:**515- ✅ **Use Serena**: Navigation, refactoring, dependency analysis, precise edits516- ✅ **Use Read/Grep**: Reading full files, pattern matching, simple text operations517- ✅ **Fallback**: If Serena unavailable, traditional tools work fine518519**Example workflow:**520```text521# Instead of:522Read: src/Services/OrderService.cs523Grep: "public void ProcessOrder"524525# Use:526serena_find_symbol: "OrderService/ProcessOrder"527serena_get_symbols_overview: "src/Services/OrderService.cs"528```529## References530531- [Framework Design Guidelines](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/)532- [C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)533- [C# Identifier Naming Rules](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names)534- [.editorconfig for .NET](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options)535- [C# Language Design Notes](https://github.com/dotnet/csharplang/tree/main/meetings)536````