dotnet-best-practices

Enforce .NET/C# best practices across solutions, pull requests, and CI validation.

4|2|Updated May 18, 2022
One-click install
npx skills add https://github.com/pjmagee/starwars-data --skill dotnet-best-practices-pjmagee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-best-practices
Source: https://github.com/pjmagee/starwars-data/tree/main/.agents/skills/dotnet-best-practices
Command: npx skills add https://github.com/pjmagee/starwars-data --skill dotnet-best-practices-pjmagee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures .NET and C# code across a solution adheres to consistent, project-specific best practices to improve maintainability, testability, localization, security, and AI integration readiness.

Core Features & Use Cases

  • Enforce comprehensive XML documentation on public types and members, including parameter and return descriptions.
  • Standardize dependency injection via constructor-based patterns and register services with appropriate lifetimes.
  • Apply architecture and design patterns such as command handlers, factory usage, and interface segregation for testability.
  • Validate async/await usage and performance practices, structured logging, resource localization, and strong configuration binding.
  • Support testing conventions using MSTest and FluentAssertions, mocking with Moq, and include null parameter validation tests.
  • Integrate Semantic Kernel and AI-related configuration patterns for reliable model usage and structured outputs.

Quick Start

Analyze the selected project or file and produce a prioritized checklist of changes and refactor suggestions to bring the code into compliance with the solution's .NET/C# best practices.

Frequently Asked Questions about dotnet-best-practices

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

FAQPage Schema
How do I enforce C# code quality and best practices across a full .NET solution?

Enforce C# code quality across a .NET solution by auditing architecture patterns, XML documentation, and dependency injection. Apply this Skill to solution-level reviews to generate a prioritized checklist of refactor suggestions for production readiness.

What is the best way to validate async/await usage and dependency injection patterns in C#?

Validate async/await usage and dependency injection by checking constructor-based patterns, service lifetimes, and performance practices. This Skill reviews individual class files to ensure C# services adhere to structured logging and testability standards.

Can I use this to review pull requests for .NET testing standards and Moq mocking conventions?

Yes, you can review pull requests for .NET testing standards by validating MSTest, FluentAssertions, and Moq mocking usage. This Skill checks null parameter validation tests and applies project-specific conventions during CI validation tasks.

How do I configure Semantic Kernel integration and structured outputs in a dotnet project?

Configure Semantic Kernel integration by validating AI-related configuration patterns for reliable model usage and structured outputs. This Skill enforces specific integration requirements to ensure your dotnet project is ready for AI components.

Does this support checking localization resources and strong configuration binding in C#?

Yes, it supports checking localization resources and strong configuration binding in C#. This Skill validates these specific best practices alongside comprehensive XML documentation on public types and members to improve maintainability.