Guide for writing effective code documentation, including docstrings, JSDoc, dartdoc, and implementation comments. Use this skill when writing new code, adding features, or improving existing documentation in Dart, Python, or TypeScript to ensure clarity and maintainability.
Noun Phrases: Start variable/property docs with a noun phrase.
Examples: "The current color.", "A list of active users.".
Booleans: Always start with "Whether" (or similar clear indicator).
Good: "Whether this widget is enabled."
Bad: "If this widget is enabled...", "True if...", "Flag to indicate...".
Avoid Jargon: Use plain English unless the term is a widely accepted standard (e.g., "HTTP", "URL").
Formatting
Sparingly: Use Markdown features (bold, lists) sparingly.
No HTML: Avoid HTML unless strictly necessary and supported by the documentation tool.
Parameters/Returns/Exceptions: Use prose to describe parameters, return values, and thrown exceptions. Do not rely solely on tags like @param unless mandated by the language standard (e.g., Javadoc).
4. Implementation Comments
Ensure implementation comments (//) are accurate, relevant, factual, and provide information that is not readily understandable from the code. Remove or reword comments that do not meet these criteria. If an implementation comment provides information useful to an API consumer that is not already in the documentation comments, move it to the documentation comments.
5. Review Checklist
Use this checklist to verify your documentation:
Summary: Ensure every public member starts with a one-sentence summary ending in a period.
Brevity: Remove "This class..." or "This function..." fluff.
Completeness: Document strict constraints (e.g., "must not be null") and exceptions.
Examples: Consider adding a code sample for complex widgets or methods.
6. Language Specific Instructions
Refer to the language guides for detailed instructions on structure, linking, and framework-specific patterns:
Dart / Flutter: references/dart.md
TypeScript / JavaScript: references/typescript.md
Python: references/python.md
1---2name: code-documentation3description: Guide for writing effective code documentation, including docstrings, JSDoc, dartdoc, and implementation comments. Use this skill when writing new code, adding features, or improving existing documentation in Dart, Python, or TypeScript to ensure clarity and maintainability.4---56# Code Documentation Skill78This skill provides comprehensive guidelines for documenting code, prioritizing user-centric writing, clarity, and consistency.910## 1. General Philosophy1112- **User-Centric**: Write for the person using your API. If you had to look up how to use something, document it so others don't have to.13- **Explain "Why"**: Explain _why_ code exists and _how_ to use it effectively, since the code signature already tells _what_ it does.14- **Be Concise**: Omit fluff. Avoid merely restating the code name, as it is not helpful.15- **Consistency**: Use standard terminology and consistent formatting.16- **Public APIs**: Document all public APIs (classes, members, top-level functions) without exception.17- **Code Samples**: Strongly consider adding code samples to explain usage.1819## 2. General Structure2021Follow this general structure for documentation comments across languages:22231. **Summary Sentence**: Start with a single-sentence summary on the first line, ending with a period.242. **Blank Line**: Follow the summary with a blank line.253. **Details**: Add paragraphs, code samples, or lists as needed to explain parameters, return values, exceptions, and behavior.264. **Annotations**: Place doc comments **before** any metadata annotations.2728## 3. Writing Guidelines2930### Brevity & Style3132- **Avoid Fluff**: Omit "This class...", "This method...", "Is used to...", "Note that...".33 - _Bad_: "This method is used to calculate the total."34 - _Good_: "Calculates the total."35- **Third-Person Verbs**: Start function/method docs with a third-person singular verb.36 - _Examples_: "Returns...", "Calculates...", "Updates...", "Creates...".37- **Noun Phrases**: Start variable/property docs with a noun phrase.38 - _Examples_: "The current color.", "A list of active users.".39- **Booleans**: Always start with "Whether" (or similar clear indicator).40 - _Good_: "Whether this widget is enabled."41 - _Bad_: "If this widget is enabled...", "True if...", "Flag to indicate...".42- **Avoid Jargon**: Use plain English unless the term is a widely accepted standard (e.g., "HTTP", "URL").4344### Formatting4546- **Sparingly**: Use Markdown features (bold, lists) sparingly.47- **No HTML**: Avoid HTML unless strictly necessary and supported by the documentation tool.48- **Parameters/Returns/Exceptions**: Use prose to describe parameters, return values, and thrown exceptions. Do not rely solely on tags like `@param` unless mandated by the language standard (e.g., Javadoc).4950## 4. Implementation Comments5152Ensure implementation comments (`//`) are accurate, relevant, factual, and provide information that is not readily understandable from the code. Remove or reword comments that do not meet these criteria. If an implementation comment provides information useful to an API consumer that is not already in the documentation comments, move it to the documentation comments.5354## 5. Review Checklist5556Use this checklist to verify your documentation:57581. [ ] **Summary**: Ensure every public member starts with a one-sentence summary ending in a period.592. [ ] **Brevity**: Remove "This class..." or "This function..." fluff.603. [ ] **Completeness**: Document strict constraints (e.g., "must not be null") and exceptions.614. [ ] **Examples**: Consider adding a code sample for complex widgets or methods.6263## 6. Language Specific Instructions6465Refer to the language guides for detailed instructions on structure, linking, and framework-specific patterns:6667- **Dart / Flutter**: [references/dart.md](references/dart.md)68- **TypeScript / JavaScript**: [references/typescript.md](references/typescript.md)69- **Python**: [references/python.md](references/python.md)
Run npx skillmds@latest add flutter/code-documentation in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Guide for writing effective code documentation, including docstrings, JSDoc, dartdoc, and implementation comments. Use this skill when writing new code, adding features, or improving existing documentation in Dart, Python, or TypeScript to ensure clarity and maintainability. It is listed under AI & ML on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
flutter (@flutter) published this skill. Their other Agent Skills are listed on their SkillMD profile.