scan-codebase-structure

扫描代码库目录树以识别架构层(领域层、应用层、基础设施层、表现层),检测所用框架(例如 Symfony、Laravel 或自定义),统计每层的文件数量,并构建项目结构图。

仓库最近推送
GitHub Stars
109
Forks
26
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "scan-codebase-structure":https://skillpi.com/zh/skills/deepskill-059aed4088a175b305085a8eb578ffb045d7d772559d046ac6aa83694f9a53e1。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

扫描代码库目录树以识别架构层(领域层、应用层、基础设施层、表现层),检测所用框架(例如 Symfony、Laravel 或自定义),统计每层的文件数量,并构建项目结构图。

0 下载

介绍来源: third_party · dykyi-roman · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
输入和输出
减记
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: scan-codebase-structure
description: Scans directory tree to identify architectural layers (Domain, Application, Infrastructure, Presentation), detect framework (Symfony, Laravel, custom), count files per layer, and build project structure map.

Codebase Structure Scanner

Overview

Analyzes a directory tree to build a structured map of the project: identifies architectural layers, detects the framework in use, counts files per layer, and determines the overall project organization pattern.

Scanning Process

Step 1: Directory Tree Analysis

# Get top-level structure
Glob: "*" in target path

# Get full PHP file tree
Glob: "**/*.php" in target path

# Get configuration files
Glob: "{composer.json,*.yaml,*.yml,*.xml,*.neon,*.json}" in target path

Step 2: Framework Detection

Framework Detection Pattern Key Files
Symfony symfony/framework-bundle in composer.json config/bundles.php, config/services.yaml
Laravel laravel/framework in composer.json artisan, app/Providers/
Yii2 yiisoft/yii2 in composer.json config/web.php, config/console.php
Slim slim/slim in composer.json routes/, public/index.php
Custom/None No major framework composer.json only
# Check composer.json for framework
Grep: "symfony/framework-bundle|laravel/framework|yiisoft/yii2|slim/slim" in composer.json

# Check for Symfony bundles
Glob: "config/bundles.php"

# Check for Laravel artisan
Glob: "artisan"

# Check for framework config patterns
Glob: "config/{services,bundles,web,console,app}.{php,yaml,yml}"

Step 3: Layer Identification

Detect architectural layers by namespace patterns and directory structure:

Domain Layer

# Standard DDD directories
Glob: "**/Domain/**/*.php"
Glob: "**/Model/**/*.php"
Glob: "**/Entity/**/*.php"

# Domain components
Grep: "namespace.*\\\\Domain\\\\" --glob "**/*.php"
Grep: "namespace.*\\\\Model\\\\" --glob "**/*.php"

# Domain markers
Grep: "interface.*Repository" --glob "**/*.php"
Grep: "class.*ValueObject|extends.*ValueObject" --glob "**/*.php"
Grep: "class.*AggregateRoot|extends.*AggregateRoot" --glob "**/*.php"
Grep: "class.*DomainEvent|extends.*DomainEvent" --glob "**/*.php"

Application Layer

# Standard Application directories
Glob: "**/Application/**/*.php"
Glob: "**/UseCase/**/*.php"
Glob: "**/Service/**/*.php"

# Application components
Grep: "namespace.*\\\\Application\\\\" --glob "**/*.php"
Grep: "namespace.*\\\\UseCase\\\\" --glob "**/*.php"

# CQRS markers
Grep: "CommandHandler|QueryHandler|CommandBus|QueryBus" --glob "**/*.php"
Grep: "class.*Command\\b|class.*Query\\b" --glob "**/*.php"

Infrastructure Layer

# Standard Infrastructure directories
Glob: "**/Infrastructure/**/*.php"
Glob: "**/Persistence/**/*.php"
Glob: "**/Adapter/**/*.php"

# Infrastructure components
Grep: "namespace.*\\\\Infrastructure\\\\" --glob "**/*.php"
Grep: "implements.*Repository" --glob "**/*.php"

# External integrations
Grep: "Redis|RabbitMQ|Doctrine|Elasticsearch|Guzzle" --glob "**/*.php"

Presentation Layer

# Standard Presentation directories
Glob: "**/Controller/**/*.php"
Glob: "**/Action/**/*.php"
Glob: "**/Api/**/*.php"
Glob: "**/Console/**/*.php"

# Presentation components
Grep: "namespace.*\\\\(Controller|Action|Api|Console|Cli)\\\\" --glob "**/*.php"
Grep: "extends.*Controller|extends.*AbstractController" --glob "**/*.php"
Grep: "#\\[Route\\(|@Route" --glob "**/*.php"

Step 4: Module/Bounded Context Detection

# Detect bounded contexts (common patterns)
# Pattern 1: src/{Context}/Domain|Application|Infrastructure
Glob: "src/*/Domain/"
Glob: "src/*/Application/"

# Pattern 2: src/Domain/{Context}/
Glob: "src/Domain/*/"

# Pattern 3: packages/{context}/
Glob: "packages/*/"

# Pattern 4: modules/{context}/
Glob: "modules/*/"

Step 5: File Statistics

For each detected layer, count:

  • Total PHP files
  • Classes (class keyword)
  • Interfaces (interface keyword)
  • Abstract classes
  • Enums (PHP 8.1+)
  • Traits
# Count by type per directory
Grep: "^(final |abstract |readonly )?class " --glob "**/*.php" in each layer
Grep: "^interface " --glob "**/*.php" in each layer
Grep: "^enum " --glob "**/*.php" in each layer
Grep: "^trait " --glob "**/*.php" in each layer

Output Format

## Project Structure Map

### Framework
- **Framework:** Symfony 6.4 / Laravel 11 / Custom
- **PHP Version:** 8.4 (from composer.json require.php)
- **Type:** Monolith / Modular Monolith / Microservice

### Layers Overview

| Layer | Directory | Files | Classes | Interfaces | Enums |
|-------|-----------|-------|---------|------------|-------|
| Domain | src/Domain/ | 45 | 30 | 10 | 5 |
| Application | src/Application/ | 22 | 20 | 2 | 0 |
| Infrastructure | src/Infrastructure/ | 18 | 15 | 0 | 3 |
| Presentation | src/Api/, src/Console/ | 12 | 12 | 0 | 0 |

### Bounded Contexts (if detected)

| Context | Domain | Application | Infrastructure | Presentation |
|---------|--------|-------------|----------------|-------------|
| Order | 15 files | 8 files | 6 files | 4 files |
| User | 10 files | 5 files | 4 files | 3 files |
| Payment | 8 files | 4 files | 3 files | 2 files |

### Directory Tree

src/ ├── Domain/ │ ├── Order/ │ │ ├── Entity/ │ │ ├── ValueObject/ │ │ ├── Event/ │ │ └── Repository/ │ └── User/ ├── Application/ │ ├── Command/ │ ├── Query/ │ └── Service/ ├── Infrastructure/ │ ├── Persistence/ │ └── Messaging/ └── Presentation/ ├── Api/ └── Console/


### Key Configuration Files
| File | Purpose |
|------|---------|
| composer.json | Dependencies, autoloading |
| config/services.yaml | DI container configuration |
| config/routes.yaml | Route definitions |

Key Indicators

Project Size Classification

Size Files Description
Small < 50 Single module or microservice
Medium 50-200 Standard application
Large 200-500 Complex monolith
Very Large > 500 Enterprise application

Layer Health Indicators

  • Domain > Infrastructure = Good DDD adherence
  • Infrastructure > Domain = Potential coupling issues
  • No Application layer = Possible logic leak to controllers
  • No Domain layer = Transaction script pattern

Integration

This skill provides the structural foundation for:

  • identify-entry-points — uses layer map to find entry points
  • detect-architecture-pattern — uses structure for pattern detection
  • All analysis agents — uses layer map for scoped analysis

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • 提供代码库结构扫描、架构分层识别、框架检测、文件统计等能力,适用于开发者在项目分析、架构评估、代码审计等高频刚需场景
  • 具有明确的实用价值,属于高价值/高频刚需范畴
触发精准95/100

亮点

  • description 明确描述了扫描目录树、识别架构层、检测框架、统计文件数量、构建项目结构图等核心功能
  • 触发词精准完整,覆盖多种变体,边界清晰
结构规范95/100

亮点

  • 文档结构清晰,包含 Overview、Scanning Process(分步骤详细说明)、Output Format、Key Indicators、Integration 等完整章节
  • 每个步骤都有具体的命令示例和检测逻辑,frontmatter 完整,单文件未超过 500 行
执行可靠90/100

亮点

  • 工具来源明确(使用 Glob 和 Grep 等标准命令),参数正确
  • 覆盖了主要的异常情况(如不同框架的检测、不同目录结构的识别),逻辑完整
证据可验 (前四项均值)94/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。