acc-create-deptrac-config
DEPTRAC Configuration Generator
Generates optimized DEPTRAC configurations for architectural dependency analysis.
Generated Files
deptrac.yaml # Main configuration
deptrac-baseline.yaml # Violation baseline (if needed)
Configuration by Architecture
DDD Layered Architecture
# deptrac.yaml
deptrac:
paths:
- ./src
layers:
#############################################
# Domain Layer (innermost)
#############################################
- name: Domain
collectors:
- type: directory
value: src/Domain/.*
# Domain sublayers
- name: Domain.Entity
collectors:
- type: directory
value: src/Domain/.*/Entity/.*
- name: Domain.ValueObject
collectors:
- type: directory
value: src/Domain/.*/ValueObject/.*
- name: Domain.Event
collectors:
- type: directory
value: src/Domain/.*/Event/.*
- name: Domain.Repository
collectors:
- type: directory
value: src/Domain/.*/Repository/.*
- name: Domain.Service
collectors:
- type: directory
value: src/Domain/.*/Service/.*
#############################################
# Application Layer
#############################################
- name: Application
collectors:
- type: directory
value: src/Application/.*
- name: Application.UseCase
collectors:
- type: directory
value: src/Application/.*/UseCase/.*
- name: Application.Command
collectors:
- type: directory
value: src/Application/.*/Command/.*
- name: Application.Query
collectors:
- type: directory
value: src/Application/.*/Query/.*
- name: Application.DTO
collectors:
- type: directory
value: src/Application/.*/DTO/.*
#############################################
# Infrastructure Layer
#############################################
- name: Infrastructure
collectors:
- type: directory
value: src/Infrastructure/.*
- name: Infrastructure.Persistence
collectors:
- type: directory
value: src/Infrastructure/Persistence/.*
- name: Infrastructure.Messaging
collectors:
- type: directory
value: src/Infrastructure/Messaging/.*
- name: Infrastructure.External
collectors:
- type: directory
value: src/Infrastructure/External/.*
#############################################
# Presentation Layer (outermost)
#############################################
- name: Presentation
collectors:
- type: directory
value: src/(Api|Web|Console)/.*
- name: Presentation.Api
collectors:
- type: directory
value: src/Api/.*
- name: Presentation.Web
collectors:
- type: directory
value: src/Web/.*
- name: Presentation.Console
collectors:
- type: directory
value: src/Console/.*
#############################################
# Dependency Rules
#############################################
ruleset:
# Domain has NO dependencies (except language primitives)
Domain: []
Domain.Entity: []
Domain.ValueObject: []
Domain.Event: []
Domain.Repository: [] # Only interfaces
Domain.Service:
- Domain.Entity
- Domain.ValueObject
- Domain.Event
- Domain.Repository
# Application depends only on Domain
Application:
- Domain
Application.UseCase:
- Domain
- Application.DTO
- Application.Command
- Application.Query
Application.Command:
- Domain
Application.Query:
- Domain
Application.DTO:
- Domain.ValueObject # Can use VOs for type safety
# Infrastructure implements Domain interfaces
Infrastructure:
- Domain
- Application
Infrastructure.Persistence:
- Domain.Entity
- Domain.Repository
- Domain.ValueObject
Infrastructure.Messaging:
- Domain.Event
- Application.Command
Infrastructure.External:
- Domain
- Application
# Presentation depends on Application
Presentation:
- Application
- Domain # For DTOs, VOs in responses
Presentation.Api:
- Application.UseCase
- Application.DTO
- Domain.ValueObject
Presentation.Web:
- Application.UseCase
- Application.DTO
Presentation.Console:
- Application.UseCase
- Application.Command
See references/examples.md for: Bounded Context separation, Hexagonal Architecture, Advanced Collectors (class name, interface, attribute, combined), Baseline management, CI configuration (GitHub/GitLab), output formats, common violations and fixes.
Generation Instructions
-
Analyze project:
- Identify architecture style (DDD, Hexagonal, etc.)
- Map directory structure
- Find bounded contexts
-
Define layers:
- Start with main layers (Domain, Application, Infrastructure, Presentation)
- Add sublayers if needed
- Create bounded context layers if multi-context
-
Define rules:
- Domain depends on nothing
- Each layer depends only on inner layers
- Cross-context only via SharedKernel/Events
-
Handle violations:
- Generate baseline for existing violations
- Plan refactoring to remove violations
Usage
Provide:
- Project path
- Architecture style (DDD/Hexagonal/Layered)
- Bounded contexts (if any)
- Current violations to baseline (optional)
The generator will:
- Analyze directory structure
- Create appropriate layers
- Define dependency rules
- Generate baseline if needed
More from dykyi-roman/awesome-claude-code
psr-overview-knowledge
PHP Standards Recommendations (PSR) overview knowledge base. Provides comprehensive reference for all accepted PSRs including PSR-1,3,4,6,7,11,12,13,14,15,16,17,18,20. Use for PSR selection decisions and compliance audits.
22detect-code-smells
Detects code smells in PHP codebases. Identifies God Class, Feature Envy, Data Clumps, Long Parameter List, Long Method, Primitive Obsession, Message Chains, Inappropriate Intimacy. Generates actionable reports with refactoring recommendations.
15clean-arch-knowledge
Clean Architecture knowledge base. Provides patterns, antipatterns, and PHP-specific guidelines for Clean Architecture and Hexagonal Architecture audits.
15ddd-knowledge
DDD architecture knowledge base. Provides patterns, antipatterns, and PHP-specific guidelines for Domain-Driven Design audits.
14testing-knowledge
Testing knowledge base for PHP 8.4 projects. Provides testing pyramid, AAA pattern, naming conventions, isolation principles, DDD testing guidelines, and PHPUnit patterns.
12bug-root-cause-finder
Root cause analysis methods for PHP bugs. Provides 5 Whys technique, fault tree analysis, git bisect guidance, and stack trace parsing.
12