com um clique
py
Python development. NOT for shell scripting (use sh) or non-Python code.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Python development. NOT for shell scripting (use sh) or non-Python code.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Development wisdom and workflow rules. NOT for project-specific conventions (those live in CLAUDE.md, edit via wisdom).
The `BUGS.md` open-issues queue — entry format, lifecycle, pruning to diary. NOT for the record-don't-fix policy (that's CLAUDE.md Bug Triage Protocol), NOT for resolved-bug history (use /diary), NOT for feature backlog (use TODO.md/specs).
Terminal demo GIF + MP4 recordings for READMEs and social (asciinema + agg + ffmpeg). NOT for general Makefile targets (use software) or GUI screenshots (use visual).
Go development. NOT for non-Go code (use rs, py, ts, tsx, or sh).
Humanize text: strip AI-isms and add real voice. NOT for drafting new copy (use writing).
Router for engineering knowledge — the language-agnostic code baseline (naming, style, boring-code, design) plus deep runbooks (Docker images, CI Makefiles, deploys, observability, Python tool distribution). NOT for language-specific idioms (use go/rs/py/ts/sh/sql) or terse Docker/systemd rules (ops keeps those hot).
| name | py |
| description | Python development. NOT for shell scripting (use sh) or non-Python code. |
| when_to_use | editing .py files, writing Python; dataclasses, type hints, enums, asyncio/asyncpg, pytest, ruff, pyright, uv, FastAPI |
Requires the software skill's code.md for shared naming, style, and design
rules. Below are Python-specific additions and deltas.
python3 -c "import ast; ast.parse(...)", uv run pyright, or ruff check — NEVER speculate or hedge.type Alias = int | str (PEP 695), not TypeAliastype Point[T] = tuple[T, T] for generic type aliasesdict[str, float], list[str], Type | NoneTYPE_CHECKING blocks — breaks runtimedefault_factory=lambda: [] — use default_factory=list; for typed collections pass the parametrized type: default_factory=dict[K, V]| None — if a field is always set at construction give it a real default (x: float = 0.0), not x: float | None = None. | None is for genuine sentinels / optional deps / nullable returns onlytyping.Protocol for duck-typed interfaces; use abc.ABC only when runtime isinstance is requiredProtocol or broad duck typing only for tests/fakes — ALWAYS type production code from production contractsLiteral['a', 'b'] for domain values — ALWAYS use enum.Enum (or str, Enum for pydantic/TOML compat). Literal is only for narrowing external/library types you do not own.is / is not, not == / != — enums are singletons; is makes the identity check explicit: if status is GameStatus.LOST: not if status == GameStatus.LOST:**kwargs as plain **kwargs: Any to a callee that owns the real typed signature — NEVER add TypedDict + Unpack just to type a passthrough; the machinery costs more than the duplication it removesget_programs(), build_index(), compute_pnl()program_lookup, symbol_map, client_index — these read as data, not actionsis_funded(), has_positions(), can_advance()finish_task() that cancels, or a get_*() that mutates, is a lie. Rename the moment name and behavior diverge.@property, @x.setter, or __getattr__/__setattr__ overrides — they are code smelldef program_lookup(self)) or compute once and store on the dataclass fieldgetattr(obj, field_name) where field_name comes from __dataclass_fields__, a loop, or an argsetattr(obj, attr, value) in a reflection loop (applying a dict of field overrides)getattr(obj, 'attr', default) when obj genuinely may lack attr (duck typing, optional mixin, app.state, enum .name fallback)getattr(world, 'cfg', None) when world.cfg is a declared typed field — write world.cfgsetattr(obj, 'literal_field', value) when the field is declared — write obj.literal_field = value.attr syntax and pyright stays quiet, it's slopasync with@dataclass(frozen=True) by default for value/data types — immutability prevents aliasing bugs, makes instances hashable, and catches accidental mutation at runtime. Drop frozen only for types that are deliberately mutated in place (accumulators, stateful objects like World/Client)frozen=True, slots=True together — slots adds faster attribute access + lower memory; the cost is only modest construction/hash overhead (reads are free)@dataclass(frozen=True) over a heterogeneous tuple used as a dict/map key — positional key[2] or key[:4] access is a smell; name the fieldsorder_key), NEVER by slicing key[:4]kw_only=True / InitVar to dodge dataclass field-ordering — if every caller passes a value the default is dead, so make the field requiredlist for ordinary sequences; reserve tuple for dict/set keys, deliberate immutability boundaries, varargs/returns where positional shape is the point, or small fixed heterogeneous records when a dataclass would be overkill.datetime.fromtimestamp(ts, tz=timezone.utc) not utcfromtimestamplog = logging.getLogger(__name__) — variable ALWAYS named logimport json_utils not import json_utils as jufrom heapq import merge as heapq_mergee — use ex, exc, errasync with asynccontextmanager for resource cleanup, never bare try/finally for pools/connectionsts, ms for timesys.path modification — ALWAYS set PYTHONPATH or install the packageglobal keyword except trivial scripts or signal handlers — ALWAYS pass state explicitlya, b, c = x, y, z — one per lineif not xs / if xs, NEVER len(xs) == 0 / len(xs) > 0 (works for any __len__/__bool__ type)Field(None) → Field(default=None), adding/removing a redundant # noqa) — keep diffs to real changesfor loop, prefer comma iteration: for x in A, B: not for x in [A, B] or for x in (A, B)__init__.py unless it contains actual codemake check: ruff lint + format check (canonical CQ target)make right: pyright only (not in pre-commit)except T, V: (no parens) is VALID on Python 3.14 (PEP 758), a SyntaxError only on <3.14. ruff 0.15.17 ruff-format strips the parens from except (T, V): — fine on 3.14; if the code must also run on <3.14, guard with except (T, V): # fmt: skippython -m pytest not pytest directly (package discovery)conftest.pyMock / MagicMock with explicit
attrs or a small fake class); NEVER make production code tolerate incomplete
fakesmodule.fn = stub) for a test seam — ALWAYS inject the dep as a param (get_cfg_fn: Callable[...] | None = None) defaulting to the module fn (get_cfg_fn or get_cfg)start_new_session=True on create_subprocess_exec (prevents Ctrl-C leak)os.killpg(os.getpgid(proc.pid), signal.SIGKILL)