mcpField
P
python-code-quality

python-code-quality

github.com/laurigates测试与质量591.0k 次安装1 天前更新
代码仓库

关于 python-code-quality

面向 Python 项目的质量工具链编排索引,适合同时规划 lint、格式化、类型检查和测试的开发者。它将各工具的细节指向专门技能,并说明如何在 pre-commit 与 CI 中协同使用。

主要功能

  1. 01梳理 Python 质量工具链
  2. 02按任务路由到专门技能
  3. 03说明 pre-commit 中的工具协作
  4. 04概述 CI 质量检查步骤

适用场景

  1. 01为新项目搭建质量检查栈
  2. 02规划 lint、格式化和类型检查
  3. 03将质量工具接入 pre-commit 与 CI

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/laurigates/claude-plugins --skill python-code-quality

安装后在 Claude Code 中输入/python-code-quality确认已加载。

详细介绍

Python 代码质量

Python 质量工具栈的编排索引。此技能负责路由到管理各工具的专门技能,不会重复说明它们的命令。需要同时搭建或了解整个工具栈(lint + 格式化 + 类型检查 + 测试)时,请使用此技能;调整单个工具时,请使用对应的专门技能。

何时使用此技能

在以下情况下使用此技能……在以下情况下改用专门的同级技能……
为新项目搭建完整的质量工具栈只调整 ruff lint 规则的选择——使用 ruff-linting
了解各工具如何协同工作/比较它们只配置 ruff 格式化程序的特殊行为——使用 ruff-formatting
将 lint + 类型检查一并接入 pre-commit 和 CI配置严格的类型检查器规则——使用 ty-type-checking 或 basedpyright-type-checking

路由表

事项专门技能
lint 规则、规则选择、自动修复python-plugin:ruff-linting
代码格式化(引号风格、行长)python-plugin:ruff-formatting
为 ruff 配置编辑器/pre-commit/CI/Dockerpython-plugin:ruff-linting → 其 REFERENCE.md
使用 ty 进行类型检查python-plugin:ty-type-checking
使用 basedpyright 进行类型检查python-plugin:basedpyright-type-checking
检测死代码python-plugin:vulture-dead-code
测试质量/覆盖率python-plugin:python-testing、python-plugin:pytest-advanced
现代类型提示语法和惯用写法python-plugin:python-development
将工具添加到项目中python-plugin:uv-project-management

完整工具栈一览

此索引唯一负责的内容:在 pre-commit 中同时运行这些工具。 各工具的标志和配置请参阅上方的路由表。

# .pre-commit-config.yaml — ruff (lint + format) and ty together
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.0
    hooks:
      - id: ruff-check
        args: [--fix]
      - id: ruff-format
  - repo: https://github.com/astral-sh/ty
    rev: v0.0.10
    hooks:
      - id: ty

典型的 CI 质量门禁会运行相同的三个步骤:ruff check、 ruff format --check、ty check。可运行的形式请参阅 ruff-linting § CI/CD Integration 和 ty-type-checking。

参考资料

评论

支持 Markdown