# LLM Wiki

Build and maintain a structured LLM-generated wiki for any codebase.

- Repository: https://github.com/staruhub/ClaudeSkills (731 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-08-13
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add staruhub/ClaudeSkills --skill llm-wiki -g -a claude-code -y`
Codex: `npx skills add staruhub/ClaudeSkills --skill llm-wiki -g -a codex -y`
Cursor: `npx skills add staruhub/ClaudeSkills --skill llm-wiki -g -a cursor -y`
Gemini CLI: `npx skills add staruhub/ClaudeSkills --skill llm-wiki -g -a gemini-cli -y`

## Description

Build and maintain a structured LLM-generated wiki for any codebase. Use when the user asks to analyze/understand/document a codebase, build a code wiki, create project documentation from source, or update an existing .llm-wiki. Triggers on phrases like "build wiki", "analyze this codebase", "document this project", "update wiki", "llm-wiki", or when entering an unfamiliar project that has no .llm-wiki yet.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# LLM Wiki for Codebases

Build a persistent, interlinked markdown wiki that captures the architecture, modules, patterns, and APIs of a codebase. The wiki lives in `.llm-wiki/` at the project root. Humans curate and direct; the LLM handles all bookkeeping.

Based on [Andrej Karpathy's LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f): raw sources are "compiled" into a structured wiki that compounds over time.

## Mode Detection

Determine the mode based on current state:

- **No `.llm-wiki/` directory exists** -> Full Build mode
- **`.llm-wiki/` exists** -> Update mode (diff and refresh)

## Full Build Workflow

### Phase 1: Reconnaissance

1. Read top-level files: README, package.json/Cargo.toml/go.mod/pyproject.toml/build.gradle etc.
2. Run `find` or Glob to map the directory tree (ignore node_modules, .git, vendor, dist, build, __pycache__, .venv)
3. Identify: language(s), framework(s), build system, entry point(s), test framework
4. Count files per directory to gauge module boundaries
5. Read CLAUDE.md / AGENTS.md / .cursor/rules if present - they contain valuable architectural context

Record findings in `.llm-wiki/_schema.md` (see references/wiki-schema.md for format).

### Phase 2: Skeleton

Create the directory structure:

```
.llm-wiki/
  _schema.md          # Wiki conventions and project metadata
  _index.md           # Content-oriented catalog by category
  _log.md             # Chronological build/update log
  architecture/       # High-level design docs
  modules/            # Per-module deep dives
  concepts/           # Cross-cutting concepts (auth, caching, error handling...)
  apis/               # API surface docs (REST endpoints, CLI commands, exported functions)
  guides/             # How-to guides (setup, deployment, testing)
```

### Phase 3: Core Articles

Write articles in priority order. See references/article-templates.md for templates.

The rest: https://github.com/staruhub/ClaudeSkills/blob/HEAD/llm-wiki/SKILL.md
