Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计异常

py-quality-setuppy 质量设置

Agent Skill

py-quality-setup 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

269

周安装

11

GitHub Stars

27

下载量

87
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:py-quality-setup(py 质量设置)
来源仓库:https://github.com/l-mb/python-refactoring-skills
仓库路径:skills/py-quality-setup
安装命令:
npx skills add https://github.com/l-mb/python-refactoring-skills --skill py-quality-setup
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/l-mb/python-refactoring-skills --skill py-quality-setup

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态和协作事项进行整理时使用。
  • 可结合来源仓库和原始 README 核验具体用法和功能边界。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网或文件操作。
  • 涉及敏感操作时应注意运行环境隔离和数据保护。

SKILL.md

Python Quality Tooling Setup

Configure comprehensive linting and type checking for Python 3.13 projects following Engineering Charter standards.

Objectives

  1. Configure ruff for linting and formatting
  2. Configure mypy for strict type checking
  3. Configure basedpyright for additional type analysis
  4. Ensure all tools target Python 3.13 or later
  5. Add tools to dev dependencies

Required Tools

Add to [dependency-groups] dev: "ruff", "mypy", "basedpyright", "pytest", "pytest-cov"

  • ruff: Fast linter and formatter (Rust-based, replaces black, isort, flake8)
  • mypy: Standard Python type checker
  • basedpyright: Enhanced Pyright fork with additional type analysis

Required Configuration Files

pyproject.toml (Canonical Reference)

This skill provides the canonical pyproject.toml configuration for all quality tools. Other skills reference this configuration.

Must include these sections:

[project]
requires-python = ">=3.13"

[dependency-groups]
dev = [
    "pytest>=8.0",
    "pytest-cov>=4.0",
    "ruff>=0.8.0",
    "mypy>=1.0",
    "basedpyright>=1.0",
    "pre-commit>=3.0",
    # Analysis tools (add as needed for py-* skills):
    # "radon", "vulture", "pylint", "bandit", "lizard",
    # "mutmut", "wily", "xenon", "pyupgrade", "coverage",
]

[tool.ruff]
line-length = 100  # or 140 for larger projects
target-version = "py313"
src = ["src"]  # adjust to your source directory

[tool.ruff.lint]
select = [
    "E",   # pycodestyle errors
    "W",   # pycodestyle warnings
    "F",   # pyflakes
    "I",   # isort
    "N",   # pep8-naming
    "UP",  # pyupgrade
    "B",   # flake8-bugbear
    "C4",  # flake8-comprehensions
    "SIM", # flake8-simplify
]
ignore = []

[tool.mypy]
python_version = "3.13"
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
check_untyped_defs = true

# Add overrides for third-party packages without stubs
# [[tool.mypy.overrides]]
# module = "package_name"
# ignore_missing_imports = true

[tool.basedpyright]
pythonVersion = "3.13"
typeCheckingMode = "standard"  # or "recommended" for stricter
reportMissingTypeStubs = false
reportUnknownMemberType = false
reportUnknownArgumentType = false
reportUnknownVariableType = false

pyrightconfig.json (optional, for multi-package projects)

A.When using pyrightconfig.json for multi-package projects, REMOVE the tool.basedpyright section from pyproject.toml

{
  "include": ["src"],
  "exclude": ["**/node_modules", "**/__pycache__", "**/.*", "venv", ".venv"],
  "pythonVersion": "3.13",
  "typeCheckingMode": "recommended",
  "reportMissingImports": "error",
  "reportMissingTypeStubs": false,
  "reportUnknownMemberType": false,
  "reportUnknownVariableType": false,
  "reportUnknownArgumentType": false,
  "reportMissingParameterType": true,
  "reportUnusedVariable": true,
  "reportImplicitStringConcatenation": true,
  "reportUnnecessaryTypeIgnoreComment": true
}

Setup Workflow

  1. Check existing configuration

- Read pyproject.toml - Check if dev dependencies exist - Verify Python version requirement

  1. Update or create configuration

- Add dev dependencies if missing - Add/update [tool.ruff] section - Add/update [tool.mypy] section - Add/update [tool.basedpyright] section - Create pyrightconfig.json if needed (multi-package projects)

  1. Install tools in venv # Using uv (recommended): uv sync # Creates venv and installs dev group automatically # Or manually: uv venv source.venv/bin/activate uv sync --group dev # Fallback if uv not available: # python -m venv venv # source venv/bin/activate # pip install -e ".[dev]"
  2. Verify installation which ruff mypy basedpyright ruff --version mypy --version basedpyright --version
  3. Run initial checks ruff check. mypy. basedpyright.
  4. Configure Claude Code permissions Write .claude/settings.local.json so all py-* skills can run without permission prompts. If the file already exists, merge new entries into the existing allow list without removing user entries. {"permissions": {"allow": ["Bash(ruff *)", "Bash(mypy *)", "Bash(basedpyright *)", "Bash(pytest *)", "Bash(vulture *)", "Bash(pylint *)", "Bash(radon *)", "Bash(lizard *)", "Bash(wily *)", "Bash(bandit *)", "Bash(mutmut *)", "Bash(pyupgrade *)", "Bash(scc *)", "Bash(pre-commit *)", "Bash(uv *)", "Bash(pip *)", "Bash(python3 *)", "Bash(python *)", "Bash(source *)", "Bash(which *)", "Bash(mkdir *)", "Bash(chmod *)", "Bash(ls *)", "Bash(ln *)", "Bash(git add *)", "Bash(git diff *)", "Bash(git status *)", "Bash(git log *)", "Bash(git ls-files *)", "Bash(git checkout *)", "Bash(git branch *)", "Bash(git commit *)"], "deny": []}} Merge logic: Read existing file, parse JSON, take union of allow lists, write back. Create .claude/ directory if needed.
  5. Install Stop hook lint gate Symlink the lint gate script so Claude Code runs the full lint suite (ruff, mypy, basedpyright) on modified files before returning to the user. If any linter reports errors, Claude is blocked from stopping and must fix them first. mkdir -p ~/.claude/hooks ln -sf ~/.claude/skills/py-git-hooks/lint-gate.py ~/.claude/hooks/lint-gate.py Configure the Stop hook in ~/.claude/settings.json (merge into existing hooks if present): {"hooks": {"Stop": [{"hooks": [{"type": "command", "command": "python3 ~/.claude/hooks/lint-gate.py"}]}]}}
  6. Configure git hooks (if requested)

- Set up pre-commit hook to run linters - See py-git-hooks skill

Tool-Specific Notes

Ruff

  • Fastest Python linter (Rust-based)
  • Replaces: black, isort, flake8, and many plugins
  • Auto-fix: ruff check --fix.
  • Format: ruff format.

Mypy

  • Standard Python type checker
  • Strict mode catches most type errors
  • Use # type: ignore[error-code] sparingly
  • Add overrides for packages without stubs

Basedpyright

  • Fork of Pyright with more features
  • Catches some errors mypy misses
  • More configurable than Pyright
  • Works well alongside mypy

Common Adjustments

Monorepo/multi-package:

  • Use pyrightconfig.json with extraPaths
  • Set namespace_packages = true in mypy

Legacy codebase:

  • Start with less strict mypy (strict = false)
  • Gradually enable strict checks
  • Use mypy overrides per module

Third-party packages without stubs:

[[tool.mypy.overrides]]
module = "package_name"
ignore_missing_imports = true

Verification Checklist

  • pyproject.toml has requires-python = ">=3.13"
  • dev dependencies include ruff, mypy, basedpyright
  • [tool.ruff] configured with target-version = "py313"
  • [tool.mypy] configured with python_version = "3.13"
  • [tool.basedpyright] configured with pythonVersion = "3.13"
  • All tools installed in venv
  • ruff check passes (or only expected errors)
  • mypy. passes (or only expected errors)
  • basedpyright. passes (or only expected errors)
  • .claude/settings.local.json exists with permissions for all quality tools
  • ~/.claude/hooks/lint-gate.py symlinked and Stop hook configured in ~/.claude/settings.json

Examples

Example: New project setup

1. Create venv: uv venv && source .venv/bin/activate
2. Create pyproject.toml with [project], [tool.ruff], [tool.mypy], [tool.basedpyright]
3. Install: uv pip install -e ".[dev]"
4. Verify: ruff --version && mypy --version && basedpyright --version
5. Run initial checks: ruff check . && mypy . && basedpyright .
6. Fix issues or add ignores for false positives

Example: Add quality tools to existing project

1. Activate venv: source .venv/bin/activate
2. Update pyproject.toml:
   - Add ruff, mypy, basedpyright to [project.optional-dependencies] dev
   - Add [tool.ruff], [tool.mypy], [tool.basedpyright] sections
3. Install: uv pip install -e ".[dev]"
4. Run checks: ruff check . (expect many errors initially)
5. Auto-fix: ruff check --fix . && ruff format .
6. Run type checkers: mypy . && basedpyright .
7. Add [[tool.mypy.overrides]] for third-party packages without stubs
8. Iterate until all checks pass

Example: Legacy codebase gradual adoption

1. Start with minimal ruff rules: select = ["E", "F"]
2. Start mypy non-strict: strict = false
3. Fix errors incrementally, expand rules over time
4. Add per-module mypy overrides for problematic modules
5. Eventually enable strict mode project-wide

Related Skills

  • Foundation: This skill is the foundation for all other skills
  • Next steps: py-git-hooks (automate enforcement of configured tools)
  • See also: py-modernize (for uv migration and syntax upgrades)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.33%
按下载量换算28

Claude

32.23%
按下载量换算28

Cursor

17.8%
按下载量换算15

Gemini CLI

9.47%
按下载量换算8

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills