Slash command
/explain
Explains how a file, function, or feature works — traces the real call path instead of guessing from names.
Install to
~/.claude/commands/explain.md descriptionExplain how a piece of the codebase works, grounded in the actual code.
argument-hint[file, function, or feature to explain]
Explain how $ARGUMENTS works.
- Find it: grep/glob for the symbol or file. Read it.
- Trace one level out — who calls it, what it calls, what data flows through. Read those too; don’t infer behavior from names.
- Explain in this shape:
- What it does — one sentence.
- How it works — the real steps, in order, citing
file:line. - Why it’s built this way — any non-obvious constraint or tradeoff you can see in the code or comments.
- Gotchas — edge cases, surprising behavior, anything a newcomer would trip on.
Keep it concrete. Quote small snippets. If something is genuinely unclear from the code, say so rather than inventing an explanation.
---
description: Explain how a piece of the codebase works, grounded in the actual code.
argument-hint: [file, function, or feature to explain]
---
Explain how **$ARGUMENTS** works.
1. Find it: grep/glob for the symbol or file. Read it.
2. Trace one level out — who calls it, what it calls, what data flows
through. Read those too; don't infer behavior from names.
3. Explain in this shape:
- **What it does** — one sentence.
- **How it works** — the real steps, in order, citing `file:line`.
- **Why it's built this way** — any non-obvious constraint or tradeoff
you can see in the code or comments.
- **Gotchas** — edge cases, surprising behavior, anything a newcomer
would trip on.
Keep it concrete. Quote small snippets. If something is genuinely
unclear from the code, say so rather than inventing an explanation. How to install
- Copy the code and save it to
~/.claude/commands/explain.md(user) or.claude/commands/explain.md(project). - Commands hot-reload — it's available in the current session immediately.
- Run it by typing
/explainin the prompt. - Verify: type
/and look for it in the command list.