agentleFS
gufrancogufranco/claude-engineering-rules/skills/explain/SKILL.md

explain

Skill3 starsChanged 30 days agoMITView on GitHub

Explain code with educational depth. Generates Mermaid diagrams for architecture and data flow, traces data through the codebase, explains design decisions with rationale, identifies patterns, and suggests improvements. Use when user says "explain", "explain this code", "how does this work", "walk me through", "what does this do", "trace the data flow", or wants to understand a file, directory, or system with educational depth. For code review, use /review; for debugging, use /investigate; for architecture assessment, use /assessment.

122 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use debug-fix, root-cause and 8 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.
  • zebbernSkill

    debug-fix

    Find and fix a bug or issue — from any source (GitHub issue, error message, user report, or observed behavior)

    Also in 3 projects that use this

  • Ingramradical235Skill

    root-cause

    Structured root cause analysis using WHERE (MECE decomposition) then WHY (causal structure diagrams) pipeline. Includes coin-flip detection, logical-leap detection, and vicious cycle intervention. Use when buffer enters YELLOW/RED, when metrics stall, or when Actions execute but don't produce results.

    Also in 5 projects that use this

  • ralphkraussSkill

    resolve-conflicts

    Resolve git merge conflicts or re-apply changes from a stale branch onto current main. Use when user says "resolve conflicts", "merge conflicts", "rebase branch", "branch is behind", "re-apply changes", "port branch", or a branch is too far behind main to merge cleanly.

    Also in 4 projects that use this

  • neurofooSkill

    socratic

    Socratic questioning to examine beliefs, uncover assumptions, and develop deeper understanding. Use to challenge thinking, evaluate proposals, or teach without lecturing.

    Also in 4 projects that use this

  • anombyte93Skill

    discover

    Phase 1 of the prd-taskmaster pipeline: brainstorm-driven discovery. Delegates to superpowers:brainstorming in Interactive Mode (one adaptive question at a time), or self-brainstorms in Autonomous Mode when no user is present. Intercepts before the brainstorming chain hands off to writing-plans — this skill owns the exit. Extracts constraints, calibrates scale (Solo / Team / Enterprise), and advances the pipeline to GENERATE.

    Also in 6 projects that use this

  • mitsuhikoSkill

    summarize

    Fetch a URL or convert a local file (PDF/DOCX/HTML/etc.) into Markdown using `uvx markitdown`, optionally it can summarize

    Also in 8 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

23 rules. 0 are common, 15 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 109 edited versions we read keep these.

  • 15

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run when the goal is understanding a file, directory, or flow.

    line 14
  2. Very specific:

    If no --depth is specified, default to deep.

    line 25
  3. Distinctive:

    If no argument: use the most recently discussed file or ask for clarification.

    line 32
  4. Distinctive:

    If a file path: read the file.

    line 33
  5. Distinctive:

    If a directory path: read the directory listing, then read key files to understand the module.

    line 34
  6. Distinctive:

    High-level overview: Start with what the code does in plain language:

    line 36
  7. Very specific:

    Use graph TD for hierarchical relationships, sequenceDiagram for request flows, classDiagram for type hierarchies.

    line 45
  8. Distinctive:

    Data flow trace: Follow data through the code:

    line 47
  9. Distinctive:

    Improvement suggestions: If the code has issues, note them:

    line 75
  10. Distinctive:

    Only suggest improvements that are concrete and actionable.

    line 76
  11. Distinctive:

    Do not suggest improvements for code that is already well-structured.

    line 78
  12. Very specific:

    When --depth shallow is specified, run only steps 1-3.

    line 82
  13. Distinctive:

    Every Mermaid diagram must be valid syntax.

    line 120
  14. Distinctive:

    Never fabricate design rationale.

    line 121
  15. Distinctive:

    Do not explain language syntax unless the user appears to be learning the language.

    line 122
  16. Distinctive:

    When explaining a directory, focus on the module's public API and responsibilities.

    line 123
  17. Distinctive:

    Stop and ask which code to explain when there is no argument and no file was discussed.

    line 136
  18. Distinctive:

    Stop and re-read the source when a diagram node names a function or module that Grep cannot find.

    line 137
  19. Distinctive:

    Stop and mark the decision as unclear when no comment, commit message, or ADR supports a stated rationale.

    line 138
  20. Very specific:

    Stop at step 3 when --depth shallow was passed.

    line 139
  21. Very specific:

    Every file:line in the Patterns and Improvements tables opens to the cited code.

    line 144
  22. Very specific:

    Every Mermaid block starts with a valid diagram type such as graph TD, sequenceDiagram, flowchart, or classDiagram.

    line 145
  23. Very specific:

    Every improvement row names a file under rules/, or the table holds the single "No improvements needed." row.

    line 146

“Common” is measured: kept by at least 6 in 10 of the 109 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

Overview

Code explanation skill with educational depth. Analyzes code structure, traces data flow, identifies patterns, and produces Mermaid diagrams to make complex systems understandable.

When to Use

Run when the goal is understanding a file, directory, or flow. Pick --depth shallow for a quick orientation and the default deep when the reader will change the code next.

Invocation

InvocationAction
/explainExplain the current file or most recently discussed code
/explain <path>Explain a specific file or directory
/explain --depth shallowHigh-level overview only
/explain --depth deepFull analysis with data flow tracing and pattern identification

If no --depth is specified, default to deep.


Steps

  1. Identify the target. Determine what to explain:
    • If no argument: use the most recently discussed file or ask for clarification.
    • If a file path: read the file.
    • If a directory path: read the directory listing, then read key files to understand the module.
  2. High-level overview. Start with what the code does in plain language:
    • Purpose: what problem does this code solve?
    • Scope: what is included and what is delegated elsewhere?
    • Entry points: where does execution start?
    • Dependencies: what does this code depend on?
  3. Architecture diagram. Generate a Mermaid diagram showing the component relationships:
    • For a single file: show the file's imports, exports, and how it connects to the rest of the system.
    • For a directory: show module boundaries, dependencies between modules, and data flow.
    • Use graph TD for hierarchical relationships, sequenceDiagram for request flows, classDiagram for type hierarchies.
  4. Data flow trace. Follow data through the code:
    • Where does data enter the system?
    • What transformations happen at each step?
    • Where does data exit the system?
    • Generate a Mermaid sequenceDiagram or flowchart showing the data path.
  5. Pattern identification. Identify design patterns used in the code:

    PatternWhat to look for
    RepositoryData access abstraction layer
    StrategyInterchangeable algorithms behind a common interface
    FactoryObject creation delegated to a specialized function or class
    ObserverEvent emitters, listeners, pub/sub
    DecoratorWrapping behavior around existing functions or classes
    MiddlewarePipeline of functions processing a request sequentially
    State machineExplicit state transitions with defined valid moves
    CQRSSeparate read and write models
    Dependency injectionDependencies provided externally rather than created internally

    For each pattern found, explain why it was chosen and what alternative would look like.

  6. Design decision analysis. For non-obvious design choices in the code:
    • What trade-off was made?
    • What would the alternative approach look like?
    • Why was this approach likely chosen?
    • Reference comments, commit messages, or ADRs if they exist.
  7. Improvement suggestions. If the code has issues, note them:
    • Only suggest improvements that are concrete and actionable.
    • Reference the specific rule from ../../rules/ that applies.
    • Do not suggest improvements for code that is already well-structured. "No improvements needed" is valid output.

Shallow mode

When --depth shallow is specified, run only steps 1-3. Skip data flow tracing, pattern identification, design decision analysis, and improvement suggestions.

Output

## Explanation: <file or directory name>

### Purpose
<Plain-language description of what this code does and why it exists>

### Architecture
```mermaid
<component diagram>

Data Flow

<data flow diagram>

Patterns

PatternLocationRationale
<name>file:line<why this pattern was chosen>

Design Decisions

  1. <Decision>: <explanation of the trade-off and reasoning>

Improvements

FileLineSuggestionRule
<path><line><what to change><rule reference>
No improvements needed.

## Rules

- Explain for the reader's level. If the code is simple, keep the explanation short. If the code is complex, go deeper.
- Every Mermaid diagram must be valid syntax. Test by reading it back.
- Never fabricate design rationale. If the reason for a decision is unclear, say so.
- Do not explain language syntax unless the user appears to be learning the language.
- When explaining a directory, focus on the module's public API and responsibilities. Do not explain every internal helper.
- Improvements must reference specific rules. "This could be better" is not actionable.

## Common Rationalizations

- "The name says Strategy, so it is the Strategy pattern": a pattern claim needs the interface and its implementations in view. Cite the `file:line` that shows it.
- "The rationale is obvious, I will state it": invented rationale reads as fact. Cite a comment, commit, or ADR, or say the reason is unclear.
- "The diagram looks right": Mermaid that fails to parse renders nothing. Read it back and check every node and edge against the code.
- "Every helper deserves a line": a directory explanation covers the public API and responsibilities. Internal helpers stay out.
- "An improvement section looks thorough": "No improvements needed" is valid. Each suggestion names a rule.

## Red Flags

- Stop and ask which code to explain when there is no argument and no file was discussed.
- Stop and re-read the source when a diagram node names a function or module that Grep cannot find.
- Stop and mark the decision as unclear when no comment, commit message, or ADR supports a stated rationale.
- Stop at step 3 when `--depth shallow` was passed.

## Verification

- The output follows the Output template with Purpose, Architecture, and, in deep mode, every remaining section.
- Every `file:line` in the Patterns and Improvements tables opens to the cited code.
- Every Mermaid block starts with a valid diagram type such as `graph TD`, `sequenceDiagram`, `flowchart`, or `classDiagram`.
- Every improvement row names a file under [`rules/`](../../rules), or the table holds the single "No improvements needed." row.

## Related skills

- `/review` -- Review code for issues rather than explain it.
- `/assessment` -- Architecture completeness audit.
- `/investigate` -- Debug a specific problem in the code.
- `/plan` -- Plan changes to the code after understanding it.

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.

Reviews can't be read right now.

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.