agentleFS
aiflaredevaiflaredev/aiflare/skills/why/SKILL.md

why

Skill0 starsChanged 6 months agoMITView on GitHub

Explain why agent-written code was written the way it is, by retrieving the original intent, alternatives, and conversation captured at commit time, paired with a line-around diff computed locally from git. Use when debugging code an AI agent wrote.

112 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use addskill, apply-firmware and 10 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.
  • ryanportfolioSkill

    addskill

    Create, import, update, or install repo or personal skills: runtime ownership, resources, discovery checks.

    Also in 6 projects that use this

  • ryanportfolioSkill

    apply-firmware

    Bring current folder (plain folder, existing repo, old or partial firmware copy) up to full Harness Firmware in place. Mirror external repo → adopt-repo.

    Also in 6 projects that use this

  • +10 more from ryanportfolio

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 106 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

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

    When debugging code an AI agent wrote — before guessing why it is structured a certain way, retrieve the original intent.

    line 11
  2. Very specific:

    If $ARGUMENTS is given as <file>:<line> (e.g.

    line 28
  3. Very specific:

    If only a file path is given, omit line to get file-level history.

    line 30
  4. Distinctive:

    If no argument is given, infer the file and line from the current debugging context.

    line 31
  5. Very specific:

    Call the why MCP tool with file and (optionally) line.

    line 34
  6. Distinctive:

    If the tool reports any of the following, tell the user plainly and continue with normal debugging.

    line 47
  7. Very specific:

    If the response says Showing the 5 most recent of N commits.

    line 56

“Common” is measured: kept by at least 6 in 10 of the 106 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 why a line of code (or file) exists, pairing each touching commit's AIFlare-captured context (when available) with a locally-computed diff hunk.

When to use

When debugging code an AI agent wrote — before guessing why it is structured a certain way, retrieve the original intent. The why MCP tool runs git locally to find the commits that touched the target:

  • With line: git log -L {line},{line}:{file} — line-tracked across in-file refactors; file renames are not followed.
  • Without line: git log -- {file} — every commit that touched the file; renames are not followed.

For each of those commits it fetches the captured intent, alternatives, and conversation from AIFlare, and separately runs git show locally to extract a diff hunk (line-targeted when line is given, first hunk otherwise). Up to the 5 most recent commits are returned as a timeline (latest on top).

Instructions

  1. Determine the file and (optionally) the line the user is asking about.
    • If $ARGUMENTS is given as <file>:<line> (e.g. src/foo/Bar.kt:42), split it into file and line.
    • If only a file path is given, omit line to get file-level history.
    • If no argument is given, infer the file and line from the current debugging context.
  2. Call the why MCP tool with file and (optionally) line.
  3. Present the returned timeline to the user. Each entry includes:

    • Title and Tag for quick orientation
    • Intent — why the agent wrote it this way
    • Alternatives considered — options the agent rejected (when present)
    • Diff around this line / Key changes — the actual code change
    • Conversation behind this commit — original session excerpt (when present)

    Ground your debugging in the captured intent — do not guess at the original design when it is available. The most recent commit is at the top; older commits below show how the line evolved.

  4. If the tool reports any of the following, tell the user plainly and continue with normal debugging. Do not fabricate intent.
    • ... none are captured in AIFlare. — commits exist but no captures
    • No commit history found for ... — file/line is untracked or empty
    • Not in a git repository. — run from inside a git working tree
    • git query failed — check the file path ... — bad path or out-of-range line
    • AIFlare is not configured. ... — aiflare.yml missing or has no api_key
    • Error querying AIFlare: ... — backend/network error
  5. If the response says Showing the 5 most recent of N commits. (timeline) or Checked the 5 most recent of N commits, but none are captured in AIFlare. (no-capture fallback), the target has a longer history than the 5-commit cap. Mention this when the older commits might matter (e.g., to find the original introduction).

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.