$npx -y skills add alexei-led/cc-thingz --skill writing-pythonUse this only for Python 3.12+ code. Keep language-agnostic rules out of this skill.
| 1 | # Python Development |
| 2 | |
| 3 | Use this only for Python 3.12+ code. Keep language-agnostic rules out of this skill. |
| 4 | |
| 5 | ## Read First |
| 6 | |
| 7 | Read [principles.md](references/principles.md) before generating or changing Python code. |
| 8 | |
| 9 | ## Core Rules |
| 10 | |
| 11 | - Prefer existing project patterns over these defaults. |
| 12 | - Inspect the project Python target before using 3.12-only syntax. |
| 13 | - Prefer stdlib and existing dependencies before adding packages. |
| 14 | - Validate untyped boundary input before it spreads. |
| 15 | |
| 16 | ## Comments and Docstrings |
| 17 | |
| 18 | - Prefer clear names and small functions over explanatory comments. |
| 19 | - Add comments only for non-obvious constraints, invariants, side effects, tradeoffs, or public contracts. |
| 20 | - Keep comments short. Move longer rationale to docs, issue links, or design notes. |
| 21 | - Do not comment obvious code or restate the syntax. |
| 22 | - Keep tests readable without comments; add one only for unobvious fixtures, timing, concurrency, or regression context. |
| 23 | - Use docstrings for public or non-obvious modules, classes, functions, and methods. Do not restate the signature. |
| 24 | |
| 25 | ## Conditional References |
| 26 | |
| 27 | - [patterns.md](references/patterns.md) — read for module design, typing, async, config, file I/O, and error patterns. |
| 28 | - [cli.md](references/cli.md) — read before writing or changing Python CLIs. |
| 29 | - [testing.md](references/testing.md) — read before adding or reshaping Python tests; treat slow tests as feedback-loop defects. |
| 30 | - [linting.md](references/linting.md) — read before changing ruff or pyright config, or the lint/format/type-check flow. |
| 31 | |
| 32 | ## Verification |
| 33 | |
| 34 | Run project-configured tests, lint, format, and type checks. Prefer focused pytest commands for the edit loop, then the broader project command before final output. Prefer pytest, ruff, and pyright when present. |
| 35 | |
| 36 | If a tool is not configured, say so and run the closest available gate. If a check fails, diagnose the cause, make a targeted fix, and rerun the relevant check. |
| 37 | |
| 38 | ## Python-Specific Failure Cases |
| 39 | |
| 40 | - No clear project root: locate `pyproject.toml` before editing or choosing commands. |
| 41 | - Unknown Python target: inspect `pyproject.toml`, `.python-version`, CI, or lockfiles before using 3.12-only syntax. |
| 42 | - Type checker reports missing attributes: check imports, package exports, and runtime shape before loosening types. |
| 43 | |
| 44 | ## Final Response |
| 45 | |
| 46 | Include: |
| 47 | |
| 48 | - changed files |
| 49 | - checks run and results |
| 50 | - checks skipped with reasons |
| 51 | - remaining risks or follow-ups |