code-documentation

작성자: flutter

효과적인 코드 문서 작성 가이드로, docstrings, JSDoc, dartdoc 및 구현 주석을 포함합니다. 새 코드를 작성하거나 추가할 때 이 스킬을 사용하세요…

npx skills add https://github.com/flutter/agent-plugins --skill code-documentation

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:

flutter의 다른 스킬

dart-modern-features
flutter
현대화를 위한 후보를 찾으려면:
flutter-fix-layout-issues
flutter
Flutter 레이아웃 오류(오버플로우, 무제한 제약 조건)를 Dart 및 Flutter MCP 도구를 사용하여 수정합니다. "RenderFlex overflowed", "Vertical…" 문제를 해결할 때 사용하세요.
adding-release-notes
flutter
사용자 대상 변경 사항 설명을 DevTools 릴리스 노트에 추가합니다. NEXT_RELEASE_NOTES.md 파일에 개선 사항, 수정 사항 또는 새로운 기능을 문서화할 때 사용하세요.
reviewing-devtools-prs
flutter
DevTools 저장소 전용 PR 리뷰 워크플로로, DevTools 스타일 가이드라인과 일반적인 리뷰 패턴을 적용합니다. 풀 리퀘스트를 리뷰할 때 사용하세요…
dart-use-primary-constructors
flutter
사용자가 Dart에서 구문 및 의미적으로 올바른 primary constructor를 작성하고, 새로운 생성자 구문, 빈 본문 세미콜론 구문 등으로 마이그레이션/사용할 수 있도록 지원합니다.
api-review
flutter
지정된 코드를 표준 API 설계 지침에 맞춰 검토합니다. 사용자가 API 리뷰를 요청하거나 API 설계에 따라 코드를 확인할 때 이 스킬을 사용하세요…
flutter-accessibility
flutter
Flutter 앱에서 WCAG 2 및 EN 301 549 접근성 표준과 적응형 레이아웃을 구현합니다. 모바일, 웹, 데스크톱 플랫폼에서 시맨틱 주석, 탭 대상 크기(최소 48x48 dp), 텍스트 대비 비율(작은 텍스트 4.5:1, 큰 텍스트 3:1)을 적용합니다. 웹 시맨틱 초기화, 대화형 위젯 래핑, 화면 크기 기반 레이아웃 전환, 키보드/마우스 입력 처리를 위한 결정 로직을 제공합니다. FocusTraversalGroup을 통한 포커스 이동 관리를 포함합니다...
flutter-accessibility-audit
flutter
widget_inspector를 통해 접근성 스캔을 트리거하고, 소스 코드에 누락된 Semantics 위젯이나 레이블을 자동으로 추가합니다.