detect-architecture-pattern
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "detect-architecture-pattern":https://skillpi.com/zh/skills/deepskill-7eef69617ac4d725a294f287f18836cf591f9445b3ceeadb219de01b67fcda5c。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
通过命名空间结构、接口位置和依赖方向检测架构模式(MVC、DDD、六边形架构、CQRS、分层架构、事件溯源、微服务),并为每种模式输出置信度分数。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 减记
- 实测状态
- 未测试
文件浏览
Frontmatter
name: detect-architecture-pattern
description: Detects architectural patterns (MVC, DDD, Hexagonal, CQRS, Layered, Event Sourcing, Microservice) from namespace structure, interface placement, and dependency direction. Outputs confidence score per pattern.Architecture Pattern Detector
Overview
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.
Detectable Patterns
| 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 |
Detection Algorithms
MVC Detection
# 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:
- Controllers found: +30
- Models found: +30
- Views/templates found: +20
- Framework routing: +20
DDD Detection
# 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:
- Domain namespace exists: +15
- Entities in Domain: +15
- Value Objects found: +15
- Repository interfaces in Domain: +20
- Aggregates found: +15
- Domain Events found: +10
- Domain Services found: +10
Hexagonal Detection
# 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:
- Port namespace exists: +30
- Adapter namespace exists: +25
- Inbound/Outbound separation: +25
- Use case interfaces: +20
CQRS Detection
# 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:
- Command namespace: +20
- Query namespace: +20
- Command handlers: +15
- Query handlers: +15
- Bus implementation: +15
- Read models: +15
Event Sourcing Detection
# 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:
- EventStore found: +30
- Aggregate apply pattern: +25
- Reconstitute/replay: +20
- Projections: +15
- Snapshots: +10
Layered Architecture Detection
# 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:
- 4 distinct layers: +40
- 3 distinct layers: +25
- 2 distinct layers: +15
- Proper namespace separation: +30
- No cross-layer imports: +30
Dependency Direction Analysis
# 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"
Output Format
## 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 |
Confidence Scale
| 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 |
Integration
This skill is used by:
codebase-navigator— determines overall architecture approachexplain-coordinator— decides which analysis agents to invokestructural-auditor— provides pattern context for audit
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 高价值工具,直接解决架构分析刚需
- 显著提升开发效率,适用于多种架构模式检测
- 提供置信度评分,增强结果可信度
亮点
- 触发词精准完整,覆盖多种变体
- 边界清晰,不易误触或漏触
- 描述详细,用户易于理解
亮点
- Phase/步骤清晰,有出口条件
- 包含端到端示例,易于理解执行流程
- frontmatter完整,单文件未超过500行
亮点
- 工具来源明确,参数正确
- 覆盖主要异常,不可逆操作有确认机制
- 输出格式规范,易于解析和使用
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。