code-style-conventions

Enforce .NET code style conventions across repositories and pull requests.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/SergeuMatyasov/dotnet-shared-skills --skill code-style-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-style-conventions
Source: https://github.com/SergeuMatyasov/dotnet-shared-skills/tree/main/code-style-conventions
Command: npx skills add https://github.com/SergeuMatyasov/dotnet-shared-skills --skill code-style-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill codifies and enforces consistent .NET code styling across projects to speed reviews, reduce defects, and improve readability and maintainability.

Core Features & Use Cases

  • Primary constructor usage guidance for dependency injection where appropriate.
  • Enforce 120-character line length to improve readability.
  • Use dedicated exception types for business errors to improve error handling.
  • Write logs and error messages in English to standardize communication.
  • Propagate CancellationToken across async boundaries to enable proper cancellation.

Quick Start

Apply these conventions to new and existing code to standardize styling across the project.

Frequently Asked Questions about code-style-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce consistent dotnet code style across multiple repositories?

To enforce consistent dotnet code style, you can apply automated conventions that guide PR reviews and onboarding. This ensures compliance with rules like 120-character line limits and primary constructor usage across all new or refactored code.

When should I propagate CancellationToken across async boundaries in .NET?

You should propagate CancellationToken across async boundaries whenever writing asynchronous .NET code to enable proper task cancellation. Applying standard code conventions ensures this token is correctly threaded through all dependent operations.

What is the best way to standardize .NET exception handling and logging?

The best way to standardize .NET exception handling and logging is to codify conventions requiring dedicated exception types for business errors and English messages for all logs. This improves error tracking and readability.

Can I use primary constructors for dependency injection in C#?

Yes, you can use primary constructors for dependency injection in C# where appropriate. Establishing a code style convention provides clear guidance on when to apply them, ensuring dependency injection remains consistent and readable across the repository.

Does this code style convention skill work with existing refactored code?

Yes, this code style convention skill works with existing refactored code as well as new code. It automates the enforcement of styling rules to speed up reviews, reduce defects, and improve maintainability during repository updates.