MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Csharp

Csharp是一款code方向的AI技能,核心价值是Guidelines for building C# applications,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Guidelines for building C# applications

Last verified on: 2026-05-30
mkdir -p ./skills/csharp && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/csharp/SKILL.md -o ./skills/csharp/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# C# Development


C# Instructions

- Always use the latest version C#, currently C# 14 features.

- Write clear and concise comments for each function.


General Instructions

- Make only high confidence suggestions when reviewing code changes.

- Write code with good maintainability practices, including comments on why certain design decisions were made.

- Handle edge cases and write clear exception handling.

- For libraries or external dependencies, mention their usage and purpose in comments.


Naming Conventions


- Follow PascalCase for component names, method names, and public members.

- Use camelCase for private fields and local variables.

- Prefix interface names with "I" (e.g., IUserService).


Formatting


- Apply code-formatting style defined in `.editorconfig`.

- Prefer file-scoped namespace declarations and single-line using directives.

- Insert a newline before the opening curly brace of any code block (e.g., after `if`, `for`, `while`, `foreach`, `using`, `try`, etc.).

- Ensure that the final return statement of a method is on its own line.

- Use pattern matching and switch expressions wherever possible.

- Use `nameof` instead of string literals when referring to member names.

- Ensure that XML doc comments are created for any public APIs. When applicable, include `<example>` and `<code>` documentation in the comments.


Project Setup and Structure


- Guide users through creating a new .NET project with the appropriate templates.

- Explain the purpose of each generated file and folder to build understanding of the project structure.

- Demonstrate how to organize code using feature folders or domain-driven design principles.

- Show proper separation of concerns with models, services, and data access layers.

- Explain the Program.cs and configuration system in ASP.NET Core 10 including environment-specific settings.


Nullable Reference Types


- Declare variables non-nullable, and check for `null` at entry points.

- Always use `is null` or `is not null` instead of `== null` or `!= null`.

- Trust the C# null annotations and don't add null checks when the type system says a value cannot be null.


Data Access Patterns


- Guide the implementation of a data access layer using Entity Framework Core.

- Explain different options (SQL Server, SQLite, In-Memory) for development and production.

- Demonstrate repository pattern implementation and when it's beneficial.

- Show how to implement database migrations and data seeding.

- Explain efficient query patterns to avoid common performance issues.


Authentication and Authorization


- Guide users through implementing authentication using JWT Bearer tokens.

- Explain OAuth 2.0 and OpenID Connect concepts as they relate to ASP.NET Core.

- Show how to implement role-based and policy-based authorization.

- Demonstrate integration with Microsoft Entra ID (formerly Azure AD).

- Explain how to secure both controller-based and Minimal APIs consistently.


Validation and Error Handling


- Guide the implementation of model validation using data annotations and FluentValidation.

- Explain the validation pipeline and how to customize validation responses.

- Demonstrate a global exception handling strategy using middleware.

- Show how to create consistent error responses across the API.

- Explain problem details (RFC 9457) implementation for standardized error responses.


API Versioning and Documentation


- Guide users through implementing and explaining API versioning strategies.

- Demonstrate Swagger/OpenAPI implementation with proper documentation.

- Show how to document endpoints, parameters, responses, and authentication.

- Explain versioning in both controller-based and Minimal APIs.

- Guide users on creating meaningful API documentation that helps consumers.


Logging and Monitoring


- Guide the implementation of structured logging using Serilog or other providers.

- Explain the logging levels and when to use each.

- Demonstrate integration with Application Insi

🎯 Best For

  • UI designers
  • Product designers
  • Claude users
  • GitHub Copilot users
  • Software engineers

💡 Use Cases

  • Generating component mockups
  • Creating design system tokens
  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Csharp to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Does this work with Figma?

Some design skills integrate with Figma plugins. Check the Works With section for supported tools.

Is Csharp compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Csharp?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Csharp?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/csharp/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping usability testing

AI-generated designs should be validated with real users before development.

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills