本文へ移動
cccskills
無料GitHub で公開

python-code-documentation-guidelines

Apply Google-style docstrings and inline comments to Python .py files. Use when documenting new functions/classes/modules, incrementally documenting touched code, or flagging rename opportunities as TODOs.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Doc Code Inline

Apply consistent Python documentation conventions: docstrings, class-level docs, and inline comments so code stays clear and maintainable.

When to run this skill

  • You are adding or updating docstrings for new or existing Python functions, classes, or modules in .py files.
  • You are touching existing Python code and want to document it step-by-step (incremental docs).
  • You spot function, class, or variable names that would benefit from renames and need to record a tracked task in the code.

Steps

  1. Docstring format (Python only)

    • Use Google-style docstrings in .py files.
    • Include a summary line, then Args:, Returns:, and Raises: with types in parentheses where relevant.
    • Example:
    def fetch_user(user_id: str) -> User:
        """Load a user by ID from the backing store.
    
        Args:
            user_id (str): Unique identifier for the user.
    
        Returns:
            User: The user instance, if found.
    
        Raises:
            NotFoundError: When no user exists for the given ID.
        """
    

    For modules, add a top-of-file docstring describing the module's purpose:

    """Utilities for loading and caching user records."""
    
  2. Class docstrings

    • In .py files, add a class-level docstring that describes the class’s responsibility (what it does), not just the class name.
    • Avoid docstrings that only repeat the class name.
  3. Comments and single-line docstrings

    • Prefer self-documenting names; avoid superfluous comments when names make the code clear.
    • When a docstring is needed, a single-line docstring is fine as long as it adds information—not one that mostly repeats the function name.
  4. Renames and TODOs

    • When you spot function/class/variable renames that would make code clearer, add a # TODO in the .py file and reference ticket UN-17829 (e.g. # TODO(UN-17829): rename to get_active_sessions).
    • No mandate to flag every possible rename — use judgment for names that genuinely mislead.

Checklist

  • New or updated docstrings in .py files use Google-style (summary, Args/Returns/Raises with types in parentheses).
  • Class docstrings in .py files describe the class’s responsibility, not just the name.
  • Comments and docstrings add information; avoid repeating names or obvious behavior.
  • Misleading names are flagged as # TODO(UN-17829): rename to … where appropriate.
  • New Python code is documented; existing .py code gets incremental docs when you touch it.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Implement comprehensive error handling for Python code paths to keep services resilient and user-friendly. Use when failures are currently silent or exceptions leak through.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月10日 更新

Tabular and numerical data analysis with descriptive statistics and insights. Use when the user provides data, tables, CSVs, or numbers and wants analysis.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月10日 更新

Financial factsheet analysis with key metrics extraction and investment rationale

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月10日 更新

ci-fix

無料

Diagnose and fix CI failures without leaving your editor.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月10日 更新

Reproduce ai-repo PR checks locally with Poe and CI scripts, including per-package typecheck and coverage behavior. Use when validating changes before push or when user asks which local commands match CI.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月10日 更新

Ask clarifying questions before implementing to ensure Python requirements are understood. Use when a task lacks detail, dependencies are unclear, or multiple interpretations are possible.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月10日 更新

Unique-AG のスキルをすべて見る

このスキルの問題を報告する