explain-code

explain-code is a skill for Claude Code, Codex from Badhansen/dev-skills. It costs 111 tokens per session (2,121 once invoked), scanned A, original, MIT.

A code explanation tool that turns source code into plain structured descriptions and Excalidraw diagrams. Excalidraw is a browser-based drawing format with a hand-drawn style.

In plain words
What is it for?
It helps explain functions and classes and create class, flow, entity-relationship, component, feature, and sequence diagrams.
Why use it?
It makes unfamiliar code structure, relationships, and execution flow easier to understand than reading files alone.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps explain functions and classes and create class, flow, entity-relationship, component, feature, and sequence diagrams.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/badhansen/dev-skills/explain-code
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Badhansen/dev-skills --skill explain-code
Clone the repo
git clone --depth 1 https://github.com/Badhansen/dev-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for explain-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/badhansen/dev-skills/explain-code/github.svg)](https://agentmods.dev/skills/badhansen/dev-skills/explain-code)
Your own site
<a href="https://agentmods.dev/skills/badhansen/dev-skills/explain-code"><img src="https://agentmods.dev/badge/skills/badhansen/dev-skills/explain-code/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for explain-code

Your own site · 80×15
<a href="https://agentmods.dev/skills/badhansen/dev-skills/explain-code"><img src="https://agentmods.dev/badge/skills/badhansen/dev-skills/explain-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,121 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00111 $0.02121
Opus 5.5 $0.00044 $0.00848
Sonnet 5.5 $0.00022 $0.00424
Haiku 4.5 $0.00011 $0.00212

Measured 1mo ago against content hash 96583b787bb8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

explain-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/generate_diagram.py, scripts/validate_excalidraw.py, scripts/validate.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

explain-code/SKILL.md · 321 lines

How it starts

The opening of the file, as written. The whole thing — 321 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Visualizer with Excalidraw

Explain source code through structured text explanations and hand-drawn style Excalidraw diagrams.

About Excalidraw

  • Open source at excalidraw.com and GitHub
  • Hand-drawn/sketchy aesthetic
  • Real-time collaboration support
  • Browser-based, no sign-up required
  • .excalidraw JSON format
  • Embeddable via @excalidraw/excalidraw npm package

Workflow

  1. Receive code input with optional context
  2. Analyze code structure, patterns, and flow
  3. Select appropriate diagram type(s)
  4. Generate text explanation with key insights
  5. Create .excalidraw JSON diagram
  6. Output to user's working directory or specified location

Input Handling

Accept code in these formats:

<code language="python">
def example():
    pass
</code>

Or with context:

<code language="typescript" context="Authentication module for REST API">
...
</code>

Or request type:

<request type="class_diagram">
Visualize the User authentication system
</request>

Code Analysis

Parse and Identify

Code Element What to Extract
Functions Name, params, return type, calls
Classes Name, methods, properties, inheritance
Modules Imports, exports, dependencies
APIs Endpoints, methods, request/response
Data Models, schemas, transformations

Identify Patterns

  • Control flow (conditionals, loops, error handling)
  • Data flow (input → processing → output)
  • Design patterns (singleton, factory, observer, etc.)
  • Architecture patterns (MVC, layered, microservices)

Diagram Selection

Code Characteristic Recommended Diagram
OOP with inheritance Class Diagram
Process/algorithm logic Flow Diagram
Database models ER Diagram
System modules Component Diagram
API interactions Sequence Diagram
Feature breakdown Feature Diagram
State management State Diagram
High-level overview Architecture Diagram

Read the full file on GitHub · 321 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 321 lines · 111 tokens per session scan A 96583b787bb8

Subscribe to this mod's changes

explain-code is a skill published in the GitHub repository Badhansen/dev-skills (2 stars, last pushed 8mo ago), licensed MIT. It adds 111 tokens to every session and 2,121 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

math-olympiad

Solve competition math problems (IMO, Putnam, USAMO, AIME) with adversarial verification that catches the errors self-verification misses. Activates when asked to 'solve this IMO problem', 'prove this olympiad inequality', 'verify this competition proof', 'find a counterexample', 'is this proof correct', or for any…

anthropics/claude-plugins-official · 163 tokens

google-agents-cli-onboarding

Onboarding entrypoint for agents-cli in Agent Platform. It should be used when the user wants to "create a new agent", "develop an agent", "build an agent using ADK", "run the agent locally", "debug agent code", "test an agent", "evaluate an agent", "deploy an agent", "publish an agent", "monitor an agent", or needs…

google/skills · 95 tokens

huashu-speech-coach

A coach for preparing talks, presentations, training sessions, technical talks, and tutorial videos, based on Patrick Winston’s How to Speak approach.

alchaincyf/huashu-skills · 102 tokens

poteto-help

Guides users through pstack setup, /poteto-mode, and picking the skill, playbook, or principle for a task. Type /poteto-help with a question.

backnotprop/pstack · 40 tokens

practice-cognition

A method for testing ideas in practice, learning from the results, and improving the next attempt through repeated cycles.

HughYau/qiushi-skill · 183 tokens

model-prompt-pack

Use when asked to write prompts for image-to-3D or text-to-3D tools, generate 3D models of a topic's parts, plan the assets for a 3D explorer, or build a labelled parts list with sources. Produces prompts for image-to-3D tools, one per object, plus a parts list for labelling in which every label names a trusted…

mohitagw15856/pm-claude-skills · 104 tokens