agentleFS
bradydwardaibradydwardai/claude-skills/skills/explain-code/SKILL.md

explain-code

Skill0 starsChanged 3 months agoMITView on GitHub

When the user wants a piece of code explained clearly — with a real-world analogy, a visual diagram, a line-by-line walkthrough, key concepts, common gotchas, and how to modify it. Also use when the user says 'explain this code,' 'what does this do,' 'walk me through this,' 'I don't understand this function,' 'help me onboard to this codebase,' or 'explain this to a beginner.' Designed for learning unfamiliar code or explaining code to someone less technical.

48 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use explore-codebase, write-tests and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • srclightSkill

    explore-codebase

    This skill should be used when the user asks to "explore this codebase", "understand this project", "give me an overview", "how does this work", "onboard me", "walk me through the architecture", "map the codebase", or any request to understand a codebase's structure, architecture, or design.

    Also in 3 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 6 projects that use this

  • Google CloudSkill

    open-pr

    Commits local changes to a new Git branch and opens a GitHub pull request through the configured GitHub MCP server. Use when proposing code changes in a new pull request. Don't use for local-only commits without a remote GitHub repository.

    Also in 3 projects that use this

  • GitHubSkill

    refactor

    Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

    Also in 4 projects that use this

  • SentrySkill

    commit

    Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.

    Also in 9 projects that use this

  • OpenAISkill

    writing-plans

    Use when you have a spec or requirements for a multi-step task, before touching code

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 40 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When you need to understand unfamiliar code, onboard onto a project, or explain code to someone less technical.

    line 15
  2. Distinctive:

    When asked to explain code, provide ALL of the following sections:

    line 19
  3. Distinctive:

    Start with a relatable analogy that captures what this code does.

    line 22
  4. Distinctive:

    Create an ASCII or Mermaid diagram showing the flow:

    line 27
  5. Distinctive:

    If you wanted to change this code, here's how:

    line 71
  6. Distinctive:

    Use "we" language: "Here we're checking if..."

    line 78
  7. Distinctive:

    Never condescending: avoid "simply", "just", "obviously"

    line 80

“Common” is measured: kept by at least 6 in 10 of the 40 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Explain Code

Explain code with diagrams, analogies, and beginner-friendly language.

Description

Takes a piece of code and explains it thoroughly using real-world analogies, visual diagrams, line-by-line walkthroughs, and common gotchas. Designed for beginners or anyone learning a new codebase.

When to Use

When you need to understand unfamiliar code, onboard onto a project, or explain code to someone less technical.

Instructions

When asked to explain code, provide ALL of the following sections:

1. Real-World Analogy

Start with a relatable analogy that captures what this code does. Use everyday objects or processes. Keep it to 2-3 sentences.

Example: "This function is like a bouncer at a club. It checks everyone's ID (validates the token), and only lets in people on the guest list (authorized users). If your ID is fake (expired token), you get turned away (401 error)."

2. Visual Diagram

Create an ASCII or Mermaid diagram showing the flow:

  • For functions: input → processing → output
  • For components: parent → children → data flow
  • For API routes: request → middleware → handler → response
  • For database: tables → relationships → queries
Example:
  [User Click] → [API Call] → [Validate Input]
                                    ↓
                              [Query Database]
                                    ↓
                              [Format Response]
                                    ↓
                              [Return to UI]

3. Line-by-Line Walkthrough

Go through each significant line or block:

  • What it does in plain English
  • Why it exists (the purpose, not just the syntax)
  • What would happen if you removed it

Use this format:

Line 5:  const user = await db.users.findUnique({ where: { id } })
         → Looks up the user in the database by their ID
         → If no user found, this returns null (handled on line 8)

4. Key Concepts

List any programming concepts used, with brief explanations:

  • "async/await — lets you write asynchronous code that reads like synchronous code"
  • "destructuring — pulls specific values out of an object: const { name } = user"
  • "guard clause — early return to handle edge cases before the main logic"

5. Common Gotchas

What could trip someone up:

  • Edge cases not obvious from the code
  • Implicit behaviors or side effects
  • Common mistakes when modifying this code
  • Performance implications

6. How to Modify

If you wanted to change this code, here's how:

  • "To add a new field: add it to the Zod schema on line 3, then to the query on line 7"
  • "To change the error message: update line 12"
  • "To add caching: wrap the database call on line 5 with a cache check"

Tone

  • Patient and encouraging — no jargon without explanation
  • Use "we" language: "Here we're checking if..."
  • Celebrate complexity: "This is a clever pattern because..."
  • Never condescending: avoid "simply", "just", "obviously"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.