ankyr-python

Enforces Python 3.12+ typing, imports, and tooling rules when writing or reviewing Python code.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/GuyErreich/AI_Agents --skill ankyr-python-guyerreich
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ankyr-python
Source: https://github.com/GuyErreich/AI_Agents/tree/main/plugins/ankyr-python/skills/ankyr-python
Command: npx skills add https://github.com/GuyErreich/AI_Agents --skill ankyr-python-guyerreich

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Python codebases drift into inconsistent typing, legacy imports, and weak error handling when multiple contributors or AI agents write code without shared language-level rules. This Skill provides concrete, enforceable standards for modern Python so generated and reviewed code stays consistent. ## Core Features & Use Cases - Typing discipline: Mandates builtin generics, explicit annotations at public boundaries, and bans Any and bare object in favor of TypeAlias, NewType, Protocol, or Pydantic v2 models. - Import and packaging rules: Enforces explicit relative imports, grouped import order, __all__ public surfaces, and uv/pyproject.toml tooling without parallel pip workflows. - Error handling and testing patterns: Requires fail-fast validation, semantic custom exceptions, structured logging, and pytest/pytest-mock conventions with shared fixtures. - Use Case: When an AI agent writes a new Python module, it applies these rules automatically — using pathlib instead of os.path, Google-style docstrings, keyword-only arguments, and then validating with ruff, mypy, and pytest before completion. ## Quick Start Apply the ankyr-python rules to write a typed, ruff-clean Python module with Google docstrings and pytest tests.

Frequently Asked Questions about ankyr-python

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

FAQPage Schema
How do I replace typing.List and typing.Dict in modern Python?▼

Use builtin generics like list, dict, tuple, and set directly in annotations instead of legacy typing aliases. Python 3.12+ supports these natively, and ruff can flag remaining legacy imports automatically.

When should I use dataclass vs Pydantic for Python models?▼

Use @dataclass for in-process structured data you construct yourself, and Pydantic v2 BaseModel for external input like YAML, JSON, env vars, or HTTP that must be parsed and validated. Never validate untrusted input with ad-hoc isinstance checks on dataclasses.

How do I avoid using Any in Python type annotations?▼

Replace Any with a specific type, or define one using TypeAlias for named shapes, NewType for distinct domain identifiers, or Protocol for structural interfaces. Every public boundary should carry an explicit annotation.

Does this work with pytest and pytest-mock?▼

Yes, the testing rules require pytest and pytest-mock only, banning unittest.mock imports. Tests should use tmp_path or the pyfakefs fs fixture, parametrize edge cases, and mock external boundaries like GitPython or subprocess with mocker.

Why should Python code use pathlib instead of os.path?▼

pathlib provides an object-oriented Path API that is less error-prone than string-based os.path manipulation. The rules mandate pathlib for all filesystem paths and forbid os.path entirely.

What tooling does this Python workflow require?▼

The workflow standardizes on uv for installs and lockfiles, pyproject.toml for configuration, ruff for linting and import sorting, and mypy for type-checking. It forbids parallel pip/requirements.txt or setup.py workflows.