$npx -y skills add softspark/ai-toolkit --skill exploreExplores codebase structure, stack, and architecture. Triggers: explore codebase, project structure, stack overview, architecture map.
| 1 | # Codebase Exploration |
| 2 | |
| 3 | $ARGUMENTS |
| 4 | |
| 5 | Explore and understand a codebase structure. |
| 6 | |
| 7 | ## Project context |
| 8 | |
| 9 | - Config files: !`find . -maxdepth 2 -type f -name "*.json" -o -name "*.toml" -o -name "*.yaml" -o -name "*.yml" 2>/dev/null | head -20` |
| 10 | |
| 11 | ## Usage |
| 12 | |
| 13 | ``` |
| 14 | /explore [path] |
| 15 | ``` |
| 16 | |
| 17 | ## What This Command Does |
| 18 | |
| 19 | 1. **Maps** project structure |
| 20 | 2. **Identifies** technology stack |
| 21 | 3. **Finds** key files and patterns |
| 22 | 4. **Reports** architecture overview |
| 23 | |
| 24 | ## Output Format |
| 25 | |
| 26 | ```markdown |
| 27 | ## Codebase Analysis Report |
| 28 | |
| 29 | ### Project Type |
| 30 | - **Language**: [TypeScript/Python/PHP/etc.] |
| 31 | - **Framework**: [Next.js/FastAPI/Laravel/etc.] |
| 32 | - **Package Manager**: [npm/pnpm/pip/composer] |
| 33 | |
| 34 | ### Directory Structure |
| 35 | ``` |
| 36 | project/ |
| 37 | ├── src/ # Source code |
| 38 | ├── tests/ # Test files |
| 39 | ├── config/ # Configuration |
| 40 | └── ... |
| 41 | ``` |
| 42 | |
| 43 | ### Key Files |
| 44 | | File | Purpose | |
| 45 | |------|---------| |
| 46 | | `src/index.ts` | Entry point | |
| 47 | | `src/api/` | API routes | |
| 48 | |
| 49 | ### Dependencies |
| 50 | - **Runtime**: [list] |
| 51 | - **Dev**: [list] |
| 52 | |
| 53 | ### Patterns Detected |
| 54 | - [Pattern 1] |
| 55 | - [Pattern 2] |
| 56 | |
| 57 | ### Entry Points |
| 58 | - [Entry 1] |
| 59 | - [Entry 2] |
| 60 | ``` |
| 61 | |
| 62 | ## Technology Detection |
| 63 | |
| 64 | | Marker | Technology | |
| 65 | |--------|------------| |
| 66 | | `package.json` | Node.js | |
| 67 | | `tsconfig.json` | TypeScript | |
| 68 | | `next.config.*` | Next.js | |
| 69 | | `nuxt.config.*` | Nuxt | |
| 70 | | `pyproject.toml` | Python | |
| 71 | | `composer.json` | PHP | |
| 72 | | `pubspec.yaml` | Flutter/Dart | |
| 73 | | `Cargo.toml` | Rust | |
| 74 | | `go.mod` | Go | |
| 75 | |
| 76 | ## When to Use |
| 77 | |
| 78 | - Starting work on unfamiliar codebase |
| 79 | - Before planning major changes |
| 80 | - Understanding dependencies |
| 81 | - Finding specific code patterns |
| 82 | |
| 83 | ## READ-ONLY |
| 84 | |
| 85 | This skill ONLY reads and analyzes. |
| 86 | It does NOT write or modify any files. |
| 87 | |
| 88 | ## Visual Output |
| 89 | |
| 90 | For an interactive HTML tree visualization of the codebase: |
| 91 | |
| 92 | ```bash |
| 93 | python ${CLAUDE_SKILL_DIR}/scripts/visualize.py . |
| 94 | ``` |
| 95 | |
| 96 | This generates `codebase-map.html` with collapsible directories, file sizes, and type-colored indicators. |
| 97 | |
| 98 | ## KB Integration |
| 99 | |
| 100 | ```python |
| 101 | smart_query("codebase analysis: {technology}") |
| 102 | hybrid_search_kb("project structure {framework}") |
| 103 | ``` |
| 104 | |
| 105 | ## Rules |
| 106 | |
| 107 | - **MUST** use `Glob` and `Grep` before `Read` — scan for shape before opening files |
| 108 | - **MUST** deliver a map of the codebase (entry points, layers, module boundaries), not a file listing — a tree without interpretation is noise |
| 109 | - **NEVER** read every file sequentially; target reads via grep patterns and filename globs |
| 110 | - **NEVER** modify any file — this is a read-only skill |
| 111 | - **CRITICAL**: when the repo contains generated code (`node_modules`, `vendor/`, `dist/`, `build/`), exclude it from scans or the signal drowns in generated noise |
| 112 | - **MANDATORY**: summarize the stack once at the top (language, framework, package manager, test runner) before diving into structure |
| 113 | |
| 114 | ## Gotchas |
| 115 | |
| 116 | - `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. |
| 117 | - `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. |
| 118 | - 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. |
| 119 | - `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]`. |
| 120 | - 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. |
| 121 | |
| 122 | ## When NOT to Use |
| 123 | |
| 124 | - To explain a specific module's design — use `/explain` |
| 125 | - To find a specific identifier or symbol — use `Grep` directly or `/research-mastery` |
| 126 | - To audit architecture for deepening candidates — use `/architecture-audit` |
| 127 | - To scaffold a new project — use `/app-builder` |
| 128 | - When the user already knows the codebase — skip the overview and jump to the concrete task |