What problem does it solve?
This Skill helps developers write and maintain Mapperly mapper classes in C#, ensuring correct conventions and handling of null-safety in generated mapping code, especially when dealing with DTOs and domain models.
Core Features & Use Cases
- Mapper Conventions: Enforces consistent setup for Mapperly mappers, including
RequiredMappingStrategy.None and internal static partial class definitions.
- Null Handling: Provides clear guidance on how Mapperly handles nulls when mapping from nullable DTO properties to non-nullable domain properties, covering various C# constructs like constructor parameters and init-only properties.
- Diagnostic Management: Explains the RMG089 diagnostic and why it typically doesn't require suppression.
- Inspecting Generated Code: Offers a method to view the code generated by Mapperly for debugging.
- Use Case: When adding new DTO-to-domain mappings for an API response, use this Skill to ensure the mappers are configured correctly and handle potential null values gracefully according to established conventions.
Quick Start
Use the mapperly skill to generate a new mapper class for converting Sonarr API DTOs to domain models.