mybatis-plus-generator▌
teachingai/full-stack-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
CRITICAL: This skill should ONLY be triggered when the user explicitly mentions MyBatis-Plus or mybatis-plus-generator.
When to use this skill
CRITICAL: This skill should ONLY be triggered when the user explicitly mentions MyBatis-Plus or mybatis-plus-generator.
ALWAYS use this skill when the user mentions:
- MyBatis-Plus code generation (explicitly mentions "MyBatis-Plus" or "mybatis-plus")
- Generating MyBatis-Plus code from database tables
- MyBatis-Plus generator or mybatis-plus-generator
- Creating MyBatis-Plus Entity, Mapper, Service, Controller code
- 生成 MyBatis-Plus 代码 (explicitly mentions "MyBatis-Plus")
- MyBatis-Plus 代码生成器 (MyBatis-Plus code generator)
- 使用 MyBatis-Plus 生成代码 (generate code using MyBatis-Plus)
Trigger phrases include:
- "生成 MyBatis-Plus 代码" (generate MyBatis-Plus code) - must include "MyBatis-Plus"
- "MyBatis-Plus 代码生成" (MyBatis-Plus code generation) - must include "MyBatis-Plus"
- "mybatis-plus-generator" (explicitly mentions the generator)
- "使用 MyBatis-Plus 根据表结构生成代码" (use MyBatis-Plus to generate code from table structure)
- "MyBatis-Plus 生成 Entity、Service、Controller" (MyBatis-Plus generate Entity, Service, Controller)
- "MyBatis-Plus 代码生成器" (MyBatis-Plus code generator)
DO NOT trigger this skill for:
- Generic code generation without mentioning MyBatis-Plus
- JPA/Hibernate code generation
- Other ORM frameworks (TypeORM, Sequelize, etc.)
- Generic CRUD operations without MyBatis-Plus context
- "根据表结构生成代码" without "MyBatis-Plus" (too generic)
- "生成 CRUD 代码" without "MyBatis-Plus" (too generic)
- "代码生成器" without "MyBatis-Plus" (too generic)
Supported architectures:
- Traditional MVC (Model-View-Controller)
- DDD (Domain-Driven Design)
- Layered Architecture
- Clean Architecture
Supported languages:
- Java
- Kotlin
Supported component types:
- Entity (实体类)
- Mapper (数据访问接口)
- Service (服务接口)
- ServiceImpl (服务实现类)
- Controller (控制器)
- DTO (Data Transfer Object)
- VO (Value Object / View Object)
- BO (Business Object)
- Model (数据模型)
How to use this skill
CRITICAL: This skill should ONLY be triggered when the user explicitly mentions MyBatis-Plus or mybatis-plus-generator. Do NOT trigger for generic code generation requests without MyBatis-Plus context.
Workflow Overview
This skill follows a systematic 8-step workflow:
- Collect Configuration - Collect database information, global configuration, package configuration, strategy configuration
- Determine Architecture - Ask user about architecture type (MVC, DDD, etc.) to determine which objects to generate
- Collect Requirements - Ask user for functional requirements to analyze and determine methods to generate
- Determine Language - Ask user about programming language (Java or Kotlin)
- Create Todo List - Generate a detailed todo list with table names, object types, and method names
- Generate Code - Generate code files with intelligent comments based on table structure and requirements
- Progress Updates - Provide real-time progress updates during code generation
- Statistics - Output statistics after generation completes
Step-by-Step Process
Step 1: Collect Configuration
CRITICAL: Before generating any code, you MUST collect the following configuration:
-
Database Information:
- Database type (MySQL, PostgreSQL, Oracle, etc.)
- Database connection URL (or ask user to provide table structure)
- Database name
- Table names (one or multiple tables)
- If user cannot provide database connection, ask for table structure (CREATE TABLE statement or table schema)
-
Global Configuration:
- Author name
- Output directory (default:
src/main/java) - File override strategy (overwrite, skip, ask)
- Enable Lombok (yes/no)
- Enable API documentation (yes/no)
- API Documentation Type (if enabled):
- Swagger 2 (使用
io.swagger.annotations.*) - OpenAPI 3 (使用
io.swagger.v3.oas.annotations.*)
- Swagger 2 (使用
- Enable validation annotations (yes/no)
-
Package Configuration:
- Parent package name (e.g.,
com.example.app) - Entity package (default:
entity) - Mapper package (default:
mapper) - Service package (default:
service) - ServiceImpl package (default:
service.impl) - Controller package (default:
controller) - DTO package (default:
dto) - VO package (default:
vo) - BO package (default:
bo)
- Parent package name (e.g.,
-
Strategy Configuration:
- Naming strategy (camelCase, PascalCase, etc.)
- Table prefix removal (yes/no, prefix name)
- Field naming strategy
- Primary key strategy (AUTO, UUID, etc.)
IMPORTANT: API Documentation Type Selection:
When user enables API documentation, you MUST ask:
请选择 API 文档类型:
- [ ] Swagger 2
- 使用注解:@ApiModel, @ApiModelProperty, @Api, @ApiOperation
- 依赖:springfox-swagger2, springfox-swagger-ui
- 适用于:Spring Boot 2.x 项目
- [ ] OpenAPI 3
- 使用注解:@Schema, @Tag, @Operation, @Parameter
- 依赖:springdoc-openapi-ui
- 适用于:Spring Boot 2.2+ 和 Spring Boot 3.x 项目
Wait for user confirmation before proceeding.
Output: A configuration summary showing all collected information, including API documentation type.
Step 2: Determine Architecture
CRITICAL: You MUST ask the user about the architecture type to determine which objects to generate.
Present architecture options:
请选择项目架构类型:
- [ ] 传统 MVC (Model-View-Controller)
- 生成:Entity, Mapper, Service, ServiceImpl, Controller
- [ ] DDD (领域驱动设计)
- 生成:Entity, Mapper, Service, ServiceImpl, Controller, DTO, VO, BO
- [ ] 分层架构 (Layered Architecture)
- 生成:Entity, Mapper, Service, ServiceImpl, Controller
- [ ] 整洁架构 (Clean Architecture)
- 生成:Entity, Repository, UseCase, Controller, DTO
- [ ] 自定义架构
- 请指定需要生成的对象类型
Wait for user confirmation before proceeding.
IMPORTANT: Directory Mapping Based on Architecture
After determining the architecture type, you MUST identify the correct output directories for each generated object.
CRITICAL Steps:
- Ask user for base package path (e.g.,
com.example.order) - Use architecture directory mapping to determine correct paths:
- Quick Reference: See
reference/architecture-directory-quick-reference.mdfor lookup table - Detailed Guide: See
reference/architecture-directory-mapping-guide.mdfor complete mapping rules
- Quick Reference: See
- Verify directory exists or create it if needed
- Generate files in the correct location
Common Path Examples:
For user table with base package com.example.order:
- MVC: Entity →
com/example/order/entity/User.java, Controller →com/example/order/controller/UserController.java - DDD: Entity →
com/example/order/domain/model/aggregate/user/User.java, Controller →com/example/order/interfaces/web/controller/UserController.java - Hexagonal: Entity →
com/example/order/domain/model/entity/User.java, Controller →com/example/order/infrastructure/adapter/inbound/web/controller/UserController.java - Clean: Entity →
com/example/order/domain/entity/User.java, Controller →com/example/order/infrastructure/web/controller/UserController.java - COLA: Entity →
com/example/order/domain/model/entity/User.java, Controller →com/example/order/adapter/web/controller/UserController.java
CRITICAL: Always confirm the exact directory structure with the user if the project structure is unclear. Ask: "请确认项目的目录结构,以便我将生成的代码放在正确的位置。"
Step 3: Collect Requirements
CRITICAL: Ask user for functional requirements to understand what methods need to be generated.
Ask the user:
请描述此次生成代码的功能需求:
例如:
- 用户管理:需要根据邮箱查询用户、根据用户名查询用户、用户登录验证
- 订单管理:需要订单统计、订单分页查询、订单状态更新
- 商品管理:需要商品搜索、商品分类查询、库存管理
请详细描述每个表需要哪些功能,我会根据需求自动分析需要生成的方法。
After user provides requirements:
-
Analyze requirements to identify:
- Standard CRUD methods (create, read, update, delete)
- Custom query methods (findByEmail, findByUsername, etc.)
- Custom business methods (statistics, aggregation, etc.)
- Custom update methods (updateStatus, updatePassword, etc.)
-
For each table, identify:
- Standard methods needed
- Custom methods needed based on requirements
- Method parameters and return types
- Business logic hints (for method skeletons)
Output: A requirements analysis showing:
- Standard methods for each table
- Custom methods for each table
- Method signatures (parameters and return types)
Step 4: Determine Language
CRITICAL: Ask user about programming language.
请选择编程语言:
- [ ] Java
- [ ] Kotlin
Wait for user confirmation before proceeding.
Note: Templates in templates/ directory support both Java and Kotlin. Use appropriate templates based on user's choice.
Step 5: Create Todo List
CRITICAL: After collecting all information, create a detailed todo list.
For each table, generate a structured todo list:
## Todo List: MyBatis-Plus Code Generation
### Table: user
#### Entity 层
- [ ] User.java - 实体类
- [ ] 类注释
- [ ] 字段定义(id, username, email, password, status, createTime, updateTime)
- [ ] 字段注释
#### Mapper 层
- [ ] UserMapper.java - 数据访问接口
- [ ] 类注释
- [ ] 基础 CRUD 方法(继承 BaseMapper)
#### Service 层
- [ ] UserService.java - 服务接口
- [ ] 类注释
- [ ] saveUser() - 保存用户
- [ ] findById() - 根据ID查询
- [ ] updateUser() - 更新用户
- [ ] deleteById() - 删除用户
- [ ] findByEmail() - 根据邮箱查询(自定义方法)
- [ ] findByUsername() - 根据用户名查询(自定义方法)
#### ServiceImpl 层
- [ ] UserServiceImpl.java - 服务实现类
- [ ] 类注释
- [ ] 实现所有 Service 接口方法
- [ ] 方法注释和实现骨架
#### Controller 层
- [ ] UserController.java - 控制器
- [ ] 类注释
- [ ] createUser() - 创建用户
- [ ] getUserById() - 查询用户
- [ ] updateUser() - 更新用户
- [ ] deleteUser() - 删除用户
- [ ] getUserByEmail() - 根据邮箱查询(自定义接口)
#### DTO 层(如果架构需要)
- [ ] UserCreateDTO.java - 创建用户DTO
- [ ] UserUpdateDTO.java - 更新用户DTO
- [ ] UserQueryDTO.java - 查询用户DTO
#### VO 层(如果架构需要)
- [ ] UserVO.java - 用户视图对象
### Table: order
...
Important:
- Organize by table
- List all objects that need to be generated
- Include all methods (standard + custom)
- Use checkboxes for tracking progress
Step 6: Generate Code
CRITICAL: Generate code files with intelligent comments based on table structure and requirements.
Order of generation:
- Entity - First (base for all other objects)
- Mapper - Second (data access layer)
- Service - Third (business interface)
- ServiceImpl - Fourth (business implementation)
- Controller - Fifth (API layer)
- DTO/VO/BO - Sixth (if needed by architecture)
For each object:
- Load appropriate template from
templates/directory based on object type and language - Analyze table structure: Read columns, types, constraints, primary keys, foreign keys, relationships
- Generate intelligent comments: Based on business context, not just technical names
- Class comments: Explain purpose, list main fields
- Method comments: Explain business logic, include all parameters and return types
- Field comments: Explain business meaning, not just column names
- Generate code: Replace template variables, add annotations, generate method skeletons
- For custom methods: Generate signatures, add business logic comments, add TODO hints
- Determine output directory: Use architecture directory mapping (see Step 2)
- Save files to correct location based on architecture and package configuration
After generating each object:
- Update the todo list: mark completed items with
[x] - Show progress to the user
- Continue to the next object
Code Generation Standards: See reference/code-generation-standards.md for detailed requirements on comments, templates, and code quality.
Step 7: Progress Updates
CRITICAL: Provide real-time progress updates during code generation.
Update progress after:
- Each table starts processing
- Each object is generated
- Each method is added
- Each table completes
Progress Format: See reference/progress-and-statistics-formats.md for detailed progress update format and examples.
Step 8: Statistics
CRITICAL: After all code generation completes, output comprehensive statistics.
Statistics Format: See reference/progress-and-statistics-formats.md for detailed statistics format including:
- Overall statistics (tables, objects, methods, files, lines)
- Per-table statistics
- Per-type statistics
- File locations
- Code quality checklist
Code Generation Standards
IMPORTANT: Generated code must include intelligent, context-aware comments, not just template placeholders.
Key Requirements:
- Class Comments: Explain purpose based on business context, include table mapping, list main fields
- Method Comments: Explain business logic, include all parameters with types, return value with type, exceptions
- Field Comments: Explain business meaning, include data type and constraints, not just column names
Detailed Standards: See reference/code-generation-standards.md for:
- Complete comment format requirements
- Template usage guidelines
- Template variables reference
- Swagger annotation selection
- Custom method generation standards
- Code quality requirements
Best Practices
- Intelligent Comments: Generate comments based on table structure analysis and business requirements, not just template placeholders
- Context Awareness: Understand table relationships and business context to generate meaningful comments
- Method Analysis: Analyze user requirements to determine what methods are needed
- Progress Tracking: Always update todo list and show progress
- Code Quality: Generate production-ready code with proper annotations and validation
- Template Enhancement: Use templates as base, but enhance with intelligent additions
- Language Support: Support both Java and Kotlin with appropriate templates
Reference Documentation
CRITICAL: Use these reference documents for detailed guidance:
Architecture & Directory Mapping
reference/architecture-directory-mapping-guide.md- Complete directory mapping guide for all architectures (CRITICAL)reference/architecture-directory-quick-reference.md- Quick lookup table for directory mappings
Code Generation Standards
reference/code-generation-standards.md- Detailed comment standards, template usage, and code quality requirementsreference/template-variables.md- Complete list of template variablesreference/swagger-annotations-guide.md- Swagger 2 vs OpenAPI 3 annotation comparison
Progress & Statistics
reference/progress-and-statistics-formats.md- Progress update and statistics output formats
MyBatis-Plus Reference
reference/mybatis-plus-generator-guide.md- MyBatis-Plus Generator usage guide
Examples
See the examples/ directory for complete examples:
examples/mvc-architecture-example.md- MVC architecture generation exampleexamples/ddd-architecture-example.md- DDD architecture generation exampleexamples/full-workflow-example.md- Complete workflow exampleexamples/architecture-directory-mapping.md- Directory mapping examples for different architecturesexamples/swagger-annotations-example.md- Swagger 2 vs OpenAPI 3 annotation examples
Templates
Templates are located in AI-first code editor with Composer Before installing skills in Cursor, ensure your development environment meets these requirements: Execute the skills CLI command in your project's root directory to begin installation: The skills CLI fetches The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor: Confirm successful installation by checking the skill directory location: Reload or restart Cursor to activate mybatis-plus-generator. Access the skill through slash commands (e.g., We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use. Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment. Submit your Claude Code skill and start earning Create detailed user stories, acceptance criteria, and feature specs Example Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios Reduce spec writing time by 50%, ensure comprehensive coverage Research competitors, compare features, identify gaps Example Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities Complete competitive research in 2 hours instead of 2 days Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs Example Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale Make data-driven prioritization decisions faster Draft PRDs, status updates, and stakeholder presentations Example Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement Save 3-5 hours/week on communication overhead 30-60 minutes to see productivity improvements Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work. Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed. Keeps context tight: mybatis-plus-generator is the kind of skill you can hand to a new teammate without a long onboarding doc. mybatis-plus-generator is among the better-maintained entries we tried; worth keeping pinned for repeat workflows. I recommend mybatis-plus-generator for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area. mybatis-plus-generator reduced setup friction for our internal harness; good balance of opinion and flexibility. mybatis-plus-generator has been reliable in day-to-day use. Documentation quality is above average for community skills. Solid pick for teams standardizing on skills: mybatis-plus-generator is focused, and the summary matches what you get after install. Solid pick for teams standardizing on skills: mybatis-plus-generator is focused, and the summary matches what you get after install. Registry listing for mybatis-plus-generator matched our evaluation — installs cleanly and behaves as described in the markdown. We added mybatis-plus-generator from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront. Registry listing for mybatis-plus-generator matched our evaluation — installs cleanly and behaves as described in the markdown. showing 1-10 of 35templates/ directory, using FreeMarker syntax (.ftl files), strictly following How to use mybatis-plus-generator on Cursor
Prerequisites
node --version)Execute installation command
mybatis-plus-generator from GitHub repository teachingai/full-stack-skills and configures it for Cursor.Select Cursor when prompted
Verify installation
/mybatis-plus-generator) or your agent's skill management interface.Security & Verification Notice
Additional Resources
List & Monetize Your Skill
Use Cases▌
User Story & Requirements Generation
Competitive Analysis
Roadmap Prioritization
Stakeholder Communication
Implementation Guide▌
Prerequisites
Time Estimate
Installation Steps
Common Pitfalls
Best Practices▌
✓ Do
✗ Don't
💡 Pro Tips
When to Use This▌
✓ Use When
✗ Avoid When
Learning Path▌
Discussion
Product Hunt–style comments (not star reviews)Ratings
4.7★★★★★35 reviews