conventions-python
MANDATORY for any work on Python files (*.py). Load this before editing, reviewing, or creating any *.py file. House Python 3.12+ conventions covering…
от Integralist★ 31 звезда на GitHub
Установить conventions-python в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
[!NOTE]
If invoked directly with no specific task, load these conventions and stop.
House deltas for Python. Target Python 3.12+ unless pyproject.toml or.python-version pins an older runtime. In an established repo, match its
existing patterns.
Tooling
Use uv for environments/dependencies (uv sync, uv add, uv run). Before
finishing Python changes, run (or use the repo's Make/lint targets):
ruff format .
ruff check --fix .
uv run mypy . # or `uv run pyright .` where the repo uses it
uv run pytest # narrow with path or -k when iterating
Fix root causes over suppressions; if needed, name exact codes
(# noqa: F401, # type: ignore[assignment]). For new projects, configurepyproject.toml with ruff (line-length = 88, rulesE, W, F, I, B, UP, RUF), mypy (strict = true, warn_return_any = true,warn_unused_configs = true), and pytest (testpaths = ["tests"]).
Comments and docstrings
Give every module, class, function, and method (public or private) a docstring,
and put a comment above every module-level constant and every dataclass or
Pydantic field. State what it is or does and why it exists (constraint, policy,
invariant, or caller need), describing observable effect rather than steps,
and never restating the name.
Types and data
- Annotate all function parameters and return types. Use modern 3.12+ syntax:
X | Y, built-in generics (list[str]),collections.abcabstractions
(Sequence,Mapping,Callable), PEP 695 type parameters
(def first[T](items: Sequence[T]) -> T) andtype UserID = str,Self,
andProtocol. AvoidAny; use a precise type, type param, orobject. - Data structures:
@dataclass(frozen=True, slots=True)for internal
values; PydanticBaseModelfor boundaries, JSON, and settings;StrEnum
(orEnum) for fixed sets.
Idioms, errors, async, and logging
- Export explicit public APIs via
__all__in__init__.pyand multi-module
packages; nofrom x import *. - Use
pathlib.Path(passingencoding="utf-8"for text), context managers
for resources, and guard clauses to keep nesting shallow. - Give each module/service a base exception inheriting
Exception(neverBaseException), chain withraise ... from err, and avoid bareexcept:. - Use
asyncio.TaskGroup(notgather),asyncio.timeout(notwait_for),
andasyncio.to_threadfor blocking work. - Log via
logging.getLogger(__name__)orstructlog(neverprint()) with
lazy%sarguments rather than f-strings.
Testing
- Use
pytest(test_*.py,test_*),@pytest.fixture,@pytest.mark.parametrize,pytest.raises(..., match=...), andunittest.mock/pytest-mock. Add a brief docstring on each test stating
what it proves. - Test through public APIs—don't import
_-prefixed internals or assert on
private attributes. Extract complex internal logic into a focused submodule
with a public API if needed. - Put integration tests in
tests/integration/ortests/e2e/against a real
app instance (e.g.httpx.AsyncClient+ASGITransport), overriding only
at wire/storage boundaries.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл conventions-python?
MANDATORY for any work on Python files (*.py). Load this before editing, reviewing, or creating any *.py file. House Python 3.12+ conventions covering uv/ruff/mypy tooling, typing, data models, async, logging, and pytest.
Как установить скилл conventions-python?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл conventions-python запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…