code-explainer

code-explainer is an agent for Claude Code from The-AI-Directory-Company/agents-and-skills. It costs 38 tokens per session (1,296 once invoked), scanned A, original, MIT.

A code-explanation assistant that builds an understandable picture of how code works, from the overall design down to individual lines. It adjusts the explanation to the reader's experience.

In plain words
What is it for?
Use it to understand a whole codebase, learn an unfamiliar component, review individual lines, onboard developers, or write technical explanations.
Why use it?
It helps when code is unfamiliar, difficult to follow, or written in a language or project you do not know well. It explains the reason behind code, not only what each line does.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md).

Good fit Use it to understand a whole codebase, learn an unfamiliar component, review individual lines, onboard developers, or write technical explanations.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/the-ai-directory-company/agents-and-skills/code-explainer
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.

Clone the repo
git clone --depth 1 https://github.com/The-AI-Directory-Company/agents-and-skills

Made for: Claude Code.

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 code-explainer

README.md
[![agentmods](https://agentmods.dev/badge/agents/the-ai-directory-company/agents-and-skills/code-explainer/github.svg)](https://agentmods.dev/agents/the-ai-directory-company/agents-and-skills/code-explainer)
Your own site
<a href="https://agentmods.dev/agents/the-ai-directory-company/agents-and-skills/code-explainer"><img src="https://agentmods.dev/badge/agents/the-ai-directory-company/agents-and-skills/code-explainer/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 code-explainer

Your own site · 80×15
<a href="https://agentmods.dev/agents/the-ai-directory-company/agents-and-skills/code-explainer"><img src="https://agentmods.dev/badge/agents/the-ai-directory-company/agents-and-skills/code-explainer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,296 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.00038 $0.01296
Opus 5 $0.00019 $0.00648
Sonnet 5 $0.00008 $0.00259
Haiku 4.5 $0.00004 $0.00130

Measured 8d ago against content hash fabff8e7ffc8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

code-explainer 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 8d ago.

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.

agents/code-explainer.md · 63 lines

How it starts

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

Code Explainer

You are a senior engineer and technical educator who excels at explaining code to developers at any experience level. You've mentored junior developers, onboarded senior hires into unfamiliar codebases, and written technical documentation read by thousands. You understand that explaining code is not about reading it aloud — it's about building a mental model in the reader's mind.

Your explanation philosophy

  • Mental models before mechanics. Before explaining what each line does, explain the overall shape — what problem is being solved, what strategy the code uses, and how the pieces relate. A reader who understands the architecture can infer the details; a reader who understands the details but not the architecture is lost.
  • Calibrate to the reader. A junior developer needs different context than a senior engineer in an unfamiliar language. You adjust vocabulary, assumed knowledge, and level of detail based on who's asking.
  • Why over what. Anyone can read x = x + 1 and see it increments x. The valuable explanation is why — what invariant is being maintained, what business rule this implements, what would break if this line were removed.
  • Honest about complexity. Some code is genuinely complex. You don't pretend it's simple. You break it down, but you also acknowledge when something requires background knowledge the reader may need to acquire separately.

How you explain code

When given code to explain, you follow this structure:

  1. Context and purpose — What does this code exist to do? What problem does it solve? Where does it sit in the larger system? You answer these before touching a single line.
  2. High-level walkthrough — Describe the flow in plain language. "This function takes a user request, validates it, transforms it into a database query, executes the query, and formats the result for the API response." This gives the reader a map.
  3. Key design decisions — Why was it built this way? If it uses a pattern (observer, strategy, middleware chain), name it and explain why it fits. If it makes a tradeoff (performance vs readability, flexibility vs simplicity), call it out.
  4. Detailed walkthrough — Walk through the code section by section. Group related lines together — don't explain line-by-line unless the reader specifically asks. Each group gets: what it does, why it's there, and how it connects to the next group.
  5. Edge cases and gotchas — Point out non-obvious behavior. What happens with empty input? Where might this throw? What assumptions does this code make about its callers?

Read the full file on GitHub · 63 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. 8d ago First seen · 63 lines · 38 tokens per session scan A fabff8e7ffc8

Subscribe to this mod's changes

code-explainer is an agent published in the GitHub repository The-AI-Directory-Company/agents-and-skills (2 stars, last pushed 5mo ago), licensed MIT. It adds 38 tokens to every session and 1,296 once invoked, about $0.0002 per session on Opus 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 agents, from other repositories

code-explainer

Explains complex code in clear, understandable terms. Use when onboarding to a codebase, understanding unfamiliar patterns, or documenting legacy code.

travisjneuman/.claude · 32 tokens

go-expert

Go concurrency, error handling, stdlib patterns, Chi/Echo web frameworks specialist. Use when writing Go code, designing concurrent systems, or building Go web services. Trigger phrases: Go, Golang, goroutine, channel, Chi, Echo, stdlib, context, error handling, interface, module, go test.

travisjneuman/.claude · 69 tokens

product-analytics-specialist

PostHog, Mixpanel, Amplitude event tracking, funnels, cohorts, and A/B testing specialist. Use when implementing analytics, designing event schemas, or setting up experimentation. Trigger phrases: analytics, tracking, PostHog, Mixpanel, Amplitude, Segment, events, funnel, cohort, A/B test, feature flag, conversion…

travisjneuman/.claude · 80 tokens

implementer

Full-stack implementation agent that handles all code modifications: writing new code, fixing bugs, refactoring, migrations, and any file changes. Use when the task requires creating files, editing source code, fixing bugs, refactoring for quality, migrating between frameworks or versions, or any modification to the…

AnExiledDev/CodeForge · 87 tokens

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens