# Python コードスタイル (python-code-style)

> Python のリンター・フォーマッター設定、PEP 8 の命名、import の順序、型ヒント、Google スタイルの docstring をまとめます。

- カテゴリ: [コーディング規約](https://www.myskills.tools/ja/categories/code-standards/)
- 提供元: コミュニティ · Seth Hobson
- リポジトリ: https://github.com/wshobson/agents/tree/main/plugins/python-development/skills/python-code-style (commit cbb6049)
- SKILL.md: https://github.com/wshobson/agents/blob/main/plugins/python-development/skills/python-code-style/SKILL.md
- インストールコマンド: `npx skills add wshobson/agents --skill python-code-style`
- ライセンス: MIT
- 対応ツール: Claude Code, Codex, Cursor, Copilot, OpenCode
- 権限: read-repo ✓, write-files ✓, shell ✓, network ✓
- 状態: スキャン済み
- ルールスキャンですべてのリスクを検出できるわけではありません。インストール前にこのスキルの SKILL.md を読み、権限を確認してください。

## 基本ルール

書式の議論はツールに任せ、一度設定したら自動で適用すること。

## 実行フェーズ

1. **ツール設定** — pyproject.toml で ruff をリンター兼フォーマッターとして設定し、mypy か pyright を strict で有効にします。
2. **命名と import** — PEP 8 に従い短さより明確さを優先し、import は標準ライブラリ・サードパーティ・ローカルの順にまとめ、絶対 import のみ使います。
3. **型と docstring** — 公開 API すべてに型ヒントと Google スタイルの docstring を付け、Args・Returns・Raises・例を書きます。
4. **書式と文書** — 行幅は120にして読みやすく改行し、README と Keep a Changelog 形式の CHANGELOG を整え、CI でリンターを走らせます。

## 権限の説明（SKILL.md より）

| 機能 | 必要か | 説明 |
|---|---|---|
| ファイル書き込み | 必要 | pyproject.toml などの設定を変更し、コードに型と docstring を加え、プロジェクト文書を書きます。 |
| コマンド実行 | 一部で必要 | ruff check --fix、ruff format、ruff や mypy をインストールするコマンドを実行します。 |
| 外部通信 | 一部で必要 | pip で ruff や mypy をインストールするときにパッケージインデックスへアクセスするだけです。 |

## SKILL.md のフロントマター（YAML）

```yaml
---
name: python-code-style
description: Python code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.
---
```

ホーム: https://www.myskills.tools/ja/ · URL: https://www.myskills.tools/ja/skills/python-code-style/
