/acc:detect-architecture-patternfrom acc
Analyzes PHP codebase structure to detect architectural patterns (MVC, DDD, Hexagonal, CQRS, Layered, Event Sourcing, Microservice) with confidence scores.
Ships in acc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyzes a PHP codebase to detect which architectural patterns are in use. Examines namespace structure, interface placement, dependency direction, and code organization to determine patterns with confidence scores.
| Pattern | Key Indicators | Confidence Markers |
|---|---|---|
| MVC | Controllers + Models + Views | Framework routing, template engine |
| DDD | Domain layer with Entities/VOs/Aggregates | Repository interfaces in Domain |
| Hexagonal | Ports (interfaces) + Adapters | Inbound/outbound port separation |
| CQRS | Separate Command/Query models | CommandBus, QueryBus, separate handlers |
| Layered | Domain/Application/Infrastructure | Clear namespace separation |
| Event Sourcing | Event store, aggregate replay | EventStore, AggregateRoot::apply() |
| Clean Architecture | Use Cases + Entity + Gateway | Dependency inversion at boundaries |
| Microservice | Independent deployable | Own database, API gateway, docker |
# Controllers
Grep: "class.*Controller" --glob "**/*.php"
Grep: "extends.*Controller" --glob "**/*.php"
# Models (Eloquent/Doctrine entities)
Grep: "extends Model|#\\[ORM\\\\Entity" --glob "**/*.php"
# Views/Templates
Glob: "**/*.twig"
Glob: "**/*.blade.php"
Glob: "resources/views/**"
Glob: "templates/**"
Confidence scoring:
# Domain entities
Grep: "namespace.*\\\\Domain\\\\.*\\\\Entity" --glob "**/*.php"
Grep: "namespace.*\\\\Domain\\\\.*\\\\Model" --glob "**/*.php"
# Value Objects
Grep: "class.*ValueObject|ValueObject|readonly.*class" --glob "**/Domain/**/*.php"
Glob: "**/ValueObject/**/*.php"
Glob: "**/Domain/**/ValueObject/*.php"
# Aggregates
Grep: "AggregateRoot|Aggregate" --glob "**/Domain/**/*.php"
# Domain Events
Grep: "DomainEvent|extends.*Event" --glob "**/Domain/**/*.php"
Glob: "**/Domain/**/Event/*.php"
# Repository interfaces in Domain
Grep: "interface.*Repository" --glob "**/Domain/**/*.php"
# Domain Services
Glob: "**/Domain/**/Service/*.php"
Confidence scoring:
# Port interfaces
Grep: "namespace.*\\\\Port\\\\" --glob "**/*.php"
Grep: "namespace.*\\\\Ports\\\\" --glob "**/*.php"
Glob: "**/Port/**/*.php"
# Adapter implementations
Grep: "namespace.*\\\\Adapter\\\\" --glob "**/*.php"
Glob: "**/Adapter/**/*.php"
# Inbound/Outbound separation
Glob: "**/Port/Inbound/**"
Glob: "**/Port/Outbound/**"
Glob: "**/Port/In/**"
Glob: "**/Port/Out/**"
# Use case interfaces (driving ports)
Grep: "interface.*UseCase|interface.*Port" --glob "**/*.php"
Confidence scoring:
# Command/Query separation
Glob: "**/Command/**/*.php"
Glob: "**/Query/**/*.php"
# Command handlers
Grep: "CommandHandler|implements.*CommandHandler" --glob "**/*.php"
Grep: "#\\[AsMessageHandler\\]" --glob "**/Command/**/*.php"
# Query handlers
Grep: "QueryHandler|implements.*QueryHandler" --glob "**/*.php"
# Command/Query bus
Grep: "CommandBus|QueryBus|MessageBus" --glob "**/*.php"
# Separate read models
Grep: "ReadModel|Projection|View" --glob "**/*.php"
Glob: "**/ReadModel/**/*.php"
Glob: "**/Projection/**/*.php"
Confidence scoring:
# Event store
Grep: "EventStore|EventStream" --glob "**/*.php"
# Aggregate with apply/record
Grep: "->apply\(|->recordThat\(|->record\(" --glob "**/*.php"
Grep: "function apply.*Event" --glob "**/*.php"
# Event replay
Grep: "reconstitute|reconstruct|replay" --glob "**/*.php"
# Projections
Grep: "Projector|Projection|ReadModelProjector" --glob "**/*.php"
Glob: "**/Projection/**/*.php"
# Snapshots
Grep: "Snapshot|SnapshotStore" --glob "**/*.php"
Confidence scoring:
# Standard layers
Glob: "src/Domain/"
Glob: "src/Application/"
Glob: "src/Infrastructure/"
Glob: "src/Presentation/"
# Alternative naming
Glob: "src/Core/"
Glob: "src/Service/"
Glob: "src/Repository/"
# Namespace analysis
Grep: "namespace.*\\\\Domain\\\\" --glob "**/*.php"
Grep: "namespace.*\\\\Application\\\\" --glob "**/*.php"
Grep: "namespace.*\\\\Infrastructure\\\\" --glob "**/*.php"
Confidence scoring:
# Check for violations (Infrastructure → Domain is OK, Domain → Infrastructure is NOT)
# Domain should not import from Infrastructure
Grep: "use.*\\\\Infrastructure\\\\" --glob "**/Domain/**/*.php"
# Domain should not import from Application
Grep: "use.*\\\\Application\\\\" --glob "**/Domain/**/*.php"
# Application should not import from Presentation
Grep: "use.*\\\\(Controller|Action|Console)\\\\" --glob "**/Application/**/*.php"
# Infrastructure should implement Domain interfaces
Grep: "implements.*\\\\Domain\\\\" --glob "**/Infrastructure/**/*.php"
## Architecture Pattern Analysis
### Detected Patterns
| Pattern | Confidence | Evidence |
|---------|-----------|----------|
| DDD | 85% | Domain layer, VOs, Aggregates, Repository interfaces |
| CQRS | 70% | Command/Query separation, handlers, bus |
| Layered | 90% | 4 layers with proper namespace separation |
| Hexagonal | 40% | Partial port/adapter separation |
| Event Sourcing | 0% | No event store or replay patterns found |
### Primary Pattern: DDD + Layered Architecture
The codebase follows Domain-Driven Design within a Layered Architecture.
### Dependency Direction
Presentation → Application → Domain ← Infrastructure ✓ ✓ ✓ (no violations)
### Violations Found
| From | To | File | Import |
|------|----|------|--------|
| Domain | Infrastructure | Order.php:5 | use App\Infrastructure\... |
### Pattern Maturity Assessment
| Aspect | Status | Notes |
|--------|--------|-------|
| Layer separation | Strong | Clear namespace boundaries |
| Domain purity | Good | 2 minor violations |
| CQRS completeness | Partial | Commands done, queries mixed |
| Interface segregation | Good | Ports defined in Domain |
| Score | Level | Description |
|---|---|---|
| 80-100% | Strong | Pattern is clearly and consistently applied |
| 60-79% | Moderate | Pattern is present with some inconsistencies |
| 40-59% | Partial | Pattern is partially applied or emerging |
| 20-39% | Weak | Some elements present but not systematic |
| 0-19% | Absent | Pattern not detected |
This skill is used by:
codebase-navigator — determines overall architecture approachexplain-coordinator — decides which analysis agents to invokestructural-auditor — provides pattern context for auditWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
architecture-detection, pattern-recognition, php-architecture, mvc, ddd, hexagonal
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc283 skills in this plugin
/access-control-knowledgeAccess Control knowledge base. Provides ACL, RBAC, ABAC, ReBAC models, multi-tenancy patterns, and PHP implementations (Symfony Voters, Laravel Gates) for security audits and generation./adr-knowledgeAction-Domain-Responder pattern knowledge base. Provides patterns, antipatterns, and PHP-specific guidelines for ADR (web-specific MVC alternative) audits./adr-templateGenerates Architecture Decision Records (ADR) for PHP projects. Creates structured decision documentation with context, decision, and consequences.Other plugins' skills for the same job