codebase-summary
Codebase Summary
Generate comprehensive codebase documentation optimized for AI assistants and developers.
Parameters
Gather all parameters upfront in a single prompt:
| Parameter | Default | Description |
|---|---|---|
codebase_path |
Current directory | Path to analyze |
output_dir |
.sop/summary |
Documentation output directory |
consolidate |
false |
Create consolidated file at codebase root |
consolidate_target |
AGENTS.md |
Target: AGENTS.md, README.md, or CONTRIBUTING.md |
check_consistency |
true |
Check for cross-document inconsistencies |
check_completeness |
true |
Identify documentation gaps |
update_mode |
false |
Update existing docs based on git changes |
Workflow
Step 1: Setup
- Validate
codebase_pathexists - Create
output_dirif needed - If
update_modeandindex.mdexists:- Run
git log --oneline -20to identify recent changes - Focus analysis on modified components
- Run
Step 2: Analyze Structure
Run the structure analyzer:
python {baseDir}/scripts/analyze_structure.py "{codebase_path}" --depth 4 --output "{output_dir}/codebase_info.md"
Run the dependency extractor:
python {baseDir}/scripts/extract_dependencies.py "{codebase_path}" --output "{output_dir}/dependencies.md"
Then manually analyze:
- Identify packages, modules, major components
- Map architectural patterns (MVC, microservices, etc.)
- Find key interfaces, APIs, entry points
Step 3: Generate Documentation
Create these files in {output_dir}/:
index.md - Primary AI context file:
- AI instructions for using the documentation
- Quick reference table mapping questions to files
- Table of contents with summaries for each file
- Brief codebase overview
architecture.md:
- System architecture with Mermaid
graphdiagram - Layer descriptions
- Design patterns used
- Key design decisions with rationale
components.md:
- Component overview with Mermaid
classDiagram - Per-component: purpose, location, key files, dependencies, interface
interfaces.md:
- API endpoints with request/response formats
- Internal interfaces and implementations
- Error codes and handling
data_models.md:
- ER diagram with Mermaid
erDiagram - Per-model: table, fields, indexes, relationships
workflows.md:
- Key processes with Mermaid
sequenceDiagram - Step-by-step breakdowns
- Error handling
See {baseDir}/references/documentation-templates.md for templates.
Step 4: Review
If check_consistency:
- Verify terminology consistency across documents
- Check cross-references are valid
If check_completeness:
- Identify undocumented components
- Note gaps from language/framework limitations
Save findings to {output_dir}/review_notes.md.
Step 5: Consolidate (if enabled)
If consolidate is true:
- Create file at codebase root (not in output_dir)
- Use
consolidate_targetas filename - Tailor content to target:
| Target | Focus |
|---|---|
| AGENTS.md | AI context, directory structure, coding patterns, testing |
| README.md | Project overview, installation, usage, getting started |
| CONTRIBUTING.md | Dev setup, coding standards, contribution workflow |
Default AGENTS.md prompt: Focus on information NOT in README.md or CONTRIBUTING.md—file purposes, directory structure, coding patterns, testing instructions, package guidance.
Step 6: Summary
Report:
- What was documented
- Next steps for using documentation
- How to add index.md to AI assistant context
- If
update_mode: summarize detected changes
Output Structure
{consolidate_target} # At codebase root if consolidate=true
{output_dir}/
├── index.md # Primary AI context (read this first)
├── codebase_info.md # Structure analysis output
├── architecture.md # System architecture
├── components.md # Component details
├── interfaces.md # APIs and interfaces
├── data_models.md # Data models
├── workflows.md # Key workflows
├── dependencies.md # Dependencies output
└── review_notes.md # Review findings
Progress Indicators
Provide updates:
Setting up...
✅ Created {output_dir}
Analyzing structure...
✅ Found X packages across Y languages
✅ Identified Z components
Generating documentation...
✅ Created index.md
✅ Generated architecture.md, components.md...
Reviewing...
✅ Consistency check complete
✅ Found N gaps documented in review_notes.md
Done!
✅ Documentation at {output_dir}
✅ Primary context file: {output_dir}/index.md
Resources
- Scripts:
{baseDir}/scripts/analyze_structure.py,{baseDir}/scripts/extract_dependencies.py - Templates:
{baseDir}/references/documentation-templates.md
More from m31uk3/ai-skills
response-quality-analysis
Analyze whether your response addresses the actual question asked before posting. Use when: (1) About to post response to forum/Slack question, (2) Want to validate response coverage, (3) Need to ensure solving the right problem, (4) Want specific improvement suggestions for gaps in response
5skill-resiliency
This skill should be used when the user asks to "add resiliency to a skill", "make this skill more robust", "improve error handling", "add validation mechanisms", "create self-correcting behavior", or discusses determinism, robustness, error correction, or homeostatic patterns in Agent Skills. Applies biological resiliency principles from Michael Levin's work to Agent Skill design.
4guided-ooda-loop
Universal pattern for structured LLM interaction managing finite context windows through phased progression (Observe-Orient-Decide-Act). Use when the user has a complex problem, wants to design/build/create something (software, strategy, document, process), or uses phrases like "I have an idea for...", "help me design...", "guide me through...", or mentions OODA, RPI, or PDD. Reduces hallucinations through structured interaction.
3writing-eval-sloptastic
Quantitative framework for detecting AI-generated "slop" in prose through systematic analysis of structural, lexical, rhetorical, and logical patterns. Use when analyzing text authenticity, evaluating writing quality, detecting AI-generated content, or assessing whether prose has characteristic AI patterns like excessive parallelism, abstraction laddering, chiasmus abuse, platitudes, tautologies, or rhetorical overengineering.
3transcribing-youtube
Download and transcribe YouTube videos into clean, deduplicated Markdown documents with chapter headings. Wraps yt-dlp to fetch subtitles (manual or auto-generated), removes the rolling-text triplication artifacts from auto-subs, inserts chapter markers from video metadata, and produces both a timestamped transcript and a prose-only version. Use when the user wants to: (1) transcribe a YouTube video, (2) get a transcript or subtitles from YouTube, (3) create an InfoNugget from a video, (4) extract text from a YouTube URL or video ID, or (5) mentions yt-dlp, YouTube transcript, or video subtitles.
3ai-workflow-engineering
Guide for creating reliable AI workflows and SOPs. Use when: (1) User wants to create a structured workflow for AI tasks, (2) User needs to build an SOP for complex processes, (3) User wants to ensure their workflow follows best practices for managing LLM uncertainty, (4) User mentions creating workflows for domains like code review, response analysis, documentation, or any structured process
3