Към всички skills

reviewing-dotnet-code

aiskillstore · Инструменти

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.

Оригинален текст · няма потвърден превод на български

Първо прочетете инструкцията.

Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.

Оригинален SKILL.md
GitHub хранилище
Звезди на репото
428
Лиценз
Не е посочен. Проверете в репозитория.
Последна проверка на записа
Няма посочена дата

Добавете в своя инструмент.

Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.

npx skills add aiskillstore/marketplace

Страницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.

Откъс от SKILL.md

Началото на файла на автора, без превод.

Reviewing .NET Code

Apply Microsoft's .NET coding conventions and modern C# patterns when reviewing or generating code.

Quick Reference

Naming Conventions

ElementStyleExample
Classes, RecordsPascalCaseCustomerService, OrderRecord
InterfacesIPascalCaseIRepository, IDisposable
MethodsPascalCaseGetCustomer(), ValidateOrder()
PropertiesPascalCaseFirstName, IsActive
Public FieldsPascalCaseMaxRetryCount
ParameterscamelCasecustomerId, orderDate
Local VariablescamelCaseitemCount, isValid
Private Fields_camelCase_connectionString, _logger
ConstantsPascalCaseDefaultTimeout, MaxItems
EnumsPascalCase (singular)Color.Red, Status.Active
Async MethodsPascalCaseAsyncGetCustomerAsync()

Type Keywords

Always use language keywords over framework types:

// Correct
string name;
int count;
bool isActive;

// Avoid
String name;
Int32 count;
Boolean isActive;

Modern C# Patterns (C# 10+)

// 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())

Целият SKILL.md в GitHub