
Mapstruct
Guides an agent to write and review MapStruct mappers for Sankhya DTO-entity conversion
Mapstruct is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 7
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Mapstruct
This skill sets the conventions an agent should follow when building or auditing MapStruct mappers in Sankhya Addon Studio 2.0 projects. It covers the project-wide Gradle compiler flags, the choice between plain interfaces, mappers with helper components, builder-disabled abstract classes, and create/merge mappers that use a repository for upsert logic. It also lists naming rules for mapper classes and conversion methods, and a checklist for new mappers and reviews of existing ones.
The guidance keeps the component model set once globally rather than on each mapper, requires constructor injection when helper classes or abstract mappers are used, and points to separate reference files for mapping patterns and injection examples. Its common-errors table lists frequent compilation and wiring problems with their fixes.
The content is written in Portuguese and targets Java 8, Gradle, Wildfly/EJB and the JAPE SDK, with Guice used for dependency injection. Working knowledge of Lombok and the Sankhya entity model is assumed.
When your agent uses it
Cria, revisa e refatora mappers MapStruct para Sankhya (`componentModel="jakarta"` global no `build.gradle`, nunca no `@Mapper`; `injectionStrategy=CONSTRUCTOR`, padrões create/merge, `@MappingTarget`, `@AfterMapping`, `@Named`) para conversão DTO↔Entidade campo a campo, sem escrever get/set à mão. Use ao criar, alterar, revisar, auditar ou padronizar mappers, ao trabalhar com arquivos `*Mapper.java`, ou ao tocar em código com `@Mapper`/`@Mapping`. Escopo: o mapper e as anotações de mapeamento; o DTO e a rota são `controller`. NÃO usar para controlar como um tipo serializa em JSON — isso é `@GlobalTypeAdapter`, skill `type-adapter`.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 3 files (21 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the addon-studio plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add snk-devcenter/addon-studio
/plugin install addon-studio@snk-devcenterOr copy only this skill to ~/.claude/skills/mapstruct:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/mapstruct &&
cp -R "$tmp/plugins/addon-studio/skills/mapstruct" ~/.claude/skills/mapstruct &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/mapstruct inside it instead.
Copy the skill folder to ~/.agents/skills/mapstruct to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/mapstruct &&
cp -R "$tmp/plugins/addon-studio/skills/mapstruct" ~/.agents/skills/mapstruct &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/mapstruct inside it instead.
Copy the skill folder to ~/.cursor/skills/mapstruct to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/mapstruct &&
cp -R "$tmp/plugins/addon-studio/skills/mapstruct" ~/.cursor/skills/mapstruct &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/mapstruct inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/snk-devcenter/addon-studio.git --path plugins/addon-studio/skills/mapstructOr copy the folder to ~/.gemini/skills/mapstruct yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/mapstruct:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/mapstruct &&
cp -R "$tmp/plugins/addon-studio/skills/mapstruct" ~/.copilot/skills/mapstruct &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/mapstruct inside it instead.
Get the folder:
git clone --depth 1 https://github.com/snk-devcenter/addon-studio.gitThen copy addon-studio/plugins/addon-studio/skills/mapstruct into your agent's skills folder as mapstruct. Agents that support SKILL.md read one folder per skill.
What it does
- Global compiler configuration
- Explains the Gradle annotation processor settings and what the component model and unmapped target policy flags do.
- Mapper type selection
- Provides a decision flow for choosing between simple, helper-based, builder-disabled and create/merge mapper forms.
- Create and merge upserts
- Describes an abstract mapper pattern that looks up an existing entity by external key and updates it or creates it.
- Naming and method conventions
- Sets naming rules for REST and integration mappers and standard names for conversion methods.
- Review checklist
- Lists verification steps for new mappers and for auditing existing mapper code.
- Common error fixes
- Maps frequent MapStruct and Lombok compilation or injection problems to their corrections.
Good for
- Create a MapStruct mapper converting a REST request DTO into a JAPE entity
- Review an existing mapper for missing injection strategy or component model overrides
- Build an integration mapper that updates or creates entities by external key
- Standardize mapper naming and method signatures across a Sankhya addon project
- Fix an ambiguous mapping method compilation error
Mapstruct FAQ
What does the skill need to be effective?
It assumes a Sankhya Addon Studio 2.0 project with Java 8, Gradle, MapStruct 1.5.5 and Lombok, with the component model flag already set in build.gradle.
Should the componentModel be set on each mapper?
No. The skill says the jakarta component model is declared globally in build.gradle and must not be repeated on @Mapper, since that overrides the global setting and breaks Guice injection.
When is an abstract class mapper required?
When the mapper needs @AfterMapping, custom logic in concrete methods, or a repository for create/merge upsert behaviour.
Does the skill cover JSON serialization?
No. It states that controlling how a type serializes to JSON belongs to a different skill, type-adapter.
How do I install Mapstruct in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/mapstruct to use it in all your projects, or to .claude/skills/mapstruct in one project. Or install the addon-studio plugin, which includes it: /plugin marketplace add snk-devcenter/addon-studio, then /plugin install addon-studio@snk-devcenter.
Does Mapstruct run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Mapstruct?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Mapstruct?
The closest alternatives to Mapstruct are Entity, Type adapter, Dependency injection, Test and Controller.
Where this comes from
- Description: from the skill's own SKILL.md.
More from snk-devcenter/addon-studio

Adds dynamic search filters to Sankhya entity finders before the query runs
- Open source
- 7 GitHub stars
- Developer tools

Guides writing Sankhya commercial business rules with @BusinessRule for sales documents
- Open source
- 7 GitHub stars
- Enterprise it

Lets agents write, review and refactor Sankhya document callbacks with @Callback hooks
- Open source
- 7 GitHub stars
- Developer tools

Builds and reviews Sankhya REST endpoints with @Controller, DTOs and transactions
- Open source
- 7 GitHub stars
- Developer tools

Sets up global Sankhya exception handlers with rollback, error DTOs and HTTP status
- Open source
- 7 GitHub stars
- Developer tools

Generates Sankhya CRUD screens from table XML in datadictionary/ with no JS or HTML
- Open source
- 7 GitHub stars
- Developer tools

