Skip to content

ekohe/codebase-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codebase Docs

An AI agent skill that generates comprehensive markdown documentation from any codebase. Point it at a repo, and it produces structured docs covering project structure, database schema, features, API endpoints, architecture, and frontend components.

Supported Stacks

Stack Detection
Ruby on Rails Gemfile with rails
React / Next.js package.json with react or next
Python (Django / FastAPI / Flask) requirements.txt or pyproject.toml
Node.js (Express / Fastify / NestJS) package.json with framework dependency
Go (net/http, Gin, Echo, Fiber) go.mod
iOS (SwiftUI / UIKit) .xcodeproj or .xcworkspace
Generic / Polyglot Fallback for unrecognized stacks

What It Generates

Each run produces up to 6 markdown documents, depending on what the codebase contains:

Document Contents
structure.md Directory layout, tech stack, config files, setup instructions
database.md Tables, columns, relationships, indexes, ER diagrams
features.md Business logic, core features, background jobs, integrations
api.md Endpoints, request/response formats, authentication
architecture.md Design patterns, request lifecycle, data flow (with mermaid diagrams)
frontend.md Components, routing, state management, styling approach

An index.md is also generated to link all documents together.

Installation

One-Command Install

curl -fsSL https://raw.githubusercontent.com/ekohe/codebase-docs/main/install.sh | bash

This installs the skill to ~/.claude/skills/codebase-docs/ (and ~/.cursor/skills/codebase-docs/ if Cursor is detected).

Manual Install

git clone https://github.com/ekohe/codebase-docs.git
cd codebase-docs

# For Claude Code
mkdir -p ~/.claude/skills/codebase-docs
cp -R SKILL.md references/ scripts/ ~/.claude/skills/codebase-docs/

# For Cursor
mkdir -p ~/.cursor/skills/codebase-docs
cp -R SKILL.md references/ scripts/ ~/.cursor/skills/codebase-docs/

Usage

As an Agent Skill (recommended)

Once installed, the skill activates automatically when you ask Claude to document a codebase:

"Document this repo"
"Generate docs for my project"
"Write up what this codebase does"
"Create technical documentation"

Claude will detect the framework, read the relevant source files, and generate the documentation.

As a Standalone Script

The included Python script calls the Anthropic API directly to generate docs:

pip install anthropic
export ANTHROPIC_API_KEY="your-key"

# Generate all dimensions
python scripts/generate_docs.py --repo /path/to/repo --output ./docs

# Generate specific dimensions only
python scripts/generate_docs.py --repo /path/to/repo --dimensions structure,api,database

Available dimensions: structure, database, features, api, architecture, frontend.

How It Works

  ┌─────────────┐     ┌──────────────┐     ┌──────────────┐     ┌────────────┐
  │   Detect     │────▶│   Select     │────▶│   Collect    │────▶│  Generate  │
  │   Stack      │     │   Dimensions │     │   Files      │     │  Markdown  │
  └─────────────┘     └──────────────┘     └──────────────┘     └────────────┘
   Gemfile? go.mod?    structure, api,      Framework-specific    Structured
   package.json?       database, etc.       file selection        prompts per
   .xcodeproj?                              (lean context)        dimension
  1. Detection — Scans for indicator files (Gemfile, package.json, go.mod, etc.) to identify the tech stack
  2. Dimension selection — Picks which docs to generate based on what the codebase contains (e.g., skip database.md if no DB is detected)
  3. File collection — Reads only the files relevant to each dimension using framework-specific strategies (defined in references/*.md), keeping context lean
  4. Generation — Uses structured prompts to produce each markdown document, including mermaid diagrams where appropriate

Project Structure

codebase-docs/
├── SKILL.md                    # Skill definition (prompts, detection, workflow)
├── install.sh                  # One-command installer
├── scripts/
│   └── generate_docs.py        # Standalone doc generation script
└── references/                 # Framework-specific file selection guides
    ├── ios.md                  # iOS (SwiftUI, UIKit)
    ├── ruby-on-rails.md        # Ruby on Rails
    ├── react-next.md           # React / Next.js
    ├── python-web.md           # Django, FastAPI, Flask
    ├── node.md                 # Express, Fastify, NestJS
    ├── go.md                   # Go
    └── generic.md              # Unknown / polyglot repos

License

MIT

About

AI agent skill that generates comprehensive markdown documentation from any codebase

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors