Codebase Exploration
$ARGUMENTS
Explore and understand a codebase structure.
Project context
- Config files: !
find . -maxdepth 2 -type f -name "*.json" -o -name "*.toml" -o -name "*.yaml" -o -name "*.yml" 2>/dev/null | head -20
Usage
/explore [path]
What This Command Does
- Maps project structure
- Identifies technology stack
- Finds key files and patterns
- Reports architecture overview
Output Format
## Codebase Analysis Report
### Project Type
- **Language**: [TypeScript/Python/PHP/etc.]
- **Framework**: [Next.js/FastAPI/Laravel/etc.]
- **Package Manager**: [npm/pnpm/pip/composer]
### Directory Structure
project/
├── src/ # Source code
├── tests/ # Test files
├── config/ # Configuration
└── ...
### Key Files
| File | Purpose |
|------|---------|
| `src/index.ts` | Entry point |
| `src/api/` | API routes |
### Dependencies
- **Runtime**: [list]
- **Dev**: [list]
### Patterns Detected
- [Pattern 1]
- [Pattern 2]
### Entry Points
- [Entry 1]
- [Entry 2]
Technology Detection
| Marker |
Technology |
package.json |
Node.js |
tsconfig.json |
TypeScript |
next.config.* |
Next.js |
nuxt.config.* |
Nuxt |
pyproject.toml |
Python |
composer.json |
PHP |
pubspec.yaml |
Flutter/Dart |
Cargo.toml |
Rust |
go.mod |
Go |
When to Use
- Starting work on unfamiliar codebase
- Before planning major changes
- Understanding dependencies
- Finding specific code patterns
READ-ONLY
This skill ONLY reads and analyzes.
It does NOT write or modify any files.
Visual Output
For an interactive HTML tree visualization of the codebase:
python3 ${CLAUDE_SKILL_DIR}/scripts/visualize.py .
This generates codebase-map.html with collapsible directories, file sizes, and type-colored indicators.
KB Integration
smart_query("codebase analysis: {technology}")
hybrid_search_kb("project structure {framework}")
Rules
- MUST use
Glob and Grep before Read — scan for shape before opening files
- MUST deliver a map of the codebase (entry points, layers, module boundaries), not a file listing — a tree without interpretation is noise
- NEVER read every file sequentially; target reads via grep patterns and filename globs
- NEVER modify any file — this is a read-only skill
- CRITICAL: when the repo contains generated code (
node_modules, vendor/, dist/, build/), exclude it from scans or the signal drowns in generated noise
- MANDATORY: summarize the stack once at the top (language, framework, package manager, test runner) before diving into structure
Gotchas
find . and ls -R ignore .gitignore by default and include node_modules, vendor/, .venv/, target/. Use git ls-files or fd / rg for a git-aware listing, or explicitly prune.
package.json says "type": "module" → ESM; absence → CommonJS. Mixing them without noticing produces "Cannot use import statement outside a module" errors later; call out the setting in the report.
- Frameworks with file-based routing (Next.js, Nuxt, SvelteKit) treat the
app/ or pages/ tree as the router. A directory listing alone does not reveal routes — the framework convention does. Name the framework first, then the routes.
pyproject.toml can declare multiple project layouts (src/, flat, namespace packages). "Where is the main code" is not obvious without reading [tool.setuptools.packages] or [tool.poetry.packages].
- Large monorepos use workspaces (
pnpm-workspace.yaml, nx.json, turbo.json) with apps and packages. Treating the root as the project conceals the actual component boundaries — surface the workspace topology first.
When NOT to Use
- To explain a specific module's design — use
/explain
- To find a specific identifier or symbol — use
Grep directly or /research-mastery
- To audit architecture for deepening candidates — use
/architecture-audit
- To scaffold a new project — use
/app-builder
- When the user already knows the codebase — skip the overview and jump to the concrete task
1---2name: explore3description: Explores codebase structure, stack, and architecture. Triggers: explore codebase, project structure, stack overview, architecture map.4---56# Codebase Exploration78$ARGUMENTS910Explore and understand a codebase structure.1112## Project context1314- Config files: !`find . -maxdepth 2 -type f -name "*.json" -o -name "*.toml" -o -name "*.yaml" -o -name "*.yml" 2>/dev/null | head -20`1516## Usage1718```19/explore [path]20```2122## What This Command Does23241. **Maps** project structure252. **Identifies** technology stack263. **Finds** key files and patterns274. **Reports** architecture overview2829## Output Format3031```markdown32## Codebase Analysis Report3334### Project Type35- **Language**: [TypeScript/Python/PHP/etc.]36- **Framework**: [Next.js/FastAPI/Laravel/etc.]37- **Package Manager**: [npm/pnpm/pip/composer]3839### Directory Structure40```41project/42├── src/ # Source code43├── tests/ # Test files44├── config/ # Configuration45└── ...46```4748### Key Files49| File | Purpose |50|------|---------|51| `src/index.ts` | Entry point |52| `src/api/` | API routes |5354### Dependencies55- **Runtime**: [list]56- **Dev**: [list]5758### Patterns Detected59- [Pattern 1]60- [Pattern 2]6162### Entry Points63- [Entry 1]64- [Entry 2]65```6667## Technology Detection6869| Marker | Technology |70|--------|------------|71| `package.json` | Node.js |72| `tsconfig.json` | TypeScript |73| `next.config.*` | Next.js |74| `nuxt.config.*` | Nuxt |75| `pyproject.toml` | Python |76| `composer.json` | PHP |77| `pubspec.yaml` | Flutter/Dart |78| `Cargo.toml` | Rust |79| `go.mod` | Go |8081## When to Use8283- Starting work on unfamiliar codebase84- Before planning major changes85- Understanding dependencies86- Finding specific code patterns8788## READ-ONLY8990This skill ONLY reads and analyzes.91It does NOT write or modify any files.9293## Visual Output9495For an interactive HTML tree visualization of the codebase:9697```bash98python3 ${CLAUDE_SKILL_DIR}/scripts/visualize.py .99```100101This generates `codebase-map.html` with collapsible directories, file sizes, and type-colored indicators.102103## KB Integration104105```python106smart_query("codebase analysis: {technology}")107hybrid_search_kb("project structure {framework}")108```109110## Rules111112- **MUST** use `Glob` and `Grep` before `Read` — scan for shape before opening files113- **MUST** deliver a map of the codebase (entry points, layers, module boundaries), not a file listing — a tree without interpretation is noise114- **NEVER** read every file sequentially; target reads via grep patterns and filename globs115- **NEVER** modify any file — this is a read-only skill116- **CRITICAL**: when the repo contains generated code (`node_modules`, `vendor/`, `dist/`, `build/`), exclude it from scans or the signal drowns in generated noise117- **MANDATORY**: summarize the stack once at the top (language, framework, package manager, test runner) before diving into structure118119## Gotchas120121- `find .` and `ls -R` ignore `.gitignore` by default and include `node_modules`, `vendor/`, `.venv/`, `target/`. Use `git ls-files` or `fd` / `rg` for a git-aware listing, or explicitly prune.122- `package.json` says `"type": "module"` → ESM; absence → CommonJS. Mixing them without noticing produces "Cannot use import statement outside a module" errors later; call out the setting in the report.123- Frameworks with file-based routing (Next.js, Nuxt, SvelteKit) treat the `app/` or `pages/` tree as the router. A directory listing alone does not reveal routes — the framework convention does. Name the framework first, then the routes.124- `pyproject.toml` can declare multiple project layouts (src/, flat, namespace packages). "Where is the main code" is not obvious without reading `[tool.setuptools.packages]` or `[tool.poetry.packages]`.125- Large monorepos use workspaces (`pnpm-workspace.yaml`, `nx.json`, `turbo.json`) with apps and packages. Treating the root as the project conceals the actual component boundaries — surface the workspace topology first.126127## When NOT to Use128129- To explain a specific module's design — use `/explain`130- To find a specific identifier or symbol — use `Grep` directly or `/research-mastery`131- To audit architecture for deepening candidates — use `/architecture-audit`132- To scaffold a new project — use `/app-builder`133- When the user already knows the codebase — skip the overview and jump to the concrete task