python

Creates, modifies, and reviews repository Python code with type hints, Ruff linting, and pytest tests.

Updated Mar 29, 2024
One-click install
npx skills add https://github.com/petobens/ai-harness --skill python-petobens
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python
Source: https://github.com/petobens/ai-harness/tree/main/skills/python
Command: npx skills add https://github.com/petobens/ai-harness --skill python-petobens

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Python code that stays consistent with modern standards and repository conventions is hard to enforce manually. This Skill ensures every Python change follows current syntax, typing, formatting, and testing practices before it lands in a repository. ## Core Features & Use Cases - Modern Python Standards: Targets Python 3.14+ syntax with built-in generics, X | None unions, pathlib, and NumPy-style docstrings. - Quality Gates: Formats and lints with Ruff, type-checks with zmypy (falling back to mypy), and adds pytest tests for non-trivial changes. - Repository Awareness: Defers to existing repository configuration and instructions when they conflict with the defaults. - Use Case: Ask the assistant to add a new data-processing module to your project, and it will produce typed, documented, linted, and tested code that matches your repo's conventions. ## Quick Start Use the python skill to write a typed utility module for parsing CSV files and add pytest coverage for it.

Frequently Asked Questions about python

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

FAQPage Schema
How do I write modern typed Python code for my repository?

Use Python 3.14+ syntax with built-in generics like list and dict, X | None unions instead of Optional, and pathlib instead of os.path. This Skill applies those conventions automatically and validates the result with Ruff and a type checker.

How to lint and type-check Python code with Ruff and mypy?

Run Ruff for formatting and linting, then type-check with zmypy, falling back to mypy if zmypy is unavailable. The Skill performs both steps before finishing any change to catch style and type errors early.

Should I use typing.List or built-in list for type hints?

Use built-in generics like list and dict rather than typing.List or typing.Dict, and prefer X | None over Optional. This matches modern Python syntax and is the default convention enforced by this Skill.

When should I not use this Python coding skill?

Do not use it for temporary agent or subagent helper scripts that will not remain in a repository. It is designed for durable code delivered to users or committed to projects, where linting, typing, and tests matter.

Does this Skill override my repository's existing style configuration?

No. Repository instructions take priority, and repository configuration overrides both the instructions and the Skill defaults. The Skill only applies its conventions where the repository does not define its own.