C# アプリケーション開発
C# アプリケーション構築指針 by @tsubakimoto
MCP get_skill({ skillId: "c-7c600519" })Use this skill with your agent
Create a free account and connect via MCP
# C# アプリケーション開発 ## C# の指針 - 常に最新の C# を使用します。現在は C# 14 の機能です。 - 各関数に対して明確で簡潔なコメントを書きます。 ## 全般ガイドライン - コード変更のレビューでは、確信度の高い提案のみを行います。 - なぜその設計判断をしたのかという理由を含むコメントなど、保守性の高い実践に沿ってコードを書きます。 - エッジケースに対応し、明確な例外処理を書きます。 - ライブラリや外部依存については、用途と目的をコメントで明記します。 ## 命名規則 - コンポーネント名、メソッド名、公開メンバーには PascalCase を使用します。 - プライベートフィールドとローカル変数には camelCase を使用します。 - インターフェイス名は "I" を接頭辞にします(例: IUserService)。 ## フォーマット - `.editorconfig` で定義されたコードフォーマットスタイルを適用します。 - ファイルスコープの namespace 宣言と 1 行の using ディレクティブを推奨します。 - 任意のコード ブロック(if、for、while、foreach、using、try など)の開始波括弧の前に改行を入れます。 - メソッドの最終 return 文は独立した行に配置します。 - 可能な限りパターンマッチングと switch 式を使用します。 - メンバー名参照には文字列リテラルではなく `nameof` を使用します。 - すべての公開 API に XML ドキュメントコメントを作成します。可能であれば `<example>` と `<code>` も含めます。 ## プロジェクトのセットアップと構成 - 適切なテンプレートで新規 .NET プロジェクトを作成する手順を案内します。 - 生成される各ファイルとフォルダーの目的を説明し、プロジェクト構造の理解を助けます。 - フィーチャーフォルダーやドメイン駆動設計(DDD)による整理方法を示します。 - モデル、サービス、データ アクセス層による責務分離を示します。 - ASP.NET Core 10 における Program.cs と構成システム、そして環境別設定を説明します。 ## Nullable 参照型 - 変数は非 null で宣言し、エントリポイントで `null` を検査します。 - `== null` や `!= null` ではなく、常に `is null` または `is not null` を使用します。 - C# の null 注釈を信頼し、型システムが値の非 null を保証している場合は不要な null チェックを追加しません。 ## データ アクセス パターン - Entity Framework Core を用いたデータアクセス層の実装を案内します。 - 開発および本番における選択肢(SQL Server、SQLite、In-Memory)を説明します。 - リポジトリパターンの実装と、それが有効となる場面を示します。 - データベースマイグレーションとデータシーディングの実装方法を示します。 - 一般的なパフォーマンス問題を避ける効率的なクエリパターンを説明します。 ## 認証と認可 - JWT ベアラートークンを用いた認証の実装を案内します。 - ASP.NET Core に関連する OAuth 2.0 および OpenID Connect の概念を説明します。 - ロールベースおよびポリシーベースの認可の実装方法を示します。 - Microsoft Entra ID(旧 Azure AD)との統合を示します。 - コントローラーベース API と Minimal API の双方を一貫して保護する方法を説明します。 ## 検証とエラー処理 - データ注釈と FluentValidation を用いたモデル検証の実装を案内します。 - 検証パイプラインと、検証応答のカスタマイズ方法を説明します。 - ミドルウェアを用いたグローバル例外処理戦略を示します。 - API 全体で一貫したエラー応答を作成する方法を示します。 - 標準化されたエラー応答のための Problem Details(RFC 9457)の実装を説明します。 ## API のバージョニングとドキュメント - API バージョニング戦略の実装とその解説を案内します。 - 適切なドキュメントを伴う Swagger / OpenAPI の実装を示します。 - エンドポイント、パラメーター、応答、認証の文書化方法を示します。 - コントローラーベース API と Minimal API の双方でのバージョニングを説明します。 - 利用者に役立つ有意義な API ドキュメントの作成を案内します。 ## ロギングと監視 - Serilog などを用いた構造化ロギングの実装を案内します。 - ログレベルと、それぞれを使用すべき場面を説明します。 - テレメトリ収集のための Application Insights との統合を示します。 - リクエスト追跡のためのカスタムテレメトリと相関 ID の実装方法を示します。 - API のパフォーマンス、エラー、利用パターンの監視方法を説明します。 ## テスト - アプリケーションの重要な経路には必ずテストケースを含めます。 - 単体テストの作成を案内します。 - "Act"、"Arrange"、"Assert" のコメントは記述しません。 - 近傍ファイルの既存スタイル(テストメソッド名や大文字/小文字)に合わせます。 - API エンドポイントの統合テスト手法を説明します。 - 効率的なテストのために依存関係をモックする方法を示します。 - 認証および認可ロジックのテスト方法を示します。 - API 開発に適用するテスト駆動開発(TDD)の原則を説明します。 ## パフォーマンス最適化 - キャッシュ戦略(インメモリ、分散、レスポンスキャッシュ)の実装を案内します。 - 非同期プログラミングパターンと、それが API のパフォーマンスにおいて重要である理由を説明します。 - 大規模データセット向けのページング、フィルタリング、ソートを示します。 - 圧縮などのパフォーマンス最適化の実装方法を示します。 - API パフォーマンスの測定とベンチマーク方法を説明します。 ## デプロイと DevOps - .NET の組み込みコンテナーサポート(`dotnet publish --os linux --arch x64 -p:PublishProfile=DefaultContainer`)を用いた API のコンテナー化を案内します。 - 手動で Dockerfile を作成する方法と、.NET のコンテナー公開機能の違いを説明します。 - .NET アプリケーション向け CI/CD パイプラインを説明します。 - Azure App Service、Azure Container Apps、その他のホスティングオプションへのデプロイを示します。 - ヘルスチェックと Readiness Probe の実装方法を示します。 - 各デプロイ段階における環境固有の構成を説明します。
Related Skills
More skills in Software Engineering
Accessibility Standards
Comprehensive web accessibility standards based on WCAG 2.2 AA, with 38+ anti-patterns, legal enforcement context (EAA, ADA Title II), WAI-ARIA patterns, and framework-specific fixes for modern web frameworks and libraries.
Accord
Authoring unified specification packages across Business/Development/Design teams via staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria). No code. Use when authoring cross-team specs, building L0-L3 packages, or aligning Biz/Dev/Design on a single source of truth.
Acquire Codebase Knowledge
Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document this architecture", "onboard me to this repo", or "create codebase docs". Do not trigger for routine feature implementation, bug fixes, or narrow code edits unless the user asks for repository-level discovery.
Acreadiness Assess
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc readiness` and hands off rendering to the @ai-readiness-reporter custom agent. Supports policies (--policy) for org-specific scoring. Use when asked to assess, audit, or score the AI readiness of a repo.
Acreadiness Generate Instructions
Generate tailored AI agent instruction files via AgentRC instructions command. Produces .github/copilot-instructions.md (default, recommended for Copilot in VS Code) plus optional per-area .instructions.md files with applyTo globs for monorepos. Use after running /acreadiness-assess to close gaps in the AI Tooling pillar.
Acreadiness Policy
Help the user pick, write, or apply an AgentRC policy. Policies customise readiness scoring by disabling irrelevant checks, overriding impact/level, setting pass-rate thresholds, or chaining org baselines with team overrides. Use when the user asks about strict mode, AI-only scoring, custom weights, CI gating, or wants org-wide standardisation.
Explore Other Categories
Skills from other categories with shared topics
Code Components
Understanding code components structure and implementation
Comment Code Generate A Tutorial
Transform this Python script into a polished, beginner-friendly project by refactoring the code, adding clear instructional comments, and generating a complete markdown tutorial.
Create Tldr Page
Create a tldr page from documentation URLs and command examples, requiring both URL and command name.