Agent Skillsflutter/agent-plugins › code-documentation

code-documentation

GitHub

提供代码文档编写指南,涵盖docstrings、JSDoc等规范。指导如何撰写清晰、一致的API文档和实现注释,提升代码可维护性。适用于Dart、Python或TypeScript项目的新代码编写、功能添加及现有文档优化。

.agents/agents/reidbaker-agent/skills/code-documentation/SKILL.md flutter/agent-plugins

Trigger Scenarios

编写新代码时生成文档字符串 为现有代码补充或改进说明文档 审查API文档的清晰度与一致性

Install

npx skills add flutter/agent-plugins --skill code-documentation -g -y
More Options

Non-standard path

npx skills add https://github.com/flutter/agent-plugins/tree/main/.agents/agents/reidbaker-agent/skills/code-documentation -g -y

Use without installing

npx skills use flutter/agent-plugins@code-documentation

指定 Agent (Claude Code)

npx skills add flutter/agent-plugins --skill code-documentation -a claude-code -g -y

安装 repo 全部 skill

npx skills add flutter/agent-plugins --all -g -y

预览 repo 内 skill

npx skills add flutter/agent-plugins --list

SKILL.md

Frontmatter
{
    "name": "code-documentation",
    "description": "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."
}

Code Documentation Skill

This skill provides comprehensive guidelines for documenting code, prioritizing user-centric writing, clarity, and consistency.

1. General Philosophy

  • 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.
  • Explain "Why": Explain why code exists and how to use it effectively, since the code signature already tells what it does.
  • Be Concise: Omit fluff. Avoid merely restating the code name, as it is not helpful.
  • Consistency: Use standard terminology and consistent formatting.
  • Public APIs: Document all public APIs (classes, members, top-level functions) without exception.
  • Code Samples: Strongly consider adding code samples to explain usage.

2. General Structure

Follow this general structure for documentation comments across languages:

  1. Summary Sentence: Start with a single-sentence summary on the first line, ending with a period.
  2. Blank Line: Follow the summary with a blank line.
  3. Details: Add paragraphs, code samples, or lists as needed to explain parameters, return values, exceptions, and behavior.
  4. Annotations: Place doc comments before any metadata annotations.

3. Writing Guidelines

Brevity & Style

  • Avoid Fluff: Omit "This class...", "This method...", "Is used to...", "Note that...".
    • Bad: "This method is used to calculate the total."
    • Good: "Calculates the total."
  • Third-Person Verbs: Start function/method docs with a third-person singular verb.
    • Examples: "Returns...", "Calculates...", "Updates...", "Creates...".
  • 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:

  1. Summary: Ensure every public member starts with a one-sentence summary ending in a period.
  2. Brevity: Remove "This class..." or "This function..." fluff.
  3. Completeness: Document strict constraints (e.g., "must not be null") and exceptions.
  4. 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:

Version History

  • c3c71cf Current 2026-08-20 07:11

Same Skill Collection

.agents/agents/reidbaker-agent/skills/api-review/SKILL.md
.agents/agents/reidbaker-agent/skills/code-review/SKILL.md
.agents/agents/reidbaker-agent/skills/grill-with-docs/SKILL.md
.agents/agents/reidbaker-agent/skills/natural-writing/SKILL.md
.agents/agents/reidbaker-agent/skills/unix-cli-best-practices/SKILL.md
skills/dart-add-unit-test/SKILL.md
skills/dart-build-cli-app/SKILL.md
skills/dart-collect-coverage/SKILL.md
skills/dart-fix-runtime-errors/SKILL.md
skills/dart-generate-test-mocks/SKILL.md
skills/dart-migrate-to-checks-package/SKILL.md
skills/dart-resolve-package-conflicts/SKILL.md
skills/dart-run-static-analysis/SKILL.md
skills/dart-use-ffigen/SKILL.md
skills/dart-use-pattern-matching/SKILL.md
skills/dart-use-primary-constructors/SKILL.md
skills/dart-write-documentation/SKILL.md
skills/flutter-add-integration-test/SKILL.md
skills/flutter-add-widget-preview/SKILL.md
skills/flutter-add-widget-test/SKILL.md
skills/flutter-apply-architecture-best-practices/SKILL.md
skills/flutter-build-responsive-layout/SKILL.md
skills/flutter-fix-layout-issues/SKILL.md
skills/flutter-implement-json-serialization/SKILL.md
skills/flutter-setup-declarative-routing/SKILL.md
skills/flutter-setup-localization/SKILL.md
skills/flutter-use-http-package/SKILL.md
tool/dart_skills_lint/.agents/skills/add-dart-lint-validation-rule/SKILL.md
tool/dart_skills_lint/.agents/skills/check-downstream-consumers/SKILL.md
tool/dart_skills_lint/.agents/skills/contributor-pr-description/SKILL.md
tool/dart_skills_lint/.agents/skills/dart-skills-lint-integration/SKILL.md
tool/dart_skills_lint/.agents/skills/definition-of-done/SKILL.md
tool/dart_skills_lint/.agents/skills/run-evals/SKILL.md
tool/dart_skills_lint/example/skills/invalid/SKILL.md
tool/dart_skills_lint/example/skills/valid/SKILL.md
tool/dart_skills_lint/skills/dart-skills-lint-setup/SKILL.md
tool/dart_skills_lint/skills/dart-skills-lint-validation/SKILL.md
skills/dart-setup-ffi-assets/SKILL.md

Metadata

Files
0
Version
864cf87
Hash
9fbcf476
Indexed
2026-08-20 07:11

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-01 00:21
浙ICP备14020137号-1 $bản đồ khách truy cập$