| name | archunit-guard |
|---|---|
| description | Use when changing packages, ports, use cases, or adapters and you need to diagnose or preserve the repository's ArchUnit rules. |
Use when a change may violate the hexagonal rules enforced in application/src/test/java/br/com/helpdev/sample/ArchitectureTest.java.
application/src/test/java/br/com/helpdev/sample/ArchitectureTest.java- any production files whose package, suffix, visibility, or dependency direction violates the current rules
- adding new ports, use cases, adapters, or config classes
- refactoring packages or moving responsibilities across layers
- explaining why an ArchUnit failure happened and what the narrowest safe fix is
- extending architecture rules when the architecture intentionally changes
- The classes or packages being added or changed
- The failing ArchUnit message, if available
- Whether the intent is to comply with the current architecture or to change the architecture itself
- Map each changed class to the repo's layers:
core,adapters, andconfig. - Preserve the current guardrails by default: ports are interfaces ending with
Port, use cases end withUseCase, and implementations stay package-private. - Check dependency direction before editing tests: adapters may depend on ports and domain types, but use cases must not depend on other use cases or input ports.
- Fix production structure first when the failure comes from code drifting away from the intended architecture.
- Only update
ArchitectureTest.javawhen the architecture itself is intentionally changing. - If the change affects long-lived architectural rules, route to
docs-adrbefore normalizing the new rule in code.
- Precise diagnosis of the violated rule
- The smallest compliant code or package change, or a focused ArchUnit update
- Any new assertions required to protect the new pattern
- Do not weaken rules just to make a change pass.
- Prefer aligning package names and visibility with the existing structure over adding exceptions.
- Keep the core framework-agnostic.
- Use
make run-unit-testsas the default validation target. - Treat ArchUnit as a guardrail, not a nuisance to bypass.