agentleFS
jamestorrevillasjamestorrevillas/dev-skills/.github/skills/code-explanation/SKILL.md

code-explanation

Skill4 starsChanged 9 months agoMITView on GitHub

Use this skill when writing code comments, explaining code decisions, documenting the "why" behind implementation choices, or narrating technical reasoning in PRs or architecture docs. Trigger on keywords: explain this code, why did you write it this way, add comments, document this, write inline comments, explain my decision.

7 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use analyze-exports, fireworks-inference 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.
  • LeanmcpSkill

    analyze-exports

    Analyze tau2-bench task export files to identify exactly where and why tasks failed. Map failures to specific conversation rounds, show root causes, check whether relevant documentation was available, and cite sources. Use this skill whenever you need to debug a tau2-bench evaluation, understand why an agent made wrong decisions, identify missing knowledge, or review task performance—especially when context length, eligibility criteria, or policy compliance might be at fault.

    Also in 4 projects that use this

  • LeanmcpSkill

    fireworks-inference

    Run inference on Fireworks AI — direct, through the Leanmcp AI Gateway proxy (aigateway.leanmcp.com) for observability, or via LiteLLM / the OpenAI SDK / raw HTTP. Covers the endpoint-and-key matrix for each route, serverless vs dedicated deployments and their cold starts, browsing and filtering the model catalogue, reasoning models that return content:null with the answer in reasoning_content, function calling, concurrency and load testing, and runner scripts where many models share one protocol with a --use-proxy toggle. Use this skill whenever the user mentions Fireworks, FIREWORKS_API_KEY, api.fireworks.ai, fireworks_ai/ model ids, accounts/fireworks/models/..., a Fireworks deployment id, the Leanmcp gateway or LEANMCP_API_KEY, app.leanmcp.com observability, or gpt-oss / kimi / glm / qwen / deepseek served on Fireworks; wants to route LLM calls through a proxy for logging or cost tracking; is debugging empty responses, 404s, scope errors, cold starts, or "the gateway isn't working"; wants to pick a Fireworks model with tool calling; or wants to sweep several models over one benchmark. Reach for it even on vague asks like "why is this model returning nothing" or "set up inference for these models" when Fireworks is in play.

    Also in 4 projects that use this

  • +10 more from Leanmcp

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 2

    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:

    If you need a comment to explain what the code does, the code should be cleaner.

    line 12
  2. Distinctive:

    When your PR makes non-obvious decisions, explain them:

    line 75

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

Code Explanation

Core Principle

Comments explain WHY. Code explains WHAT.

If you need a comment to explain what the code does, the code should be cleaner. If you need a comment to explain why it's done this way — write that comment.


The Four Levels of Code Explanation

LevelWhereExplains
Inline commentNext to specific lineNon-obvious logic or gotcha
Function docstringTop of functionWhat it does, parameters, returns, side effects
Module headerTop of fileWhat this module is responsible for
Architecture noteREADME / ADRWhy this approach was chosen over alternatives

What to Comment (and What Not To)

Comment This

// Using exponential backoff here because the payment API 
// has a 429 rate limit that triggers on burst traffic
await retryWithBackoff(() => paymentAPI.charge(amount))

// Intentionally not validating here — validation happens 
// upstream in the middleware layer (see auth.middleware.ts)
const user = req.user

// This looks backwards but the API returns results 
// in reverse chronological order — newest = index 0
const latest = results[0]

Don't Comment This

// Increment counter by 1
count++

// Check if user is authenticated
if (user.isAuthenticated) {

Docstring Template

/**
 * Calculates the discount amount for a given order.
 * 
 * @param order - The order to calculate discount for
 * @param promoCode - Optional promo code to apply
 * @returns The discount amount in cents, or 0 if no discount applies
 * @throws InvalidPromoCodeError if the promo code format is invalid
 * 
 * Note: Does NOT check if the promo code is active — 
 * call validatePromoCode() first.
 */

PR Description: Explaining Your Decisions

When your PR makes non-obvious decisions, explain them:

## Technical Decisions

**Why I chose X over Y:**
[reasoning — constraints, trade-offs, what you considered]

**Known limitations:**
[what this doesn't handle and why that's acceptable for now]

**What I'd do differently with more time:**
[honest reflection — shows growth mindset]

Architecture Decision Records (ADR)

For significant technical decisions, write a short ADR:

# ADR: [decision title]

**Date:** [date]  
**Status:** Accepted

## Context
[What situation led to this decision?]

## Decision
[What did we decide to do?]

## Reasoning
[Why this over the alternatives?]

## Trade-offs
[What do we give up with this choice?]

## Consequences
[What becomes easier? What becomes harder?]

Store in /docs/decisions/ or similar — these are gold for future developers.

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.