Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
alinaqi avatar

Python

  • 3 installs
  • 706 repo stars
  • Updated July 14, 2026
  • alinaqi/maggy

python is a Claude Code skill that enforces type-safe, tested Python development using ruff, mypy, and pytest.

About

This skill is a Python best-practices guide that Claude applies when editing Python files. It sets type-safety, project-structure, and TDD conventions using ruff, mypy, and pytest. Developers use it to keep a Python codebase linted, typed, and tested with a CI quality gate. It also lists common Python anti-patterns to avoid.

  • Enforces mypy --strict, ruff, and pytest with 80% coverage gate
  • Prescribes core/infra/utils project layout and dependency injection
  • Ships GitHub Actions and pre-commit config for a Python quality gate

Python by the numbers

  • 3 all-time installs (skills.sh)
  • Ranked #231 of 290 Python skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

python capabilities & compatibility

Free; uses open-source Python tooling.

Capabilities
python linting · type checking · test coverage · ci setup
Works with
github
Use cases
testing · ci cd · api development
IDEs
vscode
Pricing
Free
From the docs

What python says it does

Python development with ruff, mypy, pytest - TDD and type safety
SKILL.md
Run `mypy --strict` in CI
SKILL.md
addopts = "--cov=src --cov-report=term-missing --cov-fail-under=80"
SKILL.md
npx skills add https://github.com/alinaqi/maggy --skill python

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3
repo stars706
Last updatedJuly 14, 2026
Repositoryalinaqi/maggy

What it does

Apply consistent type-safe, tested Python conventions with ruff, mypy, and pytest when editing Python files.

Who is it for?

Python codebases that need strict typing, linting, and pytest coverage enforced in CI.

When should I use this skill?

Working on Python files, pyproject.toml, or requirements files.

What you get

A Python project with mypy --strict, ruff, pytest coverage gate, and pre-commit hooks.

  • pyproject.toml tool config
  • GitHub Actions quality gate
  • pre-commit hooks

By the numbers

  • 80% coverage fail-under threshold
  • 6 listed Python anti-patterns

Files

SKILL.mdMarkdownGitHub ↗

Python Skill

---

Type Hints

  • Use type hints on all function signatures
  • Use typing module for complex types
  • Run mypy --strict in CI
def process_user(user_id: int, options: dict[str, Any] | None = None) -> User:
    ...

---

Project Structure

project/
├── src/
│   └── package_name/
│       ├── __init__.py
│       ├── core/           # Pure business logic
│       │   ├── __init__.py
│       │   ├── models.py   # Pydantic models / dataclasses
│       │   └── services.py # Pure functions
│       ├── infra/          # Side effects
│       │   ├── __init__.py
│       │   ├── api.py      # FastAPI routes
│       │   └── db.py       # Database operations
│       └── utils/          # Shared utilities
├── tests/
│   ├── unit/
│   └── integration/
├── pyproject.toml
└── CLAUDE.md

---

Tooling (Required)

# pyproject.toml
[tool.ruff]
line-length = 100
select = ["E", "F", "I", "N", "W", "UP"]

[tool.mypy]
strict = true

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--cov=src --cov-report=term-missing --cov-fail-under=80"

---

Testing with Pytest

# tests/unit/test_services.py
import pytest
from package_name.core.services import calculate_total

class TestCalculateTotal:
    def test_returns_sum_of_items(self):
        # Arrange
        items = [{"price": 10}, {"price": 20}]
        
        # Act
        result = calculate_total(items)
        
        # Assert
        assert result == 30

    def test_returns_zero_for_empty_list(self):
        assert calculate_total([]) == 0

    def test_raises_on_invalid_item(self):
        with pytest.raises(ValueError):
            calculate_total([{"invalid": "item"}])

---

GitHub Actions

name: Python Quality Gate

on: [push, pull_request]

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'
          
      - name: Install dependencies
        run: |
          pip install -e ".[dev]"
          
      - name: Lint (Ruff)
        run: ruff check .
        
      - name: Format Check (Ruff)
        run: ruff format --check .
        
      - name: Type Check (mypy)
        run: mypy src/
        
      - name: Test with Coverage
        run: pytest

---

Pre-Commit Hooks

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.8.0
    hooks:
      - id: ruff
        args: [--fix]
      - id: ruff-format

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.13.0
    hooks:
      - id: mypy
        additional_dependencies: [pydantic]
        args: [--strict]

  - repo: local
    hooks:
      - id: pytest
        name: pytest
        entry: pytest tests/unit -x --tb=short
        language: system
        pass_filenames: false
        always_run: true

Install and setup:

pip install pre-commit
pre-commit install

---

Patterns

Pydantic for Data Validation

from pydantic import BaseModel, Field

class CreateUserRequest(BaseModel):
    email: str = Field(..., min_length=5)
    name: str = Field(..., max_length=100)

Dependency Injection

# Don't import dependencies directly in business logic
# Pass them in

# Bad
from .db import database
def get_user(user_id: int) -> User:
    return database.fetch(user_id)

# Good
def get_user(user_id: int, db: Database) -> User:
    return db.fetch(user_id)

Result Pattern (No Exceptions in Core)

from dataclasses import dataclass

@dataclass
class Result[T]:
    value: T | None
    error: str | None
    
    @property
    def is_ok(self) -> bool:
        return self.error is None

---

Python Anti-Patterns

  • from module import *
  • ❌ Mutable default arguments
  • ❌ Bare except: clauses
  • ❌ Using type: ignore without explanation
  • ❌ Global variables for state
  • ❌ Classes when functions suffice

Related skills

FAQ

What tools does this skill require?

It requires ruff for linting/formatting, mypy in strict mode for type checking, and pytest for testing.

What test coverage does it enforce?

The pytest config sets --cov-fail-under=80, so tests must cover at least 80% of src.

Pythonbackendtesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.