code-explainer is a Codex skill for turning a local repository or GitHub repository URL into grounded onboarding material. It is explanation-first: it builds a narrative plan from real repo evidence, generates docs and diagrams from that plan, and proves output quality with a shipped self-audit.
A standard run writes:
overview/OVERVIEW.mddeep/ARCHITECTURE_DEEP.mddeep/MODULES_DEEP.mddeep/FLOWS_DEEP.mddeep/DEPENDENCIES_DEEP.mddeep/GLOSSARY.mddiagrams/*.mmddiagrams/svg/*.svgdiagrams/png/*.pngdiagrams/excalidraw/*.excalidraw.jsondiagrams/excalidraw/svg/*.svgdiagrams/excalidraw/png/*.pngmeta/*.json
Important proof artifacts:
meta/explanation_plan.jsonmeta/explanation_quality.jsonmeta/verification_checkpoint.jsonmeta/fact_check_report.jsonmeta/excalidraw_report.jsonmeta/quality_report.json
The older build looked polished but produced weak output. The current contract is stricter:
- explanation planning happens before doc generation
- every diagram has an onboarding purpose
- Mermaid is the canonical diagram source
- editable Excalidraw scenes are generated from the same diagram set
- quality gates fail generic, weakly grounded, or incomplete output
- the repo ships fixture repos and a self-audit path
code-explainer/
SKILL.md
agents/openai.yaml
assets/
fixtures/
templates/
references/
scripts/
README.md
PUBLISHING.md
install_to_codex.ps1
Required:
- Python
3.10+ - Node.js
18+and npm - Git
Recommended:
- Mermaid CLI (
mmdc) from@mermaid-js/mermaid-cli
Windows:
powershell -ExecutionPolicy Bypass -File .\code-explainer\scripts\install_runtime.ps1macOS/Linux:
bash ./code-explainer/scripts/install_runtime.shFrom this repository root:
powershell -ExecutionPolicy Bypass -File .\install_to_codex.ps1This copies the current skill package into ~/.codex/skills/code-explainer. Restart Codex after installation.
cd code-explainer
python scripts/analyze.py analyze \
--source <local_path_or_github_url> \
--output <output_dir> \
--mode standard \
--format markdown \
--explainer-type onboarding \
--audience nontech \
--overview-length medium \
--enable-llm-descriptions true \
--enable-excalidraw-export true \
--enable-official-excalidraw-bridge false \
--ask-before-llm-use false \
--prompt-for-llm-key true \
--persist-llm-key ask \
--enable-web-enrichment falseUseful controls:
--include-glob <pattern>--exclude-glob <pattern>--format markdown|html|both--mode quick|standard|deep--explainer-type onboarding|project-recap|plan-review|diff-review--audience nontech|mixed|engineering--enable-excalidraw-export true|false--enable-official-excalidraw-bridge true|false--persist-llm-key ask|true|false
- Mermaid remains the canonical source of truth.
- The skill exports editable Excalidraw scenes from that Mermaid set.
- The deterministic local scene generator is the default production path.
- The official Excalidraw bridge is opt-in only through
--enable-official-excalidraw-bridge trueand is intended for development experiments, not the default runtime.
- Live model path: set
CODE_EXPLAINER_LLM_API_KEYorOPENAI_API_KEY - Optional overrides:
CODE_EXPLAINER_LLM_BASE_URL,CODE_EXPLAINER_LLM_MODEL - Offline proof path: set
CODE_EXPLAINER_MOCK_LLM=true - If no key is available, the skill prompts for one by default in an interactive terminal.
- The user can choose to persist that key into
code-explainer/.envfor future runs.
If live LLM access is unavailable, the skill records that downgrade in meta/llm_summary.json.
Run the shipped proof path:
cd code-explainer
python scripts/self_audit.pyThis runs the skill against fixture repositories in assets/fixtures/ and writes proof artifacts under .audit_tmp/code-explainer-self/.
The current build audits at 98.8/100 and is production-grade under the local audit-skill rubric. The self-audit currently proves:
2fixture repositories5diagrams per fixture5Excalidraw scenes per fixture97.1explanation-quality score per fixture
See PUBLISHING.md for GitHub publishing and distribution guidance.
MIT. See LICENSE.