# Add Language Support

Adds tree-sitter language support to codegraph, with tests and extraction benchmarks.

- Repository: https://github.com/colbymchenry/codegraph (76154 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add colbymchenry/codegraph --skill add-lang -g -a claude-code -y`
Codex: `npx skills add colbymchenry/codegraph --skill add-lang -g -a codex -y`
Cursor: `npx skills add colbymchenry/codegraph --skill add-lang -g -a cursor -y`
Gemini CLI: `npx skills add colbymchenry/codegraph --skill add-lang -g -a gemini-cli -y`

## Description

Add tree-sitter language support to codegraph end-to-end, wire the grammar + extractor, write tests, then benchmark extraction quality and retrieval value on 3 popular real-world repos. Use when the user runs /add-lang <language> or asks to add/support a new language (e.g. Lua, Elixir, Zig, OCaml) in codegraph.

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

# Add a language to CodeGraph

Wire a new tree-sitter language into codegraph's extraction pipeline, prove it
extracts real symbols on popular repos, and prove it beats no-codegraph for an
agent. Runs **fully autonomously**, pick repos, benchmark, update docs, then
report. **Never commit, push, publish, or tag** (house rule); leave all changes
for the user to review.

The argument is the language token used throughout the `Language` union, e.g.
`lua`, `elixir`, `zig`. If none was given, ask which language. Use the lowercase
single-token form everywhere (`csharp`, not `c#`).

## Prerequisites
- Run from the codegraph repo root. `node`, `git`, `gh`, and a logged-in
  `claude` CLI (the benchmark spawns real `claude -p` runs).
- The benchmark uses the local dev build, Step 8 builds + links it on PATH.

## Workflow

Copy this checklist and work through it in order:
```
- [ ] 1. Resolve language; bail early if already supported (just benchmark)
- [ ] 2. Find a grammar + health-check it (ABI / heap corruption)
- [ ] 3. Discover the grammar's AST node types (dump-ast.mjs)
- [ ] 4. Wire the language (4 files; sometimes a 5th core touch)
- [ ] 5. Build + verify-extraction loop until PASS
- [ ] 6. Add extraction tests; make them green
- [ ] 7. Auto-pick 3 popular repos by size tier; add to corpus.json
- [ ] 8. Benchmark all 3: extraction + with/without A/B
- [ ] 9. Update README + CHANGELOG
- [ ] 10. Report; do NOT commit
```

### Step 1, Resolve + short-circuit

Check whether the language is already wired: look for the token in the
`LANGUAGES` const (`src/types.ts`) and the `EXTRACTORS` map
(`src/extraction/languages/index.ts`). If it is already supported (e.g.
`typescript`, `rust`), **skip Steps 2, 6** and go straight to benchmarking
(Steps 7, 8) to validate/measure it, note in the report that no code changed.

### Step 2, Find a grammar, then health-check it

The rest: https://github.com/colbymchenry/codegraph/blob/HEAD/.claude/skills/add-lang/SKILL.md
