scan-codebase-structure

Scans a codebase directory tree to identify architectural layers (domain, application, infrastructure, presentation), detect frameworks used (e.g., Symfony, Laravel, or custom), count files per layer, and build a project structure diagram.

Last repository push
GitHub Stars
109
Forks
26
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "scan-codebase-structure" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-059aed4088a175b305085a8eb578ffb045d7d772559d046ac6aa83694f9a53e1. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Scans a codebase directory tree to identify architectural layers (domain, application, infrastructure, presentation), detect frameworks used (e.g., Symfony, Laravel, or custom), count files per layer, and build a project structure diagram.

0 Downloads

Introduction source: third_party · dykyi-roman · 0.0.1 Reference

SkillPi interpretation

Tasks
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.
Inputs and outputs
```markdown
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
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

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

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

Highlights

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

Highlights

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

Highlights

  • 工具来源明确(使用 Glob 和 Grep 等标准命令),参数正确
  • 覆盖了主要的异常情况(如不同框架的检测、不同目录结构的识别),逻辑完整
Evidence Verifiability (mean of the first four)94/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

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

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.