explain-code
Installation
SKILL.md
Code Explanation Skill
When explaining code, always include these four elements:
- Start with an analogy: Compare the code to something from everyday life to build intuition before diving into details.
- Draw a diagram: Use ASCII art or Mermaid diagrams to show the flow, structure, or relationships between components. Prefer Mermaid for complex flows and class relationships; use ASCII art for simple, quick illustrations.
- Walk through the code: Explain step-by-step what happens.
- Highlight a gotcha: Call out a common mistake or misconception related to the code.
For complex concepts, use multiple analogies.
Output Templates
Structure explanations using these sections as appropriate:
- File/Class: Purpose, Key Concepts, Structure, How It Works, Dependencies & Interactions, Notable Details
- Function/Method: Purpose, Parameters & Return Value, How It Works, Edge Cases & Error Handling, Usage
- Directory/Module: Purpose, Architecture, Key Files, External Interfaces, Data Flow