explain
The explain command breaks down code or programming concepts into beginner-friendly language using a structured teaching approach. Use this when you need code clarified through step-by-step logic, everyday analogies, and highlighted key parts rather than technical jargon, making it ideal for learning new programming patterns or understanding unfamiliar code sections.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/huangjia2019/claude-code-engineering/HEAD/05-Commands/projects/01-basic-commands/.claude/commands/explain.md -o ~/.claude/commands/explain.mdexplain.md
Explain the following code or concept: $ARGUMENTS ## Explanation Style Use the "teach a friend" approach: 1. **Start Simple**: One sentence summary of what it does 2. **Break It Down**: Step through the logic 3. **Use Analogies**: Compare to everyday concepts when helpful 4. **Highlight Key Parts**: Point out the important bits ## Output Format ```markdown ## What It Does [One sentence summary] ## How It Works ### Step by Step 1. First, [what happens first] 2. Then, [what happens next] ... ### Key Concepts - **[concept]**: [explanation] ## Example [Simple example if helpful] ## Remember [The one thing to take away] ``` ## Guidelines - Assume the reader is learning - Avoid jargon, or define it when used - Use code examples when they clarify - Keep it concise but complete - If explaining a file, focus on the most important parts
Review code changes for quality, security, and best practices. Proactively use this after code modifications.
Run tests and report results concisely. Use this after code changes to verify everything works.
Analyze log files and extract actionable insights. Use when troubleshooting issues or investigating incidents.
Explore and analyze API-related code. Use when investigating endpoints, routing, or HTTP handling.
Explore and analyze authentication-related code. Use when investigating auth flows, session management, or security.
Explore and analyze database-related code. Use when investigating data models, queries, or persistence.
Analyze root cause of bugs after location is identified. Second step in bug investigation.
Implement bug fixes after analysis is complete. Third step in bug fix pipeline.