jpskill.com
🛠️ 開発・MCP コミュニティ

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.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o reviewing-dotnet-code.zip https://jpskill.com/download/17590.zip && unzip -o reviewing-dotnet-code.zip && rm reviewing-dotnet-code.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17590.zip -OutFile "$d\reviewing-dotnet-code.zip"; Expand-Archive "$d\reviewing-dotnet-code.zip" -DestinationPath $d -Force; ri "$d\reviewing-dotnet-code.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して reviewing-dotnet-code.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → reviewing-dotnet-code フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

.NET コードのレビュー

コードのレビューまたは生成を行う際は、Microsoft の .NET コーディング規約と最新の C# パターンを適用してください。

クイックリファレンス

命名規則

要素 スタイル
クラス、レコード PascalCase CustomerService, OrderRecord
インターフェース IPascalCase IRepository, IDisposable
メソッド PascalCase GetCustomer(), ValidateOrder()
プロパティ PascalCase FirstName, IsActive
パブリックフィールド PascalCase MaxRetryCount
パラメータ camelCase customerId, orderDate
ローカル変数 camelCase itemCount, isValid
プライベートフィールド _camelCase _connectionString, _logger
定数 PascalCase DefaultTimeout, MaxItems
列挙型 PascalCase (単数形) Color.Red, Status.Active
Async メソッド PascalCaseAsync GetCustomerAsync()

型キーワード

常にフレームワークの型よりも言語キーワードを使用してください。

// 正しい例
string name;
int count;
bool isActive;

// 避けるべき例
String name;
Int32 count;
Boolean isActive;

最新の C# パターン (C# 10+)

// ファイルスコープの名前空間
namespace MyApp.Services;

// ターゲット型の new
List<Customer> customers = new();

// コレクション式
string[] items = ["one", "two", "three"];

// プライマリコンストラクタ
public class Service(ILogger logger, IRepository repo);

// 不変データ用のレコード
public record CustomerDto(string Name, string Email);

// Raw string リテラル
var json = """
    { "name": "test" }
    """;

レビューワークフロー

ステップ 1: 命名の確認

命名規則違反がないかスキャンします。

  • クラス/メソッドが PascalCase でない
  • プライベートフィールドにアンダースコアプレフィックスがない
  • パラメータ/ローカル変数が camelCase でない
  • Async メソッドに Async サフィックスがない

ステップ 2: パターンの確認

古いパターンがないか確認します。

  • string の代わりに String が使用されている
  • new List<T>() の代わりに new() または [] が使用されている
  • ブロックスコープの名前空間
  • ?. または ?? の代わりに手動の null チェック

ステップ 3: Async/Await の確認

Async のアンチパターンにフラグを立てます。

  • async void (イベントハンドラを除く)
  • .Result または .Wait() によるブロッキング呼び出し
  • ライブラリで ConfigureAwait(false) が欠落している

ステップ 4: 例外処理の確認

例外処理のパターンを確認します。

  • 特定の型の代わりに Exception をキャッチしている
  • 空の catch ブロック
  • using が IDisposable に対して使用されていない

ステップ 5: LINQ の使用状況の確認

LINQ を使用できる機会を特定します。

  • Select/Where/Any にできる手動ループ
  • 複数回の列挙 (.ToList() すべき)

参照ファイルの参照タイミング

REFERENCE.md を参照すべき時:

  • ユーザーが詳細な命名規則を求めている場合
  • 複雑なクラス階層をレビューしている場合
  • 特定の async/await のガイダンスが必要な場合
  • 例外処理パターンをレビューしている場合

EXAMPLES.md を参照すべき時:

  • リファクタリング前後のサンプルが必要な場合
  • 具体的な改善点を示したい場合
  • ユーザーが「これはどのように見えるべきか?」と尋ねている場合

フラグを立てるべきアンチパターン

致命的 (常にフラグを立てる)

// async void (イベントハンドラを除く)
public async void ProcessData() { }

// async でブロッキング
var result = GetDataAsync().Result;
task.Wait();

// 空の catch
try { } catch { }

// 基底 Exception をキャッチ
catch (Exception ex) { }

重要 (レビューでフラグを立てる)

// ハンガリアン記法
int iCount;      // 使用例: count
string strName;  // 使用例: name

// スクリーミングキャップス
const int MAX_SIZE = 100;  // 使用例: MaxSize

// System 型
String name;  // 使用例: string

コード生成テンプレート

サービス クラス

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);
    }
}

レコード DTO

namespace MyApp.Models;

public record CustomerDto(
    int Id,
    string Name,
    string Email,
    DateOnly CreatedDate);

インターフェース

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 の統合

プロジェクトに .editorconfig がある場合は、スタイルの好みについてそれらのルールに従ってください。スタイルの変更を提案する前に確認してください。

レビューチェックリスト

  • [ ] 命名規則に従っている
  • [ ] 言語キーワード (string, int, bool) を使用している
  • [ ] Async メソッドに Async サフィックスがある
  • [ ] async void がない (イベントハンドラを除く)
  • [ ] ブロッキング呼び出しがない (.Result, .Wait())
  • [ ] IDisposable に対して using ステートメントを使用している
  • [ ] 特定の例外型をキャッチしている
  • [ ] LINQ が適切に使用されている
  • [ ] 最新の C# 機能が適用されている
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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:

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

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)

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

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

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

namespace MyApp.Models;

public record CustomerDto(
    int Id,
    string Name,
    string Email,
    DateOnly CreatedDate);

Interface

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