ruff-linter

Pythonコードのリンタ、フォーマッタ、コードレビュー。Pythonファイル(.py)を編集・作成・修正した後に必ず実行する。ruffによる品質チェックとフォーマット、さらにコードレビューを行い問題があれば修正する。

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 23, 2025

When & Why to Use This Skill

This Claude skill automates Python code quality management by integrating the Ruff linter and formatter into the development workflow. It ensures consistent code styling, identifies potential bugs through static analysis, and provides a structured framework for comprehensive code reviews covering readability, security, and performance. By leveraging high-performance tools like Ruff and uv, it streamlines the transition from code editing to production-ready quality.

Use Cases

  • Automated Code Formatting: Automatically applying PEP 8 compliant formatting to Python files using Ruff to maintain a clean and consistent codebase across team projects.
  • Static Bug Detection: Identifying and automatically fixing common Python programming errors, unused imports, and syntax issues immediately after code modification.
  • Pre-commit Quality Assurance: Ensuring all Python scripts meet organizational standards for security and performance before being submitted for final human review or CI/CD pipelines.
  • Technical Debt Reduction: Streamlining the refactoring process by automatically resolving linting warnings and enforcing best practices across large Python repositories.
nameruff-linter
descriptionPythonコードのリンタ、フォーマッタ、コードレビュー。Pythonファイル(.py)を編集・作成・修正した後に必ず実行する。ruffによる品質チェックとフォーマット、さらにコードレビューを行い問題があれば修正する。

Python コード品質チェック

Pythonコード修正後に実行する品質チェックとレビューのワークフロー。

必須ワークフロー

Pythonファイルを編集した後、以下を順番に実行:

1. フォーマット適用

uv run ruff format .

2. リンタ実行と自動修正

uv run ruff check --fix .

3. 残りのリンタエラー確認

uv run ruff check .

エラーがあれば手動で修正。

4. コードレビュー

変更したコードを確認し、以下の観点でレビュー:

  • 可読性: 変数名・関数名は適切か
  • ロジック: バグや edge case の見落としはないか
  • セキュリティ: インジェクション等の脆弱性はないか
  • パフォーマンス: 非効率な処理はないか
  • テスト: テストが必要な変更か

問題があれば修正し、再度 1〜3 を実行。

コマンドリファレンス

コマンド 用途
uv run ruff format . フォーマット適用
uv run ruff format --check . フォーマット確認のみ
uv run ruff check . リンタ実行
uv run ruff check --fix . リンタ + 自動修正

CI/CD

PRチェックでは以下を実行:

uv run ruff format --check .
uv run ruff check .