From python-engineering
Identifies legacy Python patterns and applies 3.11+ modernizations like walrus operator, match-case, Self type, and pytest-mock. Reviews files or explains topics with PEP examples.
npx claudepluginhub jamie-bitflight/claude_skills --plugin python-engineeringThis skill uses the workspace's default tool permissions.
<modernization_targets>$ARGUMENTS</modernization_targets>
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
<modernization_targets>$ARGUMENTS</modernization_targets>
The model applies modern Python 3.11+ patterns when writing or reviewing Python code.
<modernization_targets/>
If file paths provided:
If topic provided (e.g., "typing", "match-case"):
If no arguments:
# Legacy (NEVER use)
from typing import List, Dict, Optional, Union
# Modern (ALWAYS use)
items: list[str]
config: dict[str, int] | None
value: int | str
# Legacy
data = fetch_data()
if data:
process(data)
# Modern
if data := fetch_data():
process(data)
Use match-case when using elif. Use if/elif only for inequalities or boolean operators.
# Modern (for any elif pattern)
match status_code:
case 200: return "OK"
case 404: return "Not Found"
case _: return "Unknown"
from typing import Self
class Builder:
def add(self, x: int) -> Self:
self.value += x
return self
except FileNotFoundError as e:
e.add_note(f"Attempted path: {path}")
raise
from enum import StrEnum
class Status(StrEnum):
PENDING = "pending"
RUNNING = "running"
import tomllib
from pathlib import Path
config = tomllib.load(Path("pyproject.toml").open("rb"))
ALWAYS use pytest-mock, NEVER unittest.mock:
# Legacy (NEVER use)
from unittest.mock import Mock, patch
# Modern (ALWAYS use)
from pytest_mock import MockerFixture
def test_feature(mocker: MockerFixture) -> None:
mock_func = mocker.patch('module.function', return_value=42)
ALWAYS use Annotated syntax:
from typing import Annotated
import typer
@app.command()
def process(
input_file: Annotated[Path, typer.Argument(help="Input file")],
verbose: Annotated[bool, typer.Option("--verbose", "-v")] = False,
) -> None:
"""Process input file."""
pass
Use explicit width control for production CLIs:
from rich.console import Console
from rich.table import Table
from rich.measure import Measurement
def _get_table_width(table: Table) -> int:
temp_console = Console(width=9999)
measurement = Measurement.get(temp_console, temp_console.options, table)
return int(measurement.maximum)