β¨ Interactive code walkthroughs with editor highlighting and AI-powered voice narration.
A coding agent skill that scans your codebase, builds a walkthrough plan, and explains code segment-by-segment β highlighting lines in VS Code / Cursor with a dedicated sidebar panel and narrating with natural-sounding local TTS. Works with Claude Code, Codex, OpenCode, Kilo Code, Amp, and more.
π¬ Watch Demo Β Β·Β π Read Writeup
- πͺ VS Code Sidebar β Dedicated sidebar panel with walkthrough controls, segment navigation, and live explanation display
- π― Code Highlighting β Automatically opens files, scrolls to code, and highlights 1β8 line ranges with per-highlight explanations
- π Local TTS β Natural-sounding voice narration powered by Kokoro-82M (#1 ranked open-source TTS), running locally on Apple Silicon via mlx-audio
- π¬ Three Modes β Walkthrough (hands-free with TTS), Read (text in terminal), or Podcast (single audio file)
- π§ Adaptive Depth β Overview or Deep Dive explanations based on your familiarity
- π Plan-First β Scout finds files, planner builds narrative order, parallel segment agents generate highlights β outline visible immediately, segments stream in as they finish
- πΎ Save & Share β Save walkthroughs to
.walkthrough.jsonfiles, replay later or share with teammates via the repo - β¨οΈ Keyboard Shortcuts β Full keybinding support for hands-free navigation
- π macOS (Apple Silicon recommended for GPU-accelerated TTS)
- π Python 3.10+
- π Node.js 18+
- π₯οΈ VS Code or Cursor with CLI enabled (
codeorcursorcommand)
Just tell your coding agent:
Install the code explainer skill from https://github.com/Royal-lobster/code-explainer
Your agent will clone the repo into the skills directory, run setup.sh, and ask you to reload your editor β all while keeping you in the loop at each step.
π Manual installation
These agents support the skills/<name>/SKILL.md format natively. Clone directly into the skills directory:
| Agent | Install commands |
|---|---|
| Claude Code | git clone https://github.com/Royal-lobster/code-explainer.git ~/.claude/skills/explainer |
| Amp | git clone https://github.com/Royal-lobster/code-explainer.git ~/.config/agents/skills/explainer |
| OpenCode | git clone https://github.com/Royal-lobster/code-explainer.git ~/.config/opencode/skills/explainer |
| Codex CLI | git clone https://github.com/Royal-lobster/code-explainer.git ~/.codex/skills/explainer |
Then run setup:
<SKILLS_DIR>/explainer/setup.sh
# Reload your editor: Cmd+Shift+P β "Developer: Reload Window"These agents use their own rules/instructions format. Clone to any location, run setup, then point your agent's rules at the SKILL.md:
# 1. Clone to a shared location
git clone https://github.com/Royal-lobster/code-explainer.git ~/code-explainer
# 2. Run setup
~/code-explainer/setup.sh
# 3. Reload your editor: Cmd+Shift+P β "Developer: Reload Window"Then add a rule or instruction pointing to the skill:
| Agent | How to add |
|---|---|
| Cursor | Add a .cursor/rules/explainer.mdc file in your project that includes the contents of SKILL.md |
| Windsurf | Append the contents of SKILL.md to ~/.codeium/windsurf/memories/global_rules.md |
| Kilo Code | Copy SKILL.md to ~/.kilocode/rules/explainer.md |
| Roo Code | Copy SKILL.md to ~/.roo/rules/explainer.md |
| Cline | Copy SKILL.md to your .clinerules/explainer.md directory |
Note: The
SKILL.mdreferences relative paths (e.g.,docs/assess.md), so the full repo must exist at the cloned location. For rule-based agents, ensure paths in the copied rules resolve correctly or use absolute paths.
- π Python venv creation with TTS engine (mlx-audio + sounddevice)
- π§© VS Code extension build and installation (.vsix for VS Code + Cursor)
- π£οΈ Voice model download (~330 MB)
- π Script permissions
In your coding agent:
/explainer the authentication system
Or naturally:
Explain how the matching engine works
Walk me through the order flow
How does the WebSocket gateway handle events?
1. π¬ You ask to explain a feature
2. π― Asks your depth preference (Overview / Deep Dive) and delivery mode
3. π Scout sub-agent maps the codebase β discovers relevant files and call chain
Overview path (fast):
4. π Single agent builds plan + highlights in one pass β sends set_plan
Deep Dive path (thorough):
4. πΊοΈ Planner builds narrative order + transition objects
5. β‘ Parallel segment agents generate dense highlights
Waits for all agents to finish, then sends full set_plan to sidebar
6. β
Plan in sidebar + chat β approve, reorder, or skip before playback starts
7. π Walkthrough runs based on your chosen mode:
Walkthrough β sidebar drives playback automatically with TTS narration
Read β step through explanations in terminal, highlights code as you go
Podcast β renders a single audio file of the entire walkthrough
8. π Summarizes key takeaways
| Mode | Description |
|---|---|
| π₯ Walkthrough | Highlights move through code automatically while voice narrates in sync. Hands-free β just watch and listen. |
| π Read | Text explanations in terminal. Highlights code, explains in text, waits for "next". No sidebar or TTS required. |
| ποΈ Podcast | Generates a single audio file of the entire walkthrough. Listen anywhere. |
The VS Code sidebar provides buttons for all walkthrough controls:
βΆοΈ Play / Pause β Toggle walkthrough playback- βοΈ Next / Previous β Navigate between highlights within a segment
- β© Next / Previous Segment β Jump between segments
- β© Speed β Adjust TTS playback speed
- π Volume β Adjust TTS volume
- π£οΈ Voice β Select TTS voice
- π Mute / Unmute β Toggle voice narration
- π Restart β Restart walkthrough from the beginning
- πΎ Save β Save current walkthrough to
.walkthroughs/for later replay - β Close β Close walkthrough (prompts to save if unsaved)
Save walkthroughs as portable JSON files that live in your repo:
# Save via CLI
./scripts/explainer.sh save auth-flow
# Load a saved walkthrough
./scripts/explainer.sh load auth-flow
# List all saved walkthroughs
./scripts/explainer.sh listOr use the VS Code command palette:
- Code Explainer: Save Walkthrough β Save with a custom name
- Code Explainer: Load Walkthrough β Browse and load saved walkthroughs
Saved walkthroughs are stored in .walkthroughs/ at the workspace root with relative file paths, so teammates can pull them and replay on their own machine. The sidebar also shows a browse list of saved walkthroughs when no walkthrough is active.
All shortcuts are active when a walkthrough is running:
| Shortcut | Action |
|---|---|
Ctrl+Shift+Space |
Toggle play / pause |
Ctrl+Shift+] |
Next sub-segment |
Ctrl+Shift+[ |
Previous sub-segment |
Ctrl+Shift+Alt+] |
Next segment |
Ctrl+Shift+Alt+[ |
Previous segment |
Ctrl+Shift+\ |
Stop walkthrough |
Ctrl+Shift+= |
Speed up TTS |
Ctrl+Shift+- |
Speed down TTS |
You can also type commands in your agent's chat:
| Command | Action |
|---|---|
next |
βοΈ Move to next segment |
skip |
β© Skip current segment |
skip to 4 |
π― Jump to segment 4 |
pause |
βΈοΈ Pause walkthrough |
mute / unmute |
π Toggle voice narration |
stop |
βΉοΈ End walkthrough |
Code Explainer uses Kokoro-82M via mlx-audio for high-quality local TTS. Falls back to macOS say if unavailable.
# Change voice
export TTS_VOICE=am_adam # American male
# Change speed
export TTS_SPEED=1.2 # 20% faster| Voice | Description |
|---|---|
af_heart |
πΊπΈ American English, female (default) |
af_bella |
πΊπΈ American English, female |
af_sarah |
πΊπΈ American English, female |
am_adam |
πΊπΈ American English, male |
am_michael |
πΊπΈ American English, male |
bf_emma |
π¬π§ British English, female |
bm_george |
π¬π§ British English, male |
The extension runs an HTTP + WebSocket server on localhost for communication between your coding agent and the VS Code sidebar.
Coding Agent ββHTTPβββΆ Extension Server ββEventsβββΆ Sidebar Webview
β β
Highlight API TTS Audio Stream
β β
VS Code Editor Browser AudioContext
| Component | Description |
|---|---|
π Extension Server (server.ts) |
HTTP + WebSocket server with bearer token auth. Endpoints for plan delivery, state queries, save/load, and long-polling user actions. |
πͺ Sidebar (sidebar.ts) |
Webview panel showing the walkthrough β segment list, per-highlight explanations, and playback controls. |
π Walkthrough (walkthrough.ts) |
State machine managing segment and sub-highlight navigation and playback status. |
π― Highlight (highlight.ts) |
Opens files, scrolls to ranges, and applies gold background decorations. |
π TTS Bridge (tts-bridge.ts) |
Streams audio from the Python TTS server to the sidebar webview via WebSocket. |
π TTS Server (tts_server.py) |
Persistent Python daemon that loads Kokoro once and streams audio over a Unix socket. |
πΎ Storage (storage.ts) |
Save and load walkthroughs as .walkthrough.json files for replay and sharing. |
π‘ Helper Script (explainer.sh) |
CLI wrapper around the HTTP API β used by the coding agent to send plans and poll for user actions. |
code-explainer/
βββ π SKILL.md # AI agent skill instructions
βββ π§ setup.sh # One-command setup script
βββ π scripts/
β βββ π‘ explainer.sh # HTTP API helper for the coding agent
β βββ π tts_server.py # Persistent TTS server (Kokoro-82M)
β βββ ποΈ podcast.py # Podcast mode audio generator
β βββ π reinstall-extension.sh # Quick extension rebuild
βββ π docs/
β βββ π setup.md # Setup reference
β βββ ποΈ uninstall.md # Uninstall guide
β βββ π― assess.md # Preference gathering (depth + delivery mode)
β βββ π scan.md # Scout sub-agent (file discovery + call chain)
β βββ π plan.md # Planner sub-agent (narrative + transition objects)
β βββ β‘ segments.md # Parallel segment agents (highlight generation)
β βββ π₯ walkthrough.md # Walkthrough mode (sidebar + TTS)
β βββ π read.md # Read mode (text in terminal)
β βββ ποΈ podcast.md # Podcast mode (single audio file)
β βββ π£οΈ tts.md # TTS reference (voices, speeds)
βββ π vscode-extension/
βββ π¦ package.json
βββ βοΈ tsconfig.json
βββ π src/
β βββ π extension.ts # Main entry point
β βββ π server.ts # HTTP + WebSocket server
β βββ πͺ sidebar.ts # Webview sidebar provider
β βββ π walkthrough.ts # Walkthrough state machine
β βββ π― highlight.ts # Code highlighting
β βββ π tts-bridge.ts # TTS audio streaming
β βββ πΎ storage.ts # Walkthrough persistence
β βββ π types.ts # Message protocol types
βββ π media/
βββ π¨ icon.svg
βββ πΌοΈ icon.png
βββ π sidebar.js # Sidebar webview script
MIT
