/explain
Explain code in detail - what it does, how it works, and why
$ npx -y skills add TheDecipherist/claude-code-mastery --agent claude-code
Command definition
explain.mddescription: Explain code in detail - what it does, how it works, and why
Explain Code
Provide a clear, thorough explanation of the specified code.
Input
The user will provide one of:
- A file path: `/explain src/auth/jwt.ts`
- A file path with line range: `/explain src/auth/jwt.ts:45-80`
- A function/class name: `/explain parseToken`
- Just `/explain` — explain the currently open or most recently discussed file
Explanation Structure
1. Overview (2-3 sentences)
What does this code do at a high level? What problem does it solve?
2. Key Components
Break down the major parts:
## Function: functionName
**Purpose:** One sentence description
**Parameters:**
- `param1` (type) — what it's for
- `param2` (type) — what it's for
**Returns:** What and when
**Side effects:** Any mutations, API calls, state changes
3. Control Flow
Explain the execution path: 1. First, it does X 2. Then checks Y 3. If Y is true, Z happens 4. Otherwise, W happens
Use a simple flowchart for complex logic:
Input → Validate → Transform → Output
↓
Error → Log → Return null4. Dependencies
What does this code depend on?
- External libraries
- Internal modules
- Environment variables
- Database/API connections
5. Gotchas & Edge Cases
Things that might surprise someone:
- Non-obvious behavior
- Edge cases handled (or not handled)
- Performance considerations
- Known limitations
6. Usage Example
Show how to use this code:
// Example usage
const result = functionName(arg1, arg2);
Tone
- Assume the reader is a competent developer unfamiliar with this specific code
- Avoid jargon unless defining it
- Use "this code" not "the code" for clarity
- Be concise but complete
Read more
description: Explain code in detail - what it does, how it works, and why
Explain Code
Provide a clear, thorough explanation of the specified code.
Input
The user will provide one of:
- A file path: `/explain src/auth/jwt.ts`
- A file path with line range: `/explain src/auth/jwt.ts:45-80`
- A function/class name: `/explain parseToken`
- Just `/explain` — explain the currently open or most recently discussed file
Explanation Structure
1. Overview (2-3 sentences)
What does this code do at a high level? What problem does it solve?
2. Key Components
Break down the major parts:
## Function: functionName **Purpose:** One sentence description **Parameters:** - `param1` (type) — what it's for - `param2` (type) — what it's for **Returns:** What and when **Side effects:** Any mutations, API calls, state changes
3. Control Flow
Explain the execution path: 1. First, it does X 2. Then checks Y 3. If Y is true, Z happens 4. Otherwise, W happens
Use a simple flowchart for complex logic:
Input → Validate → Transform → Output
↓
Error → Log → Return null4. Dependencies
What does this code depend on?
- External libraries
- Internal modules
- Environment variables
- Database/API connections
5. Gotchas & Edge Cases
Things that might surprise someone:
- Non-obvious behavior
- Edge cases handled (or not handled)
- Performance considerations
- Known limitations
6. Usage Example
Show how to use this code:
// Example usage const result = functionName(arg1, arg2);
Tone
- Assume the reader is a competent developer unfamiliar with this specific code
- Avoid jargon unless defining it
- Use "this code" not "the code" for clarity
- Be concise but complete
The complete guide to maximizing Claude Code: Global CLAUDE.md, MCP Servers, Commands, Hooks, Skills, and Why Single-Purpose Chats Matter. This version is obsolete by now.
Other commands on claude-code-mastery.
review
CommandReview code changes for bugs, security issues, and improvements
test
CommandGenerate tests for code - unit tests, integration tests, or edge cases
More commands from other plugins.
compare
CommandCompare two or more options side by side, recommend one, and let the reader pick in the page
commit-smart
CommandCreate smart commit with quality checks and conventional format
maintainer
CommandMeta-skill that loads all llmwiki governance docs and exposes the three maintainer slash commands.

