一键导入
python-style
Use when writing or editing Python code. Enforces strict typing with basedpyright, ruff linting and formatting, modern Python 3.12+ idioms.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when writing or editing Python code. Enforces strict typing with basedpyright, ruff linting and formatting, modern Python 3.12+ idioms.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when migrating a Python project from Poetry to uv. Covers running `uvx migrate-to-uv`, fixing pyproject.toml conversion gaps, rewriting Dockerfiles (poetry install -> uv sync), updating .gitlab-ci.yml, and verifying the result. Trigger keywords: migrate poetry to uv, migrate-to-uv, poetry -> uv, switch to uv, replace poetry.
Use when committing, creating PRs, or managing git history. Conventional commits, pre-commit hooks with ruff and basedpyright, branching conventions.
Use when first opening an unfamiliar Python project. Quick analysis of project structure, dependencies, entry points, test setup, and tooling.
Use when working with poorly typed or legacy Python code. Covers gradual typing, safe annotation strategies, dynamic attributes, and monkeypatching without breaking behavior.
Use when refactoring Python code safely. Covers extract method/class/module, dependency inversion, constants extraction, and test-protected changes.
Use when writing tests for Python code. Covers pytest conventions, fixtures, mocking, strict type-checked tests.
| name | python-style |
| description | Use when writing or editing Python code. Enforces strict typing with basedpyright, ruff linting and formatting, modern Python 3.12+ idioms. |
from __future__ import annotations at the top of every moduletype aliases and TypedDict over raw dictsSequence, Mapping from collections.abc, not concrete types in signaturesAny — use object if truly dynamic, or narrow with isinstance checks# type: ignore[code] only with a comment explaining whyassert_never() for exhaustive checks on enums/literals@dataclass(frozen=True, slots=True) or @dataclass(slots=True) for data structuresGeneric[T] with explicit type varstyping.Protocol for structural subtypingtyping.overload for multiple call signaturesruff check --fix — lint and auto-fixruff format — formatbasedpyright — type check (also runs continuously via LSP)ruff check --fix after editsruff format after editsmatch statements where appropriate:= for combined check+assign%s or .format)pathlib.Path instead of os.pathfrom collections.abc import ... not from typing import ... (except special forms like Protocol, TypedDict, dataclass_transform)| union syntax instead of Union[...]list[...] instead of List[...], dict[...] instead of Dict[...]raise Exceptionraise ... from err for chainingResult-like patterns or explicit error types for recoverable errorsexcept: — always catch specific exceptionsfrom __future__ import annotations firstTYPE_CHECKING block for type-only importsAny markers: for each # TODO(type): comment, investigate the real typeAny is unavoidable, prefer object for truly dynamic values and narrow with isinstancetyping.cast only when the runtime type is guaranteed but the checker cannot infer itbasedpyright to dev dependencies after Phase 1 is complete: uv add --dev basedpyright or poetry add --group dev basedpyright