ddd4j-project-creator
npx skills add https://github.com/partme-ai/full-stack-skills --skill ddd4j-project-creator
Agent 安装分布
Skill 文档
DDD4j Project Creator
When to use this skill
CRITICAL: This skill should ONLY be triggered when the user explicitly mentions creating a ddd4j project, initializing ddd4j project, or setting up ddd4j-boot project.
ALWAYS use this skill when the user mentions:
- Creating a ddd4j project (explicitly mentions “ddd4j”)
- Initializing ddd4j-boot project
- Setting up ddd4j project structure
- Creating ddd4j project scaffolding
- å建 ddd4j é¡¹ç® (explicitly mentions “ddd4j”)
- åå§å ddd4j é¡¹ç® (initialize ddd4j project)
- ddd4j-boot 项ç®å建 (create ddd4j-boot project)
Trigger phrases include:
- “å建 ddd4j 项箔 (create ddd4j project) – must include “ddd4j”
- “åå§å ddd4j 项箔 (initialize ddd4j project) – must include “ddd4j”
- “å建 ddd4j-boot 项箔 (create ddd4j-boot project) – must include “ddd4j”
- “ä½¿ç¨ ddd4j å建项箔 (create project using ddd4j)
- “ddd4j 项ç®èææ¶” (ddd4j project scaffolding)
DO NOT trigger this skill for:
- Generic DDD projects without mentioning ddd4j
- JPA/Hibernate projects
- Other ORM frameworks
- Generic project initialization without ddd4j context
- “å建 DDD 项箔 without “ddd4j” (too generic)
- “åå§å项箔 without “ddd4j” (too generic)
About DDD4j Boot
DDD4j Boot is a Java microservice development scaffold based on Domain-Driven Design (DDD) principles. It is built with Spring Boot 3.5.x and uses lightweight ddd-4-java and cqrs-4-java libraries to implement Domain-Driven Design, Command Query Responsibility Segregation (CQRS), and Event Sourcing.
Core Design Principles
- Domain-Driven Design (DDD): Strategic design through bounded contexts, tactical design with entities, value objects, aggregates, domain services, repositories, and domain events
- Command Query Responsibility Segregation (CQRS): Separation of read and write models, independent optimization
- Event Sourcing: State changes recorded as event sequences, supporting complete history and state reconstruction
- Diamond Architecture (COLA): Adapter â Application â Domain â Infrastructure four-layer architecture
Key Features
- Complete DDD layered architecture supporting COLA V5 pattern
- Lightweight DDD implementation based on ddd-4-java and cqrs-4-java
- Technology stack integration: Spring Boot 3.5.x, MyBatis Plus, Jackson, Guava, Swagger, SaToken
- Dual stack support: WebMVC (traditional Servlet) and WebFlux (reactive)
- Domain model base capabilities: BaseEntity, BaseRepository, BaseService
- Domain event support with built-in event publishing mechanism
- Anti-Corruption Layer (ACL) for external service integration
- Unified exception handling mechanism
Project Types Supported
1. Single-Module Monolith (åä½å模å)
éç¨åºæ¯: ä¸å°ååºç¨ï¼å个ä¸å¡é¢åï¼å¢éè§æ¨¡ 5-15 人
ç¹ç¹:
- åä¸ Maven 模å
- ææå±ï¼interfaces, application, domain, infrastructureï¼å¨å䏿¨¡åå
- éåå¿«éå¼ååé¨ç½²
2. Multi-Module Monolith (åä½å¤æ¨¡å)
éç¨åºæ¯: ä¸å¤§ååºç¨ï¼å¤ä¸ªä¸å¡åï¼å¢éè§æ¨¡ 15-50 人
ç¹ç¹:
- å¤ä¸ª Maven 模åï¼æä¸å¡ååå
- æ¯ä¸ªä¸å¡åå å«å®æ´ç DDD å屿¶æ
- å ±äº« common 模å
- ç»ä¸ BOM åä¾èµç®¡ç
3. Microservices (åä½å¾®æå¡)
éç¨åºæ¯: 大åçµåå¹³å°ï¼å¤ä¸ªä¸å¡åï¼å¢éè§æ¨¡ 50+ 人
ç¹ç¹:
- æ¯ä¸ªæå¡ç¬ç«é¨ç½²
- æå¡é´éè¿ RPC åæ¶æ¯éåéä¿¡
- æ¯ä¸ªæå¡å 鍿 DDD å屿¶æç»ç»
- ç¬ç«çæ°æ®åºåé ç½®
How to use this skill
CRITICAL: This skill should ONLY be triggered when the user explicitly mentions creating a ddd4j project. Do NOT trigger for generic DDD project creation requests without ddd4j context.
For New DDD4j Project Creation
-
Identify the project type from user requirements:
- Single-module monolith â
single-module - Multi-module monolith â
multi-module - Microservices â
microservices
- Single-module monolith â
-
Load the appropriate example from the
examples/directory:examples/single-module.md– Single-module monolith structureexamples/multi-module.md– Multi-module monolith structureexamples/microservices.md– Microservices structureexamples/architecture-patterns.md– DDD, Hexagonal, Clean, COLA V5 patterns
-
Collect project information:
groupId: Maven group ID (e.g.,com.github.hiwepyorio.ddd4j.base)artifactId: Maven artifact ID (e.g.,ddd4j-douyinormy-ddd4j-service)version: Project version (e.g.,1.0.0-SNAPSHOT)parentVersion: Parent POM version (e.g.,2023.0.x.20251205-SNAPSHOTor reference toddd4j-boot-parent)packageBase: Base package name (e.g.,io.ddd4j.douyinorcom.example.service)modules: List of business modules (for multi-module/microservices)architecture: Architecture pattern (DDD Classic, Hexagonal, Clean, COLA V5)ddd4jBootVersion: DDD4j Boot version (if using ddd4j-boot-bom)
-
Generate project structure:
- Create directory structure based on selected type
- Generate
pom.xmlfiles (parent and modules) - Create
package-info.javafiles for each module - Generate
.gitignore,LICENSE,mvnw,mvnw.cmd - Create basic directory structure with
src/main/javaandsrc/test/java
-
Save to project directory:
- Default location: Save directly to the command execution directory (same level as the command)
- Directory creation: Automatically create the project directory structure if it doesn’t exist
- File naming: Use descriptive names based on project type and module names
For Existing Project Validation
-
Analyze project structure:
- Scan project directory for Maven modules
- Identify layer structure (interfaces, application, domain, infrastructure)
- Check package naming conventions
- Verify directory organization
-
Identify project type:
- Single-module: Single
pom.xmlat root, all layers in one module - Multi-module: Parent
pom.xmlwith multiple modules, each module has complete layers - Microservices: Multiple services, each with independent structure
- Single-module: Single
-
Validate against standards:
- Check DDD layer compliance
- Verify dependency direction (interfaces â application â domain â infrastructure)
- Validate package naming (
{basePackage}.{module}.{layer}) - Check for required directories (
src/main/java,src/test/java) - Verify
package-info.javafiles exist
-
Generate validation report:
- List identified issues
- Provide recommendations
- Suggest fixes for non-compliant structures
Output Format and File Saving
When generating a project structure, follow this response structure:
-
Save the files first: Create the project structure directly in the command execution directory
- The project will be created at the same level as where the command is executed
- Generate all required files and directories (pom.xml, src/, etc.)
- Use the artifactId as the project root directory name
-
Inform the user: Tell them where the files were saved
-
Display the structure: Show the generated directory structure in a code block
Example Response Structure:
- First line: “I’ve created the DDD project structure and saved it to
./{artifactId}/in the current directory.” - Then show the structure wrapped in a code block:
- Start with: three backticks +
text+ newline - Then the directory structure
- End with: three backticks + newline
- Start with: three backticks +
Critical Requirements:
- Always save project files directly to the command execution directory (same level)
- Use artifactId as the project root directory name
- Create the directory structure automatically if it doesn’t exist
- Generate complete project structure with all required files
- Follow Maven and DDD conventions strictly
Project Structure Standards
Package Naming Convention
For multi-module projects:
{basePackage}.{moduleName}.{layerName}
Examples:
io.ddd4j.douyin.api.domain– API module, domain layerio.ddd4j.douyin.api.application– API module, application layerio.ddd4j.douyin.api.interfaces– API module, interfaces layerio.ddd4j.douyin.api.infrastructure– API module, infrastructure layer
Required Files
Every module must have:
pom.xml– Maven configurationsrc/main/java/{package}/package-info.java– Package documentationsrc/test/java/– Test directory structure.gitignore– Git ignore rules (at root)LICENSE– License file (at root)mvnw,mvnw.cmd– Maven wrapper (at root)
Layer Dependencies
Correct dependency direction:
interfaces â application â domain â infrastructure
Rules:
- Domain layer must not depend on any other layer
- Infrastructure layer implements domain layer interfaces
- Application layer depends on domain layer
- Interfaces layer depends on application layer
Architecture Patterns
The skill supports four architecture patterns:
-
DDD Classic Layered Architecture (DDD ç»å ¸å屿¶æ)
- Layers: interfaces, application, domain, infrastructure
- Reference:
docs/1ãDDD ç»å ¸å屿¶æç®å½ç»æ.mdandexamples/architecture-patterns.md#ddd-classic
-
Hexagonal Architecture (å è¾¹å½¢æ¶æ)
- Ports and Adapters pattern
- Reference:
docs/2ãå è¾¹å½¢æ¶æè¯¦ç»ç®å½ç»æåè.mdandexamples/architecture-patterns.md#hexagonal
-
Clean Architecture (æ´æ´æ¶æ)
- Entities, Use Cases, Interface Adapters
- Reference:
docs/3ãæ´æ´æ¶æè¯¦ç»ç®å½ç»æåè.mdandexamples/architecture-patterns.md#clean
-
COLA V5 (è±å½¢æ¶æ)
- Adapter â App â Domain â Infrastructure
- Reference:
docs/4ãCOLA V5 æ¶æè¯¦ç»ç®å½ç»æåè.mdandexamples/architecture-patterns.md#cola-v5
Validation Rules
When checking existing projects, validate:
-
Structure Compliance:
- â Correct layer organization
- â Proper module separation
- â Package naming conventions
-
Dependency Rules:
- â Domain layer has no external dependencies
- â Infrastructure implements domain interfaces
- â Correct dependency direction
-
File Organization:
- â Required directories exist
- â
package-info.javafiles present - â Maven configuration correct
-
Naming Conventions:
- â Package names follow convention
- â Module names are descriptive
- â Layer names are standard
Examples
See the examples/ directory for:
single-module.md– Complete single-module monolith examplemulti-module.md– Complete multi-module monolith example (based on ddd4j-douyin structure)microservices.md– Complete microservices examplearchitecture-patterns.md– All four architecture patterns with detailed structures
Keywords
English keywords: ddd4j, ddd4j-boot, ddd4j project, create ddd4j project, initialize ddd4j project, ddd4j project creator, ddd4j project scaffolding, ddd4j-boot project, ddd4j project structure, ddd4j-boot initialization, ddd4j microservice, ddd4j monolith
Chinese keywords (ä¸æå ³é®è¯): ddd4j, ddd4j-boot, ddd4j 项ç®, å建 ddd4j 项ç®, åå§å ddd4j 项ç®, ddd4j 项ç®å建, ddd4j 项ç®èææ¶, ddd4j-boot 项ç®, ddd4j 项ç®ç»æ, ddd4j-boot åå§å, ddd4j å¾®æå¡, ddd4j åä½åºç¨
IMPORTANT: All keywords must include “ddd4j” to avoid false triggers. Generic terms like “DDD 项箔 (DDD project) or “å建项箔 (create project) without “ddd4j” should NOT trigger this skill.