code-quality-gate

Enforce a multi-stage code quality gate for Python projects using Poetry, Ruff, and PyTest.

77|15|Updated Sep 4, 2022
One-click install
npx skills add https://github.com/Afaneor/fastapi-docker-boilerplate --skill code-quality-gate-afaneor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-quality-gate
Source: https://github.com/Afaneor/fastapi-docker-boilerplate/tree/main/%7B%7Bcookiecutter.project_name%7D%7D/.claude/skills/code-quality-gate
Command: npx skills add https://github.com/Afaneor/fastapi-docker-boilerplate --skill code-quality-gate-afaneor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents faulty commits by enforcing a multi-stage code quality gate before changes are finalized.

Core Features & Use Cases

  • Stage 1: Code Formatting with Ruff Format to ensure consistent style and line length.
  • Stage 2: Linting with Ruff Check to catch unused imports, variables, and code smells.
  • Stage 3: Type Checking (Optional) with MyPy to ensure type correctness.
  • Stage 4: Tests with PyTest to verify functionality and prevent regressions.
  • Stage 5: Import Sorting to maintain a clean and stable import order.

Quick Start

Run the full quality gate locally using the recommended pipeline: poetry run ruff format . poetry run ruff check . --fix poetry run pytest tests/ -v

Frequently Asked Questions about code-quality-gate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate pre-commit code quality checks for a Python Poetry project?

Automate pre-commit code quality checks by configuring a pipeline that runs Ruff Format, Ruff Check, optional MyPy type checking, and PyTest to enforce formatting, linting, and test standards before changes are finalized.

What does a multi-stage code quality gate check before a Python commit?

A multi-stage code quality gate checks code formatting, linting, optional type correctness, and test execution to ensure consistent style, catch code smells, verify type safety, and prevent regressions before changes are finalized.

Do I need MyPy installed to run Ruff and PyTest pre-commit checks?

You do not need MyPy installed to run Ruff and PyTest pre-commit checks. MyPy is an optional stage for type checking, while Poetry, Ruff, and PyTest are required dependencies that must be installed and configured.

Can I use Ruff to replace separate formatting and linting tools in my pre-commit hook?

You can use Ruff to replace separate formatting and linting tools by utilizing Ruff Format for consistent style and line length, and Ruff Check to catch unused imports, variables, and code smells within your pre-commit code quality gate.

How do I run PyTest and Ruff checks locally before finalizing a commit?

Run PyTest and Ruff checks locally by executing poetry run ruff format ., poetry run ruff check . --fix, and poetry run pytest tests/ -v. This pipeline ensures formatting, linting, and tests pass before commits or PRs.

Why should I enforce import sorting in a Python pre-commit quality gate?

Enforce import sorting in a Python pre-commit quality gate to maintain a clean and stable import order. This stage runs alongside formatting and linting to ensure code remains consistent and readable before changes are finalized.