architecture-guard

Enforce Java DDD four-layer architecture rules across Java source files.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/Xunzi229/skills --skill architecture-guard-xunzi229
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: architecture-guard
Source: https://github.com/Xunzi229/skills/tree/main/architecture-guard
Command: npx skills add https://github.com/Xunzi229/skills --skill architecture-guard-xunzi229

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents improper layer dependencies, naming violations, and unsafe data flow in Java DDD and Clean Architecture projects so that Controllers, Application services, Domain, and Infrastructure responsibilities remain correctly separated and auditable.

Core Features & Use Cases

  • Static import and package scanning: Analyzes Java source files to detect forbidden cross-layer imports such as Controller -> Mapper/Repository or Domain -> external SDKs.
  • Naming and responsibility enforcement: Validates naming conventions (Request/Command/Query, DO/Entity, DTO/BO) and ensures inserts/updates go through Domain Repository abstractions.
  • Automated remediation guidance: Provides actionable suggestions to move SQL/SDK calls to the infrastructure layer, create Application orchestrations, or define Repository interfaces in Domain.
  • Use Case: Run during feature implementation, code reviews, or refactors in Java 11 + Spring Boot 2.1 + MyBatis-Plus projects to catch dependency violations early.

Quick Start

Run an architecture check on the current module to detect layer dependency violations and receive suggested fixes for Controller, Application, Domain, and Infrastructure boundaries.

Frequently Asked Questions about architecture-guard

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

FAQPage Schema
How do I detect forbidden cross-layer dependencies in a Java DDD project?

To detect forbidden cross-layer dependencies in a Java DDD project, scan Java source files to analyze imports and package usage, flagging violations like Controller-to-Mapper calls or Domain dependencies on external SDKs. This keeps layer boundaries auditable.

What is the best way to enforce DDD naming conventions like Request, Command, and Entity?

Enforcing DDD naming conventions for Request, Command, Query, DO, Entity, DTO, and BO requires static analysis that validates naming patterns against layer responsibilities. This ensures inserts and updates go through Domain Repository abstractions.

Can I check architecture rules in a SpringBoot 2.1 and MyBatis-Plus codebase?

Yes, you can check architecture rules in a SpringBoot 2.1 and MyBatis-Plus codebase. The static analysis targets Java 11 projects to catch dependency violations during feature implementation, code reviews, or Service and Controller refactoring.

How do I fix a Controller directly calling a Mapper or Repository?

To fix a Controller directly calling a Mapper or Repository, create Application-layer orchestrations to mediate the request flow. The analysis flags these forbidden imports and proposes moving SQL or SDK calls to the infrastructure layer.

Why does my Domain layer break when depending on external frameworks?

Your Domain layer breaks when depending on external frameworks because DDD rules require Domain code to remain isolated. Static scanning detects these forbidden imports and suggests defining Repository interfaces in the Domain layer instead.

Does static analysis work for refactoring Application and Service layers?

Yes, static analysis works for refactoring Application and Service layers by detecting unsafe data flow and suggesting remediation. It provides actionable guidance to move SQL and SDK calls to the infrastructure layer, ensuring proper separation of responsibilities.