# UnrealDocGenerator
Generates compact, agent-readable Markdown documentation from Unreal Engine C++ header files, plus a Claude Code skill for querying it.
## How it works
1. **Parse** — `ue_parser.py` scans UE headers into dataclasses using a position-based scanner (handles nested braces, macros, delegates, namespaces).
2. **Render** — `ue_markdown.py` emits one `.md` per header: only items with C++ doc comments, no deprecated functions, compact enum format.
3. **Index** — `generate.py` produces `type-index.txt`: a flat `TypeName: path/to/File.md` lookup for instant type resolution.
## Usage
```bash
python generate.py
# Examples
python generate.py /path/to/UnrealEngine/Engine/Source/ docs/
python generate.py samples/AIController.h docs/
```
Output: one `.md` per `.h` + `docs/type-index.txt`.
## Querying the docs (Claude Code skill)
The repo includes a Claude Code skill at `.claude/skills/ue-api/` that answers Unreal Engine API questions using the generated docs, falling back to source headers when needed.
Set two environment variables before starting Claude Code:
```bash
export UE_DOCS_PATH=/path/to/your/generated/docs
export UE_ENGINE_ROOT=/path/to/UnrealEngine # optional, for source fallback
```
The skill triggers automatically on UE-related questions. It resolves types via `$UE_DOCS_PATH/type-index.txt` in a single grep, reads the relevant `.md` files, and escalates to source headers for undocumented members, macros, or implementation details.
**Example lookup:**
```bash
grep "^AController:" "$UE_DOCS_PATH/type-index.txt"
# → AController: Engine/Classes/GameFramework/Controller.md
```
## Samples
Three representative UE headers in `samples/` for testing:
| File | Size | Contents |
|---|---|---|
| `GeomUtils.h` | ~6 KB | Free functions in `UE::AI` namespace |
| `AIController.h` | ~22 KB | `AAIController` with movement, BT, perception |
| `GameplayTagsManager.h` | ~43 KB | `UGameplayTagsManager` singleton, delegates, enums |
## Output format
- Functions: `` ##### `Name(params)` → `ReturnType` *(flags)* ``
- Properties: `- \`name\` \`type\` *(flags)* — description`
- Enums: table when values have descriptions, inline `Values: A, B, C` otherwise
- Inheritance: `*Inherits*: [BaseClass](relative/path.md)` with corpus links