Get the FREE Ultimate OpenClaw Setup Guide →

python-quality-tooling

Scanned
npx machina-cli add skill narumiruna/agent-skills/python-quality-tooling --openclaw
Files (1)
SKILL.md
1.7 KB

Python Quality Tooling

Overview

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

Quick Reference

TaskCommand
Lintuv run ruff check
Auto-fixuv run ruff check --fix
Formatuv run ruff format
Type checkuv run ty check
Testuv run pytest
Coverageuv 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:

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 and CI example
  • references/quality.md - Prek install and usage notes (prefer uv tool install prek)

Source

git clone https://github.com/narumiruna/agent-skills/blob/main/skills/python-quality-tooling/SKILL.mdView on GitHub

Overview

Python Quality Tooling provides a single, repeatable quality gate using ruff, ty, and pytest across local and CI. It keeps tooling aligned with uv commands and supports prek as the single pre-merge gate when applicable.

How This Skill Works

Install the quality tools as development dependencies (see python-uv-project-setup). Run lint, type checks, tests, and coverage with uv run commands (e.g., ruff check, ty check, pytest, and coverage). If the repo standardizes on prek, use prek run -a as the single gate before merging.

When to Use It

  • Before committing or pushing changes to catch issues locally.
  • During the pre-merge gate in CI to enforce quality before merge.
  • When setting up a new Python project that needs a consistent tooling setup.
  • When migrating tests to ensure they are function-based (no class-based tests or unittest).
  • When enforcing a prek-based workflow (prek run -a) as the single gate.

Quick Start

  1. Step 1: Install tools as dev dependencies (see python-uv-project-setup).
  2. Step 2: Run all checks locally with uv run ruff check --fix, uv run ruff format, uv run ty check, and uv run pytest --cov=src --cov-report=term-missing.
  3. Step 3: If using prek, run the full gate with prek run -a before merging.

Best Practices

  • Install tools as dev dependencies.
  • Run all checks before committing.
  • Keep CI commands aligned with local uv commands.
  • If using prek, prefer prek run -a as the single gate.
  • Ensure Pytest tests are function-based.

Example Use Cases

  • Pre-merge gate example: uv run ruff check --fix; uv run ruff format; uv run ty check; uv run pytest --cov=src --cov-report=term-missing
  • Using prek as the single gate: prek run -a
  • Install git hooks (prek install) to enforce checks locally
  • Run full gate locally before pushing: uv run ruff check --fix; uv run ruff format; uv run ty check; uv run pytest --cov=src --cov-report=term-missing
  • CI gate mirrors local commands to avoid drift

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers