mybatis-schema

Audit MyBatis Mapper XML for SQL mappings and ResultMap issues.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/HTRTan/paperclip-skills --skill mybatis-schema
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mybatis-schema
Source: https://github.com/HTRTan/paperclip-skills/tree/main/skills/mybatis-schema
Command: npx skills add https://github.com/HTRTan/paperclip-skills --skill mybatis-schema

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provide a structured guide to audit and optimize MyBatis Mapper XML, including ResultMap design, type alias management, dynamic SQL crafting, and careful tradeoffs between annotations and XML, with templates, anti-pattern detection, and performance tips.

Core Features & Use Cases

  • Audit Mapper XML for SQL readability, parameter mappings, and ResultMap correctness.
  • Design advanced ResultMaps (associations, collections, discriminators) and configure type aliases/TypeHandlers.
  • Decide between annotations vs XML for Mapper methods, and craft dynamic SQL with <if>, <foreach>, <choose>, etc., plus use of SQL fragments.
  • Templates, common anti-patterns, and performance optimization recommendations.

Quick Start

Load your MyBatis Mapper XML files and apply the standard anti-pattern checks to generate a prioritized remediation plan.

Frequently Asked Questions about mybatis-schema

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

FAQPage Schema
How do I audit and fix common anti-patterns in MyBatis Mapper XML?

Auditing MyBatis Mapper XML involves loading your files to check SQL readability, parameter mappings, and ResultMap correctness, generating a prioritized remediation plan for identified anti-patterns.

What is the best way to design advanced ResultMaps for nested results and associations in MyBatis?

Advanced ResultMaps in MyBatis use associations, collections, and discriminators to map nested results, while properly configuring type aliases and TypeHandlers to ensure accurate data representation.

How do I craft dynamic SQL using <if>, <foreach>, and <choose> tags in MyBatis?

Dynamic SQL in MyBatis is crafted using <if>, <foreach>, and <choose> tags alongside SQL fragments to build flexible query templates that adapt to varying runtime parameters.

When should I choose XML mapper files over annotations for MyBatis methods?

Choosing XML mappers over annotations in MyBatis depends on complexity; XML suits advanced ResultMaps and dynamic SQL templates, while annotations often fit simpler single-table scenarios.

How can I optimize MyBatis Mapper performance for joined tables and nested queries?

Optimizing MyBatis performance for joined and nested queries involves auditing ResultMap structures, eliminating anti-patterns, and applying targeted dynamic SQL template improvements.