python-code-quality by laurigates/claude-plugins
npx skills add https://github.com/laurigates/claude-plugins --skill python-code-qualityPython 代码质量工具速查:ruff(代码检查与格式化)、ty(类型检查)。
# 检查代码
uv run ruff check .
# 自动修复问题
uv run ruff check --fix .
# 格式化代码
uv run ruff format .
# 检查并格式化
uv run ruff check --fix . && uv run ruff format .
# 显示特定规则
uv run ruff check --select E501 # 行过长
# 忽略特定规则
uv run ruff check --ignore E501
# 类型检查项目
uv run ty check
# 类型检查特定文件
uv run ty check src/module.py
# 使用指定 Python 版本检查
uv run ty check --python 3.11
# 详细输出
uv run ty check --verbose
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.lint]
select = [
"E", # pycodestyle 错误
"W", # pycodestyle 警告
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
]
ignore = [
"E501", # 行过长(由格式化器处理)
]
[tool.ruff.lint.isort]
known-first-party = ["myproject"]
[tool.ty]
python-version = "3.11"
exclude = [
"**/__pycache__",
"**/.venv",
"tests",
]
[tool.ty.rules]
possibly-unbound = "warn"
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 现代类型提示(Python 3.10+)
def process_data(
items: list[str], # 不是 List[str]
config: dict[str, int], # 不是 Dict[str, int]
optional: str | None = None, # 不是 Optional[str]
) -> tuple[bool, str]: # 不是 Tuple[bool, str]
return True, "success"
# 类型别名
from typing import TypeAlias
UserId: TypeAlias = int
UserDict: TypeAlias = dict[str, str | int]
def get_user(user_id: UserId) -> UserDict:
return {"id": user_id, "name": "Alice"}
# .pre-commit-config.yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/astral-sh/ty
rev: v0.0.10
hooks:
- id: ty
python-testing - 测试代码质量uv-project-management - 为项目添加质量工具python-development - 核心 Python 模式每周安装数
209
代码仓库
GitHub 星标数
18
首次出现
2026年1月29日
安全审计
安装于
opencode198
gemini-cli192
codex188
cursor183
github-copilot182
kimi-cli161
Quick reference for Python code quality tools: ruff (linting & formatting), ty (type checking).
# Lint code
uv run ruff check .
# Auto-fix issues
uv run ruff check --fix .
# Format code
uv run ruff format .
# Check and format
uv run ruff check --fix . && uv run ruff format .
# Show specific rule
uv run ruff check --select E501 # Line too long
# Ignore specific rule
uv run ruff check --ignore E501
# Type check project
uv run ty check
# Type check specific file
uv run ty check src/module.py
# Check with explicit Python version
uv run ty check --python 3.11
# Verbose output
uv run ty check --verbose
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
]
ignore = [
"E501", # line too long (handled by formatter)
]
[tool.ruff.lint.isort]
known-first-party = ["myproject"]
[tool.ty]
python-version = "3.11"
exclude = [
"**/__pycache__",
"**/.venv",
"tests",
]
[tool.ty.rules]
possibly-unbound = "warn"
# Modern type hints (Python 3.10+)
def process_data(
items: list[str], # Not List[str]
config: dict[str, int], # Not Dict[str, int]
optional: str | None = None, # Not Optional[str]
) -> tuple[bool, str]: # Not Tuple[bool, str]
return True, "success"
# Type aliases
from typing import TypeAlias
UserId: TypeAlias = int
UserDict: TypeAlias = dict[str, str | int]
def get_user(user_id: UserId) -> UserDict:
return {"id": user_id, "name": "Alice"}
# .pre-commit-config.yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/astral-sh/ty
rev: v0.0.10
hooks:
- id: ty
python-testing - Testing code qualityuv-project-management - Adding quality tools to projectspython-development - Core Python patternsWeekly Installs
209
Repository
GitHub Stars
18
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode198
gemini-cli192
codex188
cursor183
github-copilot182
kimi-cli161
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
150,000 周安装
Playwright E2E测试模式:构建稳定快速可维护的端到端测试套件
1,800 周安装
dbs-deconstruct:AI概念拆解工具,用维特根斯坦哲学与奥派经济学解构商业术语
1,900 周安装
dbs-benchmark对标分析AI:五重过滤法精准筛选高利润模仿对象,加速0到1
1,900 周安装
迭代检索模式:解决多智能体工作流上下文问题的4阶段循环方案
1,900 周安装
Java 17+ 编码规范与最佳实践 | Spring Boot 项目代码质量提升指南
1,900 周安装
部署模式详解:滚动部署、蓝绿部署、金丝雀部署与Docker多阶段构建最佳实践
1,800 周安装