Python
Skill nimadorostkar/Claude-Skills-collection/skills/languages/python
A curated library of 137 production-grade skills for Claude and other AI coding agents.
npx -y skills add nimadorostkar/Claude-Skills-collection --skill pythonAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 23 days oldThe repository was created 23 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 23 stars23 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when writing, reviewing, or modernizing Python 3.11+ code. Produces fully type-annotated modules, async I/O, dataclasses and protocols, pytest suites, and a lint/type gate built on ruff and mypy --strict.
SKILL.md
4.5 KB, 989 tokens by cl100k_base, as published. Nobody here has run it
Python
Purpose
Write production Python that is type-safe, async-first, and testable. This skill sets a single quality bar — annotated, linted, tested — and applies it consistently to new code and to code being modernized.
When to Use
- Writing new Python modules, packages, or services.
- Adding type coverage to an untyped or partially typed codebase.
- Converting blocking I/O to
asyncio, or debugging async behavior. - Standing up a pytest suite, fixtures, or parametrized tests.
- Modernizing Python 2-era or pre-3.10 idioms.
Capabilities
- Full type annotation, including generics,
Protocol,TypedDict, andParamSpec. - Async design: task groups, timeouts, cancellation, structured concurrency.
- Data modeling with
dataclasses,enum, and Pydantic when validation is needed. - Test authoring: fixtures, factories, mocking, property-based tests via Hypothesis.
- Tooling configuration:
pyproject.toml, ruff, mypy, uv or Poetry. - Profiling and hot-path optimization.
Inputs
- Source files or a package path.
- Target Python version (default: 3.12).
- Existing tooling config, if any.
- Runtime constraints: sync vs async, framework, deployment target.
Outputs
- Type-annotated source that passes
mypy --strict. - A pytest suite with meaningful assertions, not coverage padding.
- A
pyproject.tomlsection configuring ruff and mypy. - A short summary of behavioral changes when refactoring.
Workflow
- Survey — Read the module and its imports. Identify the runtime model (sync, async, threaded) and existing conventions. Do not fight established conventions without a reason.
- Model the data — Define dataclasses, enums, and protocols before writing logic. Type the boundaries first.
- Implement — Write the smallest correct version. Prefer standard library over dependencies.
- Test — Cover the contract and the failure modes, not the implementation details.
- Gate — Run
ruff check --fix,ruff format,mypy --strict,pytest. Fix each failure and re-run until all four are clean.
Best Practices
- Use
X | None, notOptional[X]. Uselist[str], notList[str]. - Never use a bare
except:. Catch the narrowest exception that can actually be raised. - Raise domain-specific exceptions; do not signal failure with
Nonereturn values. - Use
pathlib.Pathfor every filesystem path. - Never mutate a default argument. Use
field(default_factory=...). - Guard async code with explicit timeouts; an un-timed
awaiton a network call is a latency bug waiting to happen. - Log with the
loggingmodule and structured extras — neverprintin library code.
Examples
Typed, async, cancellation-safe fetch:
import asyncio
from dataclasses import dataclass
import httpx
@dataclass(frozen=True, slots=True)
class Quote:
symbol: str
price: float
class QuoteUnavailable(Exception):
"""Raised when the upstream cannot serve a quote."""
async def fetch_quotes(symbols: list[str], *, timeout: float = 5.0) -> list[Quote]:
async with httpx.AsyncClient(timeout=timeout) as client:
async with asyncio.TaskGroup() as tg:
tasks = {s: tg.create_task(client.get(f"/quote/{s}")) for s in symbols}
quotes: list[Quote] = []
for symbol, task in tasks.items():
response = task.result()
if response.status_code != 200:
raise QuoteUnavailable(symbol)
quotes.append(Quote(symbol=symbol, price=response.json()["price"]))
return quotes
Test that covers the contract and the failure:
import pytest
@pytest.mark.asyncio
async def test_fetch_quotes_raises_on_upstream_error(mock_client):
mock_client.get.return_value.status_code = 503
with pytest.raises(QuoteUnavailable, match="AAPL"):
await fetch_quotes(["AAPL"])
Notes
TaskGrouprequires Python 3.11+. On 3.10, useasyncio.gather(..., return_exceptions=True)and re-raise explicitly.mypy --stricton a large legacy codebase is a project, not a task. Enable it per-module withdisallow_untyped_defsand expand the surface gradually.- Prefer
uvfor new projects; it is materially faster than Poetry and pip for resolution and installs.
Gives 0 of the 12 instructions most quality gates skills give in 989 tokens
Counted across 1,195 of the 2,094 authors here whose files we hold, read 2026-08-07
- read the output and check the exit codein 54 of 1195, across 14 files
- verify requirements using a line-by-line checklistin 53 of 1195, across 12 files
- identify the verification command proving the claimin 51 of 1195, across 12 files
- run the full verification commandin 50 of 1195, across 11 files
- verify output confirms the claimin 49 of 1195, across 12 files
- check version control diff after agent delegationin 46 of 1195, across 6 files
- state claim with evidencein 44 of 1195, across 4 files
- run the test suitein 33 of 1195, across 26 files
- keep state in memory by defaultin 27 of 1195, across 6 files
- make prototype runnable with one commandin 26 of 1195, across 5 files
- produce a verification reportin 25 of 1195, across 14 files
- detect the package manager from lockfilesin 24 of 1195, across 5 files
Said here and by no other author read
- Use type annotations on all modules
- Define data and protocols before logic
- Write tests covering contracts and failure modes
- Run mypy strict before finishing
- Guard async code with explicit timeouts
- Use the logging module with structured extras
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.