src/maverick/skills/maverick_python_typing/SKILL.md
Python type hints, mypy, Protocol, and static typing best practices
npx skillsauth add get2knowio/maverick maverick-python-typingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guidance for Python type hints and static type checking.
from __future__ import annotations
def process(items: list[str]) -> dict[str, int]:
"""Modern syntax without importing List, Dict."""
return {item: len(item) for item in items}
# Modern
def func(value: str | None = None) -> int | float:
pass
# Old style
from typing import Optional, Union
def func(value: Optional[str] = None) -> Union[int, float]:
pass
def greet(name: str, age: int) -> str:
return f"Hello {name}, age {age}"
from collections.abc import Sequence, Mapping
def process_items(items: Sequence[str]) -> Mapping[str, int]:
"""Accept any sequence, return any mapping."""
return {item: len(item) for item in items}
from collections.abc import Callable
def apply(func: Callable[[int], str], value: int) -> str:
return func(value)
from typing import Protocol
class Drawable(Protocol):
def draw(self) -> None: ...
def render(obj: Drawable) -> None:
"""Accepts any object with draw() method."""
obj.draw()
from typing import TypeVar, Generic
T = TypeVar('T')
class Stack(Generic[T]):
def __init__(self) -> None:
self._items: list[T] = []
def push(self, item: T) -> None:
self._items.append(item)
def pop(self) -> T:
return self._items.pop()
# pyproject.toml
[tool.mypy]
python_version = "3.11"
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
development
Rust unsafe code, FFI, and safety invariants
development
Rust testing patterns (unit, integration, property-based)
development
Rust performance optimization and zero-cost abstractions
development
Rust ownership, borrowing, and lifetimes