explain-code
Scannednpx machina-cli add skill kimliss/claude-code-inhand/explain-code --openclawWhen explaining code, always include:
- Start with an analogy: Compare the code to something from everyday life
- Draw a diagram: Use ASCII art to show the flow, structure, or relationships
- Walk through the code: Explain step-by-step what happens
- Highlight a gotcha: What's a common mistake or misconception?
Keep explanations conversational. For complex concepts, use multiple analogies.
Source
git clone https://github.com/kimliss/claude-code-inhand/blob/main/plugins/dev-toolkit/skills/explain-code/SKILL.mdView on GitHub Overview
Explain-code helps you demystify code by pairing everyday-life analogies with visual ASCII diagrams. It guides you through the code step by step and flags common misconceptions, making complex codebases easier to understand for engineers and new teammates. It's especially useful when someone asks 'how does this work?' or when teaching a codebase.
How This Skill Works
Technically, explain-code starts with an everyday analogy, then presents an ASCII diagram to illustrate flow, structure, or relationships. It then walks through the code line by line, explaining what happens, and finishes by highlighting a gotcha to prevent common mistakes.
When to Use It
- When explaining how a function or module works in a codebase
- During onboarding or knowledge transfer to new teammates
- When reviewing unfamiliar code in a pull request
- In a team workshop or code-along session
- When a user asks 'how does this work?' about a snippet or feature
Quick Start
- Step 1: Share the code snippet or file you want explained
- Step 2: Kick off with a relatable analogy relevant to the code
- Step 3: Draw an ASCII diagram, walk through the code line by line, and call out a gotcha
Best Practices
- Lead with an everyday-life analogy before diving into technical details
- Include an ASCII diagram that clearly maps flow, structure, or relationships
- Walk through the code step by step, narrating each action
- Highlight a gotcha or common misconception for clarity
- Keep explanations conversational and use multiple analogies for complex ideas
Example Use Cases
- Explain a sorting function by analogy (e.g., organizing drawers) and diagram its flow
- Explain a REST API client call with request/response diagram and step-through
- Explain a React component render cycle with a diagram of props/state and updates
- Explain a memoization helper by showing cache lookup and miss path
- Explain a database query builder by mapping it to a menu-selection flow