> ## Documentation Index
> Fetch the complete documentation index at: https://www.opendirectory.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# docs-from-code

> Automatically generate and maintain README.md, API reference docs, and an Architecture section by reading your codebase. Uses graphify to build a knowledge g...

<Info>
  **Category:** Developer Tools · **Version:** `1.0.0` · **Author:** `OpenDirectory` · **Compatibility:** All targets (claude, codex, opencode, gemini, anti-gravity, openclaw, hermes)
</Info>

![docs-from-code](https://github.com/user-attachments/assets/493c7c61-9aa9-48e9-a71b-7c77c8c6a949)

Automatically generate and maintain README.md, API reference docs, and an Architecture section by reading your codebase. Uses [graphify](https://github.com/safishamsi/graphify) to build a knowledge graph first, then uses AI to write clean documentation grounded in what actually exists.

## Install

<Tabs>
  <Tab title="npx CLI (Recommended)">
    ```bash theme={null}
    npx "@opendirectory.dev/skills" install docs-from-code --target claude
    ```
  </Tab>

  <Tab title="skills.sh">
    ```bash theme={null}
    npx skills add Varnan-Tech/opendirectory --skill docs-from-code
    ```
  </Tab>

  <Tab title="Claude Code Native">
    ```bash theme={null}
    /plugin marketplace add Varnan-Tech/opendirectory
    /plugin install opendirectory-gtm-skills@opendirectory-marketplace
    ```
  </Tab>

  <Tab title="Claude Desktop">
    <video controls className="w-full aspect-video rounded-xl mb-4" src="https://github.com/user-attachments/assets/cea8b565-2002-4a87-8857-d902bfcfdc1c" />

    1. Copy `https://github.com/Varnan-Tech/opendirectory/tree/main/skills/docs-from-code` into [download-directory.github.io](https://download-directory.github.io/) to download the ZIP.
    2. Open **Claude Desktop** -> **Customize** -> **Skills** -> **+** -> **Upload a skill** and drop the folder containing `SKILL.md`.
  </Tab>

  <Tab title="Manus AI">
    <video controls className="w-full aspect-video rounded-xl mb-4" src="https://github.com/user-attachments/assets/17cbee2a-9e17-4bd4-ac46-68e0e92ffab4" />

    [**Install docs-from-code in Manus AI**](https://manus.im/import-skills?githubUrl=https%3A%2F%2Fgithub.com%2FVarnan-Tech%2Fopendirectory%2Ftree%2Fmain%2Fskills%2Fdocs-from-code\&utm_source=opendirectory)
  </Tab>
</Tabs>

## What It Generates

| Output | When |
| - | - |
| `README.md` (full) | Project has no README |
| `README.md` (sections) | README exists but API or architecture sections are stale |
| `docs/API.md` | Project has HTTP routes |
| Architecture section | Always, from graphify's god nodes and communities |
| GitHub PR | When you ask it to open one |

## Why graphify?

The skill uses graphify as its extraction engine:

* 20 languages via tree-sitter AST: Python, TypeScript, Go, Rust, Java, and 15 more
* Architecture insight: god nodes and community clusters show what everything connects through
* 71.5x fewer tokens than reading raw files, efficient on large codebases
* SHA256 cache: re-runs only process changed files
* Honest tagging: `EXTRACTED` (found in source) vs `INFERRED` (reasonable inference with confidence score)
* Extracts rationale from `# NOTE:`, `# WHY:`, `# HACK:` comments and docstrings

The bundled `scripts/` (TypeScript and Python AST extractors) serve as a fallback if graphify is unavailable.

## Supported Languages (via graphify)

Python, TypeScript, JavaScript, Go, Rust, Java, C, C++, Ruby, C#, Kotlin, Scala, PHP, Swift, Lua, Zig, PowerShell, Elixir, Objective-C, Julia

## Requirements

* Python 3.10+ (for graphify)
* Node.js 18+ (for fallback TypeScript extractor)
* `gh` CLI (optional, for opening PRs automatically)
* `GITHUB_TOKEN` env var (optional, for PRs)

## Setup

### 1. Set up graphify

```bash theme={null}
pip install graphifyy
```

No API keys needed for extraction. graphify uses your agent's existing model access.

### 2. Configure (Optional)

```bash theme={null}
cp .env.example .env
# Add GITHUB_TOKEN if you want auto-PR support
```

## How to Use

Be inside your project and ask:

```
"Generate a README for this project"
"My API docs are out of date, update them from the code"
"Create docs/API.md from my FastAPI routes"
"Add an architecture section to our README"
"Document this TypeScript library"
```

The agent will:

1. Run `graphify . --no-viz` to build a knowledge graph of your codebase
2. Read `GRAPH_REPORT.md` for god nodes, communities, and architecture insights
3. Query the graph for routes, types, and data models
4. Read existing docs to understand what needs updating
5. Generate accurate docs grounded in the graph
6. Write files and optionally open a GitHub PR

## Project Structure

```
docs-from-code/
├── SKILL.md                         # Agent instructions
├── README.md                        # This file
├── .env.example                     # Environment variables template
├── scripts/
│   ├── package.json                 # Script dependencies (ts-morph)
│   ├── extract_ts.ts                # TypeScript/JS AST extractor
│   └── extract_py.py                # Python AST extractor
├── references/
│   ├── extraction-guide.md          # Per-framework extraction notes
│   └── output-template.md          # README and API.md templates
└── evals/
    └── evals.json                   # Test prompts
```

## License

MIT


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.