analyze-codebase API Reference
analyze-codebase API
Section titled “analyze-codebase API”Quick Reference
- File:
skills/analyze-codebase.md(181 lines)- Input: Project root directory
- Output:
docs/analysis.md- Dependencies: None (first in pipeline)
Interface
Section titled “Interface”| Parameter | Type | Required | Description |
|---|---|---|---|
| PROJECT_PATH | path | Yes | Absolute path to project root |
| SCOPE | enum | Yes | full (all dirs) or focused (specific dir) |
| FOCUS_TARGET | string | No | Directory name when scope is focused |
Output Schema
Section titled “Output Schema”The skill generates docs/analysis.md with these sections:
| Section | Content |
|---|---|
| Quick Reference | Project name, type, languages, frameworks, LOC |
| Architecture | Mermaid graph TB diagram of layers |
| Directory Structure | Annotated tree of important directories |
| Dependencies | Table: category, package, version, purpose |
| Route Map | Table: method, path, handler, auth |
| Database Schema | Table: table, columns, relationships |
| Key Files | Table: file, role, lines |
| Test Coverage | Table: framework, test files, coverage |
Scanning Procedure
Section titled “Scanning Procedure”- Read README.md, package.json, Makefile
- Detect tech stack from config files (20+ patterns)
- Map 6 architecture layers (presentation → data)
- Identify entry points (server, routes, CLI)
- Extract route map from controllers
- Extract database schema from models/migrations
- Analyze dependency graph
- Detect test framework and coverage
- Trace actual code — never guess from filenames
- Cite every finding:
(file_path:line_number) - Output file must be named
analysis.md(not_analysis.md) - Use Mermaid dark-mode colors
- Include Quick Reference card at top