- Home
- Skills
- Laurigates
- Claude Plugins
- Python Code Quality
python-code-quality_skill
- Shell
7
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill laurigates/claude-plugins --skill python-code-quality- REFERENCE.md1.5 KB
- SKILL.md3.2 KB
Overview
This skill provides practical guidance for improving Python code quality using ruff for linting and formatting and mypy for static type checking. It covers pyproject.toml configuration, pre-commit hooks, and modern type hint patterns. Use it to enforce style, catch bugs early, and integrate checks into local workflows and CI.
How this skill works
The skill explains how to run ruff and mypy commands, configure rules in pyproject.toml, and add hooks to .pre-commit-config.yaml so checks run on each commit. It shows which ruff rules to enable or ignore, recommended mypy settings for stricter checks, and examples of modern Python type hints and aliases. The guidance helps you automate fixes, surface errors, and standardize project conventions.
When to use it
- Setting up linting and automatic formatting for a Python project
- Enforcing static typing and catching type errors before runtime
- Adding quality gates to CI/CD pipelines
- Installing pre-commit hooks to run checks locally on each commit
- Standardizing pyproject.toml for consistent tooling across the team
Best practices
- Prefer ruff both for linting and formatting to reduce tool overlap and conflicts
- Keep pyproject.toml as the single source of configuration for ruff and mypy
- Run ruff --fix and ruff format in CI or pre-commit to automatically correct style issues
- Enable strict mypy settings (disallow_untyped_defs, warn_return_any) incrementally for large codebases
- Use modern builtin generic types (list[str], dict[str, int]) and TypeAlias for clarity and compatibility
Example use cases
- Add ruff and mypy to a new project and commit a baseline configuration in pyproject.toml
- Create .pre-commit-config.yaml that runs ruff --fix and mypy to prevent style regressions before merging
- Configure CI job that fails the build on mypy or ruff errors to enforce quality gates
- Refactor a legacy module by running ruff format then iteratively fixing mypy errors to migrate to typed code
FAQ
Add the rule code to tool.ruff.lint.ignore in pyproject.toml or pass --ignore to the ruff CLI.
Can ruff replace isort and other linters?
Yes—ruff includes sorting, many linting checks, and can replace multiple tools. Configure known-first-party and rule selections to match project needs.