biellts/universidade-automatiza / .claude/skills/dotnet-best-practices
dotnet-best-practices
VerifiedEnsure .NET/C# code meets best practices for the solution/project.
Siga AGENTS.md; em conflito, AGENTS.md prevalece. Neste projeto: xUnit + Shouldly (sem FluentAssertions/MSTest), erros de negócio via Result (não exceções), datas em
DateTimeOffsetUTC comTimeProvider(nuncaDateTime.Now/DateTime.UtcNowno domínio), escrita por EF Core no DbContext do módulo e leitura por Dapper comIConexaoProvider.
.NET/C# Best Practices
Your task is to ensure .NET/C# code in ${selection} meets the best practices specific to this solution/project. This includes:
Documentation & Structure
- Follow the established namespace structure:
Automatiza.Modules.{Modulo}.Features.{Entidade}s.UseCases.{CasoDeUso}eAutomatiza.Modules.{Modulo}.Domain.Entities.{Entidade}(AGENTS.md) - Um módulo só acessa o próprio DbContext e o próprio schema; nada de referência entre projetos de módulos
Design Patterns & Architecture
- Use primary constructor syntax for dependency injection (e.g.,
public class MyClass(IDependency dependency)) - Handlers inherit
Handler<TRequest, TResponse>and overrideOnHandle - Interfaces follow
I{Substantivo}{Papel}(AGENTS.md → Convenções) - Aggregates are created only through the static
Criar(...)factory
Dependency Injection & Services
- Register services with appropriate lifetimes (Singleton, Scoped, Transient)
- Use Microsoft.Extensions.DependencyInjection patterns
Error Messages
- Domain errors live in
{Entidade}Errorsclasses (Errorrecords withSCREAMING_SNAKE_CASEcodes), not resource files
Async/Await Patterns
- Use async/await for all I/O operations and long-running tasks
- Return Task or Task from async methods
- Use ConfigureAwait(false) where appropriate
- Handle async exceptions properly
Testing Standards
- Follow AAA pattern (Arrange, Act, Assert)
- Test both success and failure scenarios
- Include null parameter validation tests
Configuration & Settings
- Use strongly-typed configuration classes with data annotations
- Implement validation attributes (Required, NotEmptyOrWhitespace)
- Use IConfiguration binding for settings
- Support appsettings.json configuration files
Error Handling & Logging
- Use structured logging with Microsoft.Extensions.Logging
- Include scoped logging with meaningful context
- Erro de negócio:
Result.Fail(...), nunca exceção — exceções ficam para falhas inesperadas/infraestrutura
Performance & Security
- Use current C# features and .NET 10 optimizations where applicable
- Implement proper input validation and sanitization
- Use parameterized queries for database operations (Dapper: parâmetros nomeados e
CommandDefinitioncomCancellationToken) - Nunca registre em log senha, token, cookie, e-mail completo ou resposta de avaliação; nunca exponha mensagem de exceção ao cliente
- Valores monetários e notas em
decimal
Code Quality
- Ensure SOLID principles compliance
- Avoid code duplication through base classes and utilities
- Use meaningful names that reflect domain concepts
- Keep methods focused and cohesive
- Implement proper disposal patterns for resources
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |