explaining-code
npx machina-cli add skill vigo/claude-skills/explaining-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/vigo/claude-skills/blob/main/explaining-code/SKILL.mdView on GitHub Overview
Explaining-code helps you understand how code works by pairing everyday analogies with ASCII diagrams and a clear walkthrough. It's designed for teaching a codebase, clarifying unfamiliar logic, or answering 'how does this work?' prompts. The explanations stay conversational and adapt analogies to complex ideas to boost intuition.
How This Skill Works
The skill starts with a relatable analogy to frame the concept, then provides an ASCII diagram to visualize flow or relationships. It then walks through the code step-by-step, linking each action to the diagram, and finishes by highlighting a common gotcha or misconception.
When to Use It
- Teaching a new developer about a codebase or module
- Explaining how a function or class works to non-technical stakeholders
- Clarifying code during debugging or code review
- Onboarding to a library, API, or framework
- Answering 'how does this work?' questions about a code snippet
Quick Start
- Step 1: Pick a relatable analogy for the code.
- Step 2: Draw a concise ASCII diagram of the flow.
- Step 3: Walk through the code line-by-line and surface gotchas.
Best Practices
- Lead with a relatable analogy before diving into code
- Include an ASCII diagram that maps to the discussion
- Walk through the code line-by-line with concrete explanations
- Highlight a common gotcha or misconception
- Keep the tone conversational and adapt analogies for complexity
Example Use Cases
- Explain how a for loop processes items in a Python list
- Walk through a React component render flow and state updates
- Show how a SQL query joins tables and returns results
- Demystify a Python decorator or higher-order function
- Clarify how an API client uses bearer tokens and retries