writing-python

Installation
SKILL.md

Python Development (3.12+)

Critical Output Rules

  • State Python 3.12+ typing choices explicitly and include a small example when planning code: concrete types, X | Y, generics/Protocol where useful, and Any is not the default.
  • Prefer stdlib first for small tools: argparse, pathlib, json, dataclasses, urllib, typing.
  • Prefer flat control flow with guard clauses and early returns; keep the happy path visually obvious. In implementation plans, explicitly say validation/parsing should fail fast with guard clauses before the happy path summary logic.
  • Catch multiple exception types with tuple syntax: except (KeyError, json.JSONDecodeError):, not except KeyError, json.JSONDecodeError:. Parenthesized tuples work on Python 3.12+, allow as exc, and avoid 3.14-only comma syntax that looks like a parsing accident.
  • Include behavior tests with pytest for the happy path and invalid input/error paths.
  • Include verification commands when code changes: uv run pytest, uv run ruff check ., uv run ruff format --check ., and uv run pyright when configured.
  • Keep dependencies minimal; add one only when real requirements beat stdlib simplicity. Dependency guidance must still mention typed boundaries and pytest coverage for the script.
  • Do not run destructive shell commands. For broad or risky changes, state the risk and ask before acting.

Core Philosophy

Stdlib-first stance, no-Any typing, Protocol-over-ABC, flat control flow, explicit error handling, structured logging, the no-destructive-commands safety rule, and the post-generation verification loop are in references/principles.md — read it before generating code.

Quick Patterns

Installs
5
GitHub Stars
32
First Seen
Apr 14, 2026
writing-python — alexei-led/cc-thingz