Install
$ agentstack add skill-danaidev-agent-skills-mapperly-mapping ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Mapperly Mapping
Overview
Implement consistent mapping with Mapperly (source-generated) for DTOs, domain models, and EF Core projections. Includes a migration path from AutoMapper.
Workflow Decision Tree
1) If replacing AutoMapper profiles or ProjectTo usage -> follow AutoMapper -> Mapperly migration. 2) If you need EF Core query projections -> follow Queryable projections. 3) If you need custom conversions (translations, dictionaries, nested transforms) -> follow User-implemented mappings. 4) If you need circular graph handling -> follow Reference handling.
AutoMapper -> Mapperly migration
- Inventory AutoMapper profiles and
ProjectTousage. - Create mapper classes in
Infrastructure.*(or the layer that references both source + target types). - Replace
ProjectTo()with generated projection methods (see assets). - Replace
Mapper.Mapcalls with generated mapping methods or user-implemented mappings. - Remove AutoMapper package from the migrated project when the last mapping is replaced.
Use:
assets/snippets/StaticContentMapper.csfor a projection + mapping template.references/queryable-projections.mdfor projection constraints.
Queryable projections (EF Core)
- Define a
[Mapper]class with aProjectToXxxmethod that takesIQueryableand returnsIQueryable. - Add a private partial mapping method with
[MapProperty]to handle name mismatches and nested properties. - Use the generated projection in services:
query.ProjectToXxx().ToListAsync().
Notes:
- Projections have limitations (no reference handling, no factories, NRT disabled). See
references/queryable-projections.md. - If a
MapPropertyisn’t applied in projections, add an explicit mapping method (seereferences/issues.md).
User-implemented mappings
Use user-implemented methods when:
- Mapping requires non-trivial transforms (e.g., translation dictionaries).
- You need to map to existing entities (
[MappingTarget]).
Rules:
- The method signature must exactly match source/target types and nullability.
- Mapperly auto-discovers user-implemented mappings by default; use
[UserMapping]to control discovery.
See references/user-implemented-methods.md for details and limitations.
Reference handling
If you must map cyclic graphs:
- Set
[Mapper(UseReferenceHandling = true)]. - Ensure runtime assets are included (do not exclude runtime in the package reference).
See references/reference-handling.md.
Output checklists
Before completing a migration slice:
- Ensure all
ProjectTocalls are replaced by Mapperly projections. - Ensure all
Mapper.Mapusage in the slice is replaced by Mapperly-generated or user-implemented methods. - Run targeted tests for the migrated slice.
Assets
assets/snippets/MapperlyProjectionTemplate.cs- minimal projection mapper.assets/snippets/StaticContentMapper.cs- example projection + custom mapping template.assets/snippets/MigrationChecklist.md- quick checklist.
References
references/queryable-projections.mdreferences/user-implemented-methods.mdreferences/reference-handling.mdreferences/issues.md
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: DanAIDev
- Source: DanAIDev/agent-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.