reviewing-dotnet-code
Reviews and generates .NET/C# code following Microsoft conventions and modern patterns. Use when reviewing C# files, writing .NET code, refactoring, or when user mentions "C#", ".NET", "dotnet", "csharp", or asks about naming conventions in .NET projects.
What this skill does
# Reviewing .NET Code
Apply Microsoft's .NET coding conventions and modern C# patterns when reviewing or generating code.
## Quick Reference
### Naming Conventions
| Element | Style | Example |
|---------|-------|---------|
| Classes, Records | PascalCase | `CustomerService`, `OrderRecord` |
| Interfaces | IPascalCase | `IRepository`, `IDisposable` |
| Methods | PascalCase | `GetCustomer()`, `ValidateOrder()` |
| Properties | PascalCase | `FirstName`, `IsActive` |
| Public Fields | PascalCase | `MaxRetryCount` |
| Parameters | camelCase | `customerId`, `orderDate` |
| Local Variables | camelCase | `itemCount`, `isValid` |
| Private Fields | _camelCase | `_connectionString`, `_logger` |
| Constants | PascalCase | `DefaultTimeout`, `MaxItems` |
| Enums | PascalCase (singular) | `Color.Red`, `Status.Active` |
| Async Methods | PascalCaseAsync | `GetCustomerAsync()` |
### Type Keywords
Always use language keywords over framework types:
```csharp
// Correct
string name;
int count;
bool isActive;
// Avoid
String name;
Int32 count;
Boolean isActive;
```
### Modern C# Patterns (C# 10+)
```csharp
// File-scoped namespaces
namespace MyApp.Services;
// Target-typed new
List<Customer> customers = new();
// Collection expressions
string[] items = ["one", "two", "three"];
// Primary constructors
public class Service(ILogger logger, IRepository repo);
// Records for immutable data
public record CustomerDto(string Name, string Email);
// Raw string literals
var json = """
{ "name": "test" }
""";
```
## Review Workflow
### Step 1: Check Naming
Scan for naming violations:
- Classes/methods not in PascalCase
- Private fields without underscore prefix
- Parameters/locals not in camelCase
- Async methods missing `Async` suffix
### Step 2: Check Patterns
Look for outdated patterns:
- `String` instead of `string`
- `new List<T>()` instead of `new()` or `[]`
- Block-scoped namespaces
- Manual null checks instead of `?.` or `??`
### Step 3: Check Async/Await
Flag async anti-patterns:
- `async void` (except event handlers)
- `.Result` or `.Wait()` blocking calls
- Missing `ConfigureAwait(false)` in libraries
### Step 4: Check Exception Handling
Verify exception patterns:
- Catching `Exception` instead of specific types
- Empty catch blocks
- Not using `using` for disposables
### Step 5: Check LINQ Usage
Identify LINQ opportunities:
- Manual loops that could be `Select`/`Where`/`Any`
- Multiple enumerations (should `.ToList()`)
## When to Read Reference Files
**Read REFERENCE.md when:**
- User asks for detailed naming rules
- Reviewing complex class hierarchies
- Need specific async/await guidance
- Reviewing exception handling patterns
**Read EXAMPLES.md when:**
- Need before/after refactoring samples
- Showing concrete improvements
- User asks "how should this look?"
## Anti-Patterns to Flag
### Critical (Always Flag)
```csharp
// async void (except event handlers)
public async void ProcessData() { }
// Blocking on async
var result = GetDataAsync().Result;
task.Wait();
// Empty catch
try { } catch { }
// Catching base Exception
catch (Exception ex) { }
```
### Important (Flag in Reviews)
```csharp
// Hungarian notation
int iCount; // use: count
string strName; // use: name
// Screaming caps
const int MAX_SIZE = 100; // use: MaxSize
// System types
String name; // use: string
```
## Code Generation Templates
### Service Class
```csharp
namespace MyApp.Services;
public class CustomerService(
ILogger<CustomerService> logger,
ICustomerRepository repository)
{
public async Task<Customer?> GetByIdAsync(
int id,
CancellationToken cancellationToken = default)
{
logger.LogDebug("Getting customer {Id}", id);
return await repository.FindByIdAsync(id, cancellationToken);
}
}
```
### Record DTO
```csharp
namespace MyApp.Models;
public record CustomerDto(
int Id,
string Name,
string Email,
DateOnly CreatedDate);
```
### Interface
```csharp
namespace MyApp.Abstractions;
public interface ICustomerRepository
{
Task<Customer?> FindByIdAsync(int id, CancellationToken ct = default);
Task<IReadOnlyList<Customer>> GetAllAsync(CancellationToken ct = default);
Task AddAsync(Customer customer, CancellationToken ct = default);
}
```
## EditorConfig Integration
If project has `.editorconfig`, defer to those rules for style preferences. Check before suggesting style changes.
## Review Checklist
- [ ] Naming follows conventions
- [ ] Using language keywords (string, int, bool)
- [ ] Async methods have Async suffix
- [ ] No async void (except event handlers)
- [ ] No blocking calls (.Result, .Wait())
- [ ] Using statements for disposables
- [ ] Specific exception types caught
- [ ] LINQ used where appropriate
- [ ] Modern C# features applied
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.