Use for Python linting, formatting, type checking, test coverage, and project validation. Covers ruff, mypy, pytest-cov.
From psnnpx claudepluginhub aladac/claude-pluginsThis skill uses the workspace's default tool permissions.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
Comprehensive guide to Python linting, formatting, type checking, and coverage.
Modern all-in-one tool (replaces Black, isort, Flake8):
pip install ruff
# pyproject.toml
[tool.ruff]
target-version = "py312"
line-length = 88
src = ["src", "tests"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG", # flake8-unused-arguments
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"PTH", # flake8-use-pathlib
"RUF", # Ruff-specific
]
ignore = ["E501"] # Line too long (handled by formatter)
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["ARG"]
[tool.ruff.lint.isort]
known-first-party = ["myapp"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true
# Lint check
ruff check src/
# Lint with autofix
ruff check --fix src/
# Format check
ruff format --check src/
# Format with autofix
ruff format src/
# Both lint and format
ruff check --fix src/ && ruff format src/
pip install mypy
# pyproject.toml
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
warn_redundant_casts = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
[[tool.mypy.overrides]]
module = ["pandas.*", "numpy.*"]
ignore_missing_imports = true
# Check all
mypy src/
# Check specific file
mypy src/order.py
# Show error codes
mypy --show-error-codes src/
pip install pyright
pyright
pip install pytest pytest-cov
# Run with coverage
pytest --cov=src --cov-report=term-missing
# Generate HTML report
pytest --cov=src --cov-report=html
# With minimum threshold
pytest --cov=src --cov-fail-under=80
Run all checks:
# Check everything
ruff check src/ && ruff format --check src/ && mypy src/ && pytest
# Fix everything
ruff check --fix src/ && ruff format src/
.PHONY: install lint format typecheck test check fix
install:
pip install -e ".[dev]"
lint:
ruff check src/ tests/
format:
ruff format src/ tests/
typecheck:
mypy src/
test:
pytest
check: lint typecheck test
fix:
ruff check --fix src/ tests/
ruff format src/ tests/
# .pre-commit-config.yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-requests]
# Install hooks
pre-commit install
# Run manually
pre-commit run --all-files
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Lint
run: ruff check src/
- name: Format check
run: ruff format --check src/
- name: Type check
run: mypy src/
- name: Test
run: pytest --cov=src --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v4
| Operation | Command |
|---|---|
| Lint check | ruff check src/ |
| Lint fix | ruff check --fix src/ |
| Format check | ruff format --check src/ |
| Format fix | ruff format src/ |
| Type check | mypy src/ |
| Test | pytest |
| Coverage | pytest --cov=src |
| All checks | ruff check && ruff format --check && mypy src/ && pytest |
| All fixes | ruff check --fix && ruff format |