# Python Quality Tooling

> Use when configuring or running Python quality tools (ruff, ty, pytest, coverage, CI gates) and when enforcing a pre-merge quality checklist.

- Skill: `tomevault-io/python-quality-tooling` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/python-quality-tooling`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/python-quality-tooling/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/python-quality-tooling

---


# Python Quality Tooling

## Overview

Use ruff, ty, and pytest consistently through uv. Core principle: one repeatable quality gate across local and CI.

## Quick Reference

| Task | Command |
| --- | --- |
| Lint | `uv run ruff check` |
| Auto-fix | `uv run ruff check --fix` |
| Format | `uv run ruff format` |
| Type check | `uv run ty check` |
| Test | `uv run pytest` |
| Coverage | `uv run pytest --cov=src --cov-report=term-missing` |
| Full gate (prek) | `prek run -a` |
| Install git hooks (prek) | `prek install` |

## Workflow

- Install tools as dev deps (see `python-uv-project-setup`).
- Run all checks before commit.
- Keep CI aligned with local commands.
- If the repo uses prek, prefer `prek run -a` as the single quality gate.
- Pytest tests MUST be function-based (no class-based tests or `unittest.TestCase`).

## Example

Pre-merge gate:
```bash
uv run ruff check --fix
uv run ruff format
uv run ty check
uv run pytest --cov=src --cov-report=term-missing
```

## Common Mistakes

- Running tools outside uv (drifts from project env).
- Skipping `prek run -a` when a repo standardizes on prek.
- Running only one tool and calling it done.

## Red Flags

- Direct `ruff`/`pytest` invocations without `uv run`.
- Mixing `pre-commit` and `prek` commands in the same repo.
- Class-based pytest tests (`class Test*`) or `unittest.TestCase` usage.

## References

- `references/quality.md` - Full command set, CI example, and prek install/usage notes (prefer `uv tool install prek`)

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/narumiruna) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

