agentleFS
dmzoneilldmzoneill/skills/explain-code/SKILL.md

explain-code

Skill2 starsChanged 3 months agoApache-2.0View on GitHub

Explain a piece of code using project knowledge and context. Use to understand unfamiliar code, get architecture context, learn patterns and gotchas, find similar implementations.

25 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use write-tests, teach 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.
  • SentrySkill

    write-tests

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

    Also in 4 projects that use this

  • AWSSkill

    teach

    Teach the user a new skill or concept, within this workspace.

    Also in 4 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 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

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read file from project path

    line 28
  2. Very specific:

    If lines provided: parse range (e.g., "10-50") and extract those lines

    line 29
  3. Very specific:

    If "index not found": learn_tool_fix("code_search", "index not found", "Vector index not created", "Run skill_run('bootstrap_knowledge')")

    line 54

“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

Explains code using semantic search and project knowledge for comprehensive context.

Inputs

InputTypeDefaultPurpose
filestringrequiredFile path (relative to project root)
linesstring-Line range (e.g., "10-50")
projectstringautoProject from config
depthstring"normal""brief", "normal", or "detailed"

Workflow

1. Check Known Issues

  • check_known_issues(tool_name="code_search", error_text="")

2. Detect Project

  • Infer from cwd if not provided; default automation-analytics-backend

3. Read File Content

  • Read file from project path
  • If lines provided: parse range (e.g., "10-50") and extract those lines
  • Build file_content: path, content, start_line, end_line, exists

4. Search Related Code

  • code_search(query=file_content.content[:200], project=project, limit=5)
  • Parse results, exclude the file itself

5. Get Architecture Context

  • knowledge_query(project=project, section="architecture.key_modules")
  • Match file path to module purpose

6. Get Gotchas & Patterns

  • knowledge_query(project=project, section="gotchas") — filter by file path keywords
  • knowledge_query(project=project, section="patterns.coding")

7. Build Explanation

Output markdown with:

  • Architecture Context: module and purpose
  • Code: selected lines (with line numbers)
  • Related Code: similar implementations
  • Gotchas: relevant gotchas
  • Coding Patterns: patterns to follow
  • Next step: find_similar_code for more

8. Error Handling

  • If "index not found": learn_tool_fix("code_search", "index not found", "Vector index not created", "Run skill_run('bootstrap_knowledge')")

9. Log

  • memory_session_log("Explained code in {file}", "Project: {project}, Lines: {lines}")

Key MCP Tools

  • code_search — find related code
  • knowledge_query — architecture, gotchas, patterns
  • check_known_issues, learn_tool_fix — error handling
  • memory_session_log — session logging

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.