Back to list
JeongHeonK

csharp-code-review

by JeongHeonK

C#, WPF 관련 marketplace

1🍴 0📅 Jan 24, 2026

SKILL.md


name: csharp-code-review description: C# code review skill. Analyzes code quality from OOP, SOLID, GoF design pattern, modern C# features, and performance perspectives. Use before pull requests, when optimizing code, or auditing legacy codebases. user-invocable: true argument-hint: "[file_path]" context: fork model: sonnet allowed-tools:

  • Read
  • Glob
  • Grep
  • LSP

C# Code Review Skill

Systematically reviews C# code from OOP principles, SOLID principles, GoF design patterns, modern C# features, and performance perspectives.

Arguments

  • $ARGUMENTS[0]: Target file or directory path (optional, will scan for recently modified .cs files if not provided)

Execution Steps

Step 1: Identify Review Target

If the user hasn't specified a file:

  • Check recently modified .cs files
  • Or ask the user to specify files/directories to review

Step 2: Code Analysis

Read the target code and analyze from the following perspectives.

Review Checklist

OOP Four Pillars

PrincipleReview Items
EncapsulationPrivate fields, property access, hidden implementation details
InheritanceProper inheritance hierarchy, composition over inheritance
PolymorphismInterface/abstract class usage, virtual method appropriateness
AbstractionAppropriate abstraction level, unnecessary detail exposure

SOLID Principles

PrincipleReview ItemsViolation Signs
SRPDoes the class have single responsibility?Class changes for multiple reasons, too many methods
OCPOpen for extension, closed for modification?Existing code requires modification for new features, switch/if-else chains
LSPCan subtypes substitute base types?Exceptions in subclasses, empty method overrides
ISPAre interfaces segregated per client?NotImplementedException in implementations, unused methods
DIPDepending on abstractions?Direct instantiation with new, concrete class type dependencies

GoF Design Pattern Opportunities

Identify areas in the code where these patterns could be applied:

Creational Patterns

  • Complex object creation → Builder
  • Separate object creation logic → Factory Method / Abstract Factory
  • Global single instance → Singleton (caution: avoid overuse)

Structural Patterns

  • Incompatible interface connection → Adapter
  • Dynamic feature addition → Decorator
  • Simplify complex subsystems → Facade
  • Object tree structures → Composite

Behavioral Patterns

  • Interchangeable algorithms → Strategy
  • State-dependent behavior changes → State
  • Object communication → Observer / Mediator
  • Request processing chain → Chain of Responsibility
  • Undo/Redo → Command + Memento

Modern C# Features (C# 12/13)

FeatureWhen to Recommend
Primary constructorsClasses with simple initialization
Collection expressionsArray/List initialization [1, 2, 3]
required propertiesRequired initialization without constructor
init-only settersImmutable objects
record typesValue-based equality, DTOs
Pattern matchingComplex conditionals, type checking
File-scoped namespacesReduce indentation
Raw string literalsMultiline strings, JSON, SQL

Performance Review

CategoryReview Items
Memory AllocationUnnecessary allocations in hot paths, Large Object Heap (>= 85KB)
Async/AwaitBlocking calls (.Result, .Wait()), missing ConfigureAwait
CollectionsWrong collection type, multiple LINQ enumerations
StringsString concatenation in loops, missing StringBuilder
BoxingUnnecessary value type boxing
Span/MemoryBuffer operations without Span, Memory

Async Code Review

  • No .Result or .Wait() calls (deadlock risk)
  • ConfigureAwait(false) in library code
  • Proper cancellation token propagation
  • ValueTask for hot paths with cached results
  • IAsyncEnumerable for streaming data
  • No async void except event handlers

Code Quality Review

  • Naming conventions (PascalCase, camelCase, _privateField, Async suffix)
  • Null safety (nullable reference types, ?., ??, ??=)
  • Exception handling (specific exceptions, when filters, proper logging)
  • IDisposable pattern compliance (using statements, Dispose implementation)
  • Collection usage (appropriate type selection, efficient LINQ)
  • Magic numbers/strings should be constants
  • Duplicate code elimination
  • Proper use of sealed for non-inheritable classes

Security Review

  • Input validation (SQL injection, XSS, path traversal)
  • Sensitive data handling (no hardcoded secrets, proper encryption)
  • Authentication/Authorization checks
  • Secure randomness (avoid Random for security)
  • XML external entity (XXE) prevention

Step 3: Output Review Results

Output Format

# Code Review Results

## Summary
- File: {file path}
- Overall Assessment: {Excellent/Good/Needs Improvement/Critical}
- Major Issues: {N} items
- .NET Version Compliance: {.NET 8/9 features utilization}

## SOLID Principles Analysis

### SRP Violation (Severity: High/Medium/Low)
- Location: `ClassName.cs:line`
- Problem: {description}
- Suggestion: {improvement with code example}

### OCP Violation
...

## Modern C# Opportunities

### {Feature Name} Recommendation
- Location: `file.cs:line`
- Current: {old syntax}
- Improved: {modern C# syntax}
- Benefit: {explanation}

## Performance Issues

### {Issue Title} (Severity: High/Medium/Low)
- Location: `file.cs:line`
- Problem: {description with impact}
- Current: {problematic code}
- Improved: {optimized code}
- Impact: {expected improvement}

## Async Code Issues

### {Issue Title}
- Location: `file.cs:line`
- Problem: {description}
- Risk: {deadlock/performance/etc}
- Solution: {code fix}

## Applicable Design Patterns

### {Pattern Name} Pattern Recommended
- Current code: {problem}
- Benefits of applying: {description}
- Example code: {brief example}

## Security Concerns

### {Issue Title} (Severity: Critical/High/Medium/Low)
- Location: `file.cs:line`
- Vulnerability: {description}
- Remediation: {fix with code}

## Code Quality Issues

### {Issue Title}
- Location: `file.cs:line`
- Current: {code}
- Improved: {code}

## Positive Aspects
- {mention well-written parts}
- {good patterns already in use}

## Prioritized Improvements
1. [Critical] {security issues}
2. [High] {SOLID violations, performance issues}
3. [Medium] {code quality, modern features}
4. [Low] {style improvements}

Guidelines

  • Don't just criticize; mention positive aspects too.
  • Provide improvements with concrete code examples.
  • Don't recommend over-engineering.
  • Make practical suggestions considering context.
  • Prioritize security issues first.
  • Consider the target .NET version when suggesting features.
  • Balance between modern features and team familiarity.

Score

Total Score

45/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon