agentleFS
mryeminaungmryeminaung/documentation-assistant/.claude/skills/code-documentation/SKILL.md

code-documentation

Skill9 starsChanged 5 months agoMITView on GitHub

How to explain source code, generate inline comments, write Markdown documentation, summarize a file, or improve variable/function names — for JavaScript, TypeScript, Python, Java, C++, and Dart. Use this skill whenever the user asks what code does, wants it explained, wants comments or docs generated, wants a file summarized, or wants naming improved. Always preserve program logic exactly and never invent functionality not present in the code.

13 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use data-analysis, changelog-generator and 2 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.
  • shanggqmSkill

    data-analysis

    数据分析技能,提供结构化的数据查询、统计分析和报告生成工作流。当用户需要查询数据库、进行数据统计分析、生成分析报告时使用。按规范输出原始数据、计算结果、Markdown报告和HTML可视化报告。

    Also in 3 projects that use this

  • ArogyaReddySkill

    changelog-generator

    Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

    Also in 3 projects that use this

  • VercelSkill

    web-design-guidelines

    Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 10 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Preserve logic: Never change what the code does.

    line 12
  2. Distinctive:

    Don't hallucinate: Only describe behavior, parameters, return values, or edge cases that are actually present in the code shown.

    line 13
  3. Distinctive:

    Keep every response concise — this is reference material for a working developer, not a tutorial.

    line 15
  4. Distinctive:

    Keep the whole explanation under ~200 words unless the user asks for more detail.

    line 26
  5. Distinctive:

    Use the target language's normal comment convention:

    line 32
  6. Distinctive:

    Do not reformat, rename, reorder, or "clean up" the code while adding comments.

    line 39
  7. Distinctive:

    Use exactly these sections, omitting any that don't apply:

    line 46
  8. Distinctive:

    If a parameter's type isn't annotated and can't be inferred from usage, write "not specified" rather than guessing.

    line 52
  9. Distinctive:

    If the file's role in the broader project isn't clear from the file alone, say so rather than inventing a narrative.

    line 63
  10. Very specific:

    Only include names that are actually ambiguous, misleading, or too generic (data, temp, x, flag, handleClick2).

    line 76
  11. Distinctive:

    Do not suggest a rename that would require changing the function's public signature/API unless the user has indicated that's acceptable.

    line 78

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

Five related but distinct tasks for helping a developer understand and document their own code. Pick the one the request maps to — don't blend them (e.g. don't add a naming table when the user only asked for an explanation).

Two rules apply to every task below:

  • Preserve logic. Never change what the code does. Comments, renames, and docs describe behavior — they don't alter it.
  • Don't hallucinate. Only describe behavior, parameters, return values, or edge cases that are actually present in the code shown. If something is ambiguous or determined elsewhere (e.g. an imported function's internals), say it's out of scope rather than guessing.

Keep every response concise — this is reference material for a working developer, not a tutorial.

1. Explain Code

Goal: help someone unfamiliar with the code understand it quickly.

Structure the explanation as:

  1. Purpose — one to two sentences on what the code is for
  2. Step-by-step behavior — in the order execution actually happens, not the order it's written if they differ (e.g. hoisted functions, async callbacks)
  3. Inputs and outputs — parameters, return values, side effects (network calls, file writes, mutations), if any

Keep the whole explanation under ~200 words unless the user asks for more detail. Do not suggest improvements or point out bugs unless asked — this task is descriptive, not evaluative.

2. Generate Comments

Goal: add inline comments that help a future reader, without touching logic.

  • Use the target language's normal comment convention:
    • JavaScript / TypeScript: // for lines, /** */ (JSDoc) for functions
    • Python: # for lines, """docstring""" for functions/classes
    • Java: // for lines, /** */ (Javadoc) for methods/classes
    • C++: // for lines, /** */ for functions/classes
    • Dart: // for lines, /// (doc comments) for public members
  • Comment the why or non-obvious what — skip comments on lines that are already self-explanatory (i++, simple assignments).
  • Do not reformat, rename, reorder, or "clean up" the code while adding comments. The diff should be comments only.
  • Return the full code in one code block, with nothing else around it (no preamble, no explanation) unless the user asks for one.

3. Generate Documentation

Goal: produce Markdown reference documentation for a function, class, or file.

Use exactly these sections, omitting any that don't apply:

  • Purpose — what it does and why it exists, briefly
  • Parameters — name, type (if determinable), and description for each
  • Returns — type and description of the return value
  • Example usage — a short, realistic call site

If a parameter's type isn't annotated and can't be inferred from usage, write "not specified" rather than guessing. Don't add a "Throws/Errors" section unless the code actually throws or the language's error handling is visible in the snippet.

4. Summarize File

Goal: a short, high-level orientation to an entire file — not a line-by-line walkthrough.

Write 3–5 sentences covering:

  • What the file does overall
  • Its key exports, functions, or classes (name-drop the important ones, not every helper)
  • How it likely fits into a larger codebase (e.g. "this is a React hook consumed by form components", "this is an Express route handler")

If the file's role in the broader project isn't clear from the file alone, say so rather than inventing a narrative.

5. Improve Variable and Function Names

Goal: flag genuinely unclear names and suggest better ones — without renaming for style preference alone.

Return a Markdown table:

OriginalSuggestedReason
delapsedDaysSingle-letter name gives no indication of what it holds

Rules:

  • Only include names that are actually ambiguous, misleading, or too generic (data, temp, x, flag, handleClick2). If every name in the snippet is already clear, say so — don't force a table with weak suggestions.
  • Suggested names must not collide with existing identifiers in the same scope.
  • Do not suggest a rename that would require changing the function's public signature/API unless the user has indicated that's acceptable.
  • This task never changes logic — it's a table of suggestions, not an edited file, unless the user explicitly asks you to apply the renames.

Language coverage

These instructions apply uniformly across JavaScript, TypeScript, Python, Java, C++, and Dart. Adjust only:

  • Comment/docstring syntax (see Task 2)
  • Type reporting in documentation — include types for statically-typed languages (TypeScript, Java, C++, Dart) when visible; note "dynamically typed, inferred from usage" for plain JavaScript/Python where no annotation exists
  • Idiomatic naming style (e.g. camelCase for JS/TS/Java/Dart, snake_case for Python)

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.