explain-code

Explains what code does and why using diagrams, tables, and file:line references.

Updated Dec 25, 2021
One-click install
npx skills add https://github.com/kotahashihama/dotfiles --skill explain-code-kotahashihama
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: explain-code
Source: https://github.com/kotahashihama/dotfiles/tree/main/home/.claude/skills/explain-code
Command: npx skills add https://github.com/kotahashihama/dotfiles --skill explain-code-kotahashihama

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Reading unfamiliar code, PRs, or concepts is slow and error-prone, and PR descriptions are often outdated. This Skill reads the actual implementation to verify claims, then explains what the code does and why it is structured that way, so you gain an accurate mental model instead of a stale summary. ## Core Features & Use Cases - Verified Explanations: Reads real code via gh pr diff, git show, and Grep before asserting anything, so explanations reflect the current implementation rather than the PR description. - Two Granularity Modes: Defaults to a high-level overview using Mermaid diagrams and tables, and switches to line-by-line walkthroughs with code excerpts when requested. - Concrete Anchors: Points to key locations with file:line references and, for large targets like full PRs, provides a reading order and a question-to-location index. - Use Case: Ask it to explain PR #3002, and it fetches the diff, reads the surrounding code, and returns a structured explanation with sequence diagrams, a summary table, and pointers to the exact lines that matter. ## Quick Start Ask the assistant to explain what PR 3002 does and why it is implemented that way.

Frequently Asked Questions about explain-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get an explanation of a GitHub pull request?

Pass the PR number or URL as the argument. The skill fetches the PR body with gh pr view and the diff with gh pr diff, reads the key files for context, and returns a structured explanation with diagrams and file:line references.

How to get a line-by-line code walkthrough instead of a summary?

Request it explicitly with phrases like "line by line" or "implementation level" as the second argument. The skill then splits the code into 5-20 line chunks, shows one excerpt per chunk, and explains grammar and language features based on your proficiency.

Does it trust the PR description when explaining code?

No. It treats PR descriptions as potentially outdated and always reads the actual implementation first. Explanations are built from verified code, including callers and type construction sites, not from the author's summary.

Can it modify or fix the code it explains?

No. It only explains and never rewrites code. If it finds a problem, it points it out and waits for your instruction, keeping explanation separate from modification.

When should I use walk-code or explain-review instead?

Use walk-code when you want to build your own code-reading skill by tracing code together step by step. Use explain-review when you need to understand the intent behind review comments and decide how to respond to them.