agentleFS
drafaeldrafael/coding-harness/skills/explain-code/SKILL.md

explain-code

Skill1 starsChanged 7 months agoMITView on GitHub

Explain current code behavior, structure, runtime flow, data flow, and component ownership. Use for ordinary walkthroughs, line-by-line explanations, subsystem mental models, and questions about what code does or how it works. Use teach, when explicitly invoked and available, for progressive learning; technical-writing, when available, for substantial standalone documentation; clarify for expectation mismatches or historical intent; code-review for finding problems; refactor-code for structural changes; brainstorm for unresolved future design; and architect, when explicitly invoked and available, for implementation-ready structural design.

25 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use refactor, deep-research and 6 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.
  • 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 3 projects that use this

  • NVIDIASkill

    deep-research

    Queue deep, multi-step research and analysis tasks to the DeepAgents worker. Supports execution depth presets, request-specific rubrics, SubAgent delegation, and RubricMiddleware cross-validation.

    Also in 3 projects that use this

  • AnthropicSkill

    debug

    Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.

    Also in 3 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 4 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 5 projects that use this

  • AWSSkill

    prototype

    Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 0 are common, 12 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 12

    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:

    Use clarify when observed behavior differs from expectations, the user asks whether behavior is wrong, or the question concerns historical …

    line 23
  2. Very specific:

    Use code-review when the user asks for defects, risks, architectural criticism, security findings, or improvement recommendations.

    line 24
  3. Very specific:

    Use refactor-code when the user wants code changed while preserving behavior.

    line 25
  4. Very specific:

    Use brainstorm when the user wants to explore unresolved future behavior, alternative ownership, or substantive design options.

    line 26
  5. Very specific:

    Use architect, when explicitly invoked and available, when an understood problem needs caller-first types, signatures, data structures, and …

    line 27
  6. Very specific:

    Use teach, when explicitly invoked and available, for a progressive learning conversation.

    line 28
  7. Very specific:

    Use technical-writing, when available, when the deliverable is a substantial standalone document such as an architecture guide.

    line 29
  8. Distinctive:

    Do not turn an explanation into an unsolicited review or redesign.

    line 31
  9. Distinctive:

    Read the actual implementation and relevant context.

    line 35
  10. Distinctive:

    Read references/exploration-playbook.md for multi-file features, subsystem architecture, cross-component flows, or unclear entry points.

    line 50
  11. Distinctive:

    Read references/explanation-patterns.md when choosing a structure for algorithms, requests, events, asynchronous work, database operations, …

    line 51
  12. Distinctive:

    Read references/language-notes.md only when language semantics are central to the explanation.

    line 52
  13. Distinctive:

    If the target is ambiguous, use available context when one interpretation is clearly most likely.

    line 64
  14. Distinctive:

    Use the smallest evidence set that can answer the question:

    line 68
  15. Distinctive:

    Follow calls and data transformations through the requested boundary.

    line 72
  16. Distinctive:

    Read central types, interfaces, configuration, and dependencies.

    line 73
  17. Distinctive:

    Check tests or call sites when they clarify contracts or edge cases.

    line 75
  18. Distinctive:

    Key concepts: only the types or abstractions needed to follow the flow.

    line 85
  19. Very specific:

    Use concrete language: “OrderService.submit() writes the record, then publishes OrderCreated” is better than “the service delegates …

    line 92
  20. Distinctive:

    Use a diagram only when it makes a multi-stage or cross-component relationship easier to understand.

    line 94

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

Build an accurate mental model of the code at the depth the question requires. Explain current mechanics from evidence in the repository, not from names, conventions, or plausible assumptions.

Boundaries

This skill owns neutral explanation:

  • what code does;
  • how control and data flow through it;
  • which types and components participate;
  • where responsibilities currently live;
  • which behavior is non-obvious.

Route other intents explicitly:

  • Use clarify when observed behavior differs from expectations, the user asks whether behavior is wrong, or the question concerns historical design rationale.
  • Use code-review when the user asks for defects, risks, architectural criticism, security findings, or improvement recommendations.
  • Use refactor-code when the user wants code changed while preserving behavior.
  • Use brainstorm when the user wants to explore unresolved future behavior, alternative ownership, or substantive design options.
  • Use architect, when explicitly invoked and available, when an understood problem needs caller-first types, signatures, data structures, and module boundaries. Use this skill to supply its current-code mechanics and evidence.
  • Use teach, when explicitly invoked and available, for a progressive learning conversation. Use this skill to supply its current-code mechanics and evidence.
  • Use technical-writing, when available, when the deliverable is a substantial standalone document such as an architecture guide. Use this skill to establish the document's current-code mechanics and evidence.

Do not turn an explanation into an unsolicited review or redesign. Mention a likely defect only when it is necessary to explain the observed flow, and label it as unverified unless the evidence establishes it.

Evidence rules

Read the actual implementation and relevant context. Never infer HTTPS, validation, sanitization, authorization, indexes, pooling, caching, complexity, error recovery, or other properties merely because they would be conventional.

Distinguish:

  • Observed mechanics: established by code, tests, configuration, or runtime evidence.
  • Documented contract: established by public interfaces, specifications, or documentation.
  • Historical intent: requires explicit rationale evidence and belongs to clarify.
  • Unknown: a connection or behavior that available evidence does not establish.

Cite relevant paths, symbols, and line ranges. State gaps rather than filling them with a plausible story.

Load references only when needed

Routine function and module explanations should use this file alone.

  • Read references/exploration-playbook.md for multi-file features, subsystem architecture, cross-component flows, or unclear entry points.
  • Read references/explanation-patterns.md when choosing a structure for algorithms, requests, events, asynchronous work, database operations, or diagrams.
  • Read references/language-notes.md only when language semantics are central to the explanation.

Assess scope and audience

Determine what the user wants to understand and how much context they need.

  • Narrow: a line, expression, function, or small class. Explain directly.
  • Module: several related functions or one component. Trace its entry points, state, dependencies, and outputs.
  • Subsystem: multiple files, packages, services, or processes. Load the exploration playbook and build a component and flow map.

Infer the audience from the request and conversation. Default to a technically competent reader who is unfamiliar with this part of the codebase. Explain language basics only when they are relevant or requested.

If the target is ambiguous, use available context when one interpretation is clearly most likely. Ask one focused question when choosing the wrong target would produce a materially different explanation.

Explore

Use the smallest evidence set that can answer the question:

  1. Locate the target and its role in the project.
  2. Find the entry point or caller that triggers it.
  3. Follow calls and data transformations through the requested boundary.
  4. Read central types, interfaces, configuration, and dependencies.
  5. Identify inputs, outputs, state changes, side effects, and error paths.
  6. Check tests or call sites when they clarify contracts or edge cases.
  7. Record anything unresolved, surprising, or easy to misunderstand.

For complex subsystems, divide exploration into independent slices only when that reduces uncertainty. Parallel exploration is optional when the host supports it; never require named models, tools, or subagent types.

Explain

Adapt the response rather than completing a fixed checklist. A subsystem explanation commonly includes:

  • Overview: what the component does and where it fits.
  • Key concepts: only the types or abstractions needed to follow the flow.
  • How it works: the trigger, sequence, decisions, transformations, boundaries, and result.
  • Where things live: a short map of important files and symbols.
  • Gotchas and gaps: non-obvious behavior and anything the evidence did not resolve.

For a narrow request, skip unnecessary sections. If the user asks for line-by-line analysis, group obvious lines and spend detail on non-obvious behavior. For an algorithm, explain its invariant and steps before discussing complexity. State complexity only when it can be derived from the implementation and relevant data structures.

Use concrete language: “OrderService.submit() writes the record, then publishes OrderCreated” is better than “the service delegates processing.” Include short code excerpts only when they clarify a specific point.

Use a diagram only when it makes a multi-stage or cross-component relationship easier to understand. Choose a portable text or Mermaid representation supported by the environment. Skip decorative diagrams and do not duplicate clear prose.

Final check

Before answering, verify:

  • Did I answer the requested scope and audience level?
  • Did I trace actual code rather than infer from names?
  • Are mechanics separate from contract and historical intent?
  • Did I cite the important files and symbols?
  • Did I disclose unresolved gaps?
  • Did I avoid unsolicited review, refactoring, and speculative claims?

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.