AGENT SKILL

csharp-naming-conventions

C# and .NET naming conventions, coding best practices, layout rules, unit testing, and Blazor component guidelines. Use when writing, reviewing, or refactoring C# / .NET / Blazor code or writing unit tests with xUnit and bUnit.

使用场景测试与质量
License 许可
MIT
最近更新
2026-11-14
Stars
★ 4.9k
Forks
494

01 前言 Front Matter

name
csharp-naming-conventions
license
MIT
metadata
{ "author": "dvoituron", "version": "0.0.4" }
description
C# and .NET naming conventions, coding best practices, layout rules, unit testing, and Blazor component guidelines. Use when writing, reviewing, or refactoring C# / .NET / Blazor code or writing unit tests with xUnit and bUnit.

02 资源文件 28

03 SKILL.md 正文

C# Naming Conventions and Best Practices

Comprehensive coding guidelines for .NET and C# developments, covering naming, layout, code patterns, unit testing, and Blazor conventions. Prioritized by impact to guide automated code generation and review.

When to Apply

Reference these guidelines when:

  • Writing new C# / .NET code
  • Reviewing or refactoring existing C# code
  • Naming classes, methods, variables, properties, or parameters
  • Formatting and laying out source files
  • Working with async/await patterns
  • Writing if/else, string, exception, or conversion logic
  • Writing or reviewing unit tests (xUnit, bUnit)
  • Building Blazor components and pages
  • Organizing project file structures

Rule Categories by Priority

Priority Category Impact Prefix
1 Naming & Casing CRITICAL naming-
2 Code Layout & Formatting HIGH layout-
3 Code Patterns HIGH code-
4 Unit Testing HIGH testing-
5 Blazor Conventions MEDIUM-HIGH blazor-

Quick Reference

1. Naming & Casing (CRITICAL)

  • naming-casing - Pascal case and Camel case conventions for all C# identifiers
  • naming-files - File organization: one class per file, namespace matches folder
  • naming-items - Explicit, unabbreviated, English-only names without prefixes
  • naming-async - Postfix async methods with Async, eliding guidelines

2. Code Layout & Formatting (HIGH)

3. Code Patterns (HIGH)

4. Unit Testing (HIGH)

5. Blazor Conventions (MEDIUM-HIGH)

How to Use

Use the linked rule files above for detailed explanations and code examples. Each rule file contains:

  • Brief explanation of why it matters
  • Correct code examples
  • Incorrect patterns to avoid (when applicable)
  • References to external guidelines

04 同仓库更多 Skills