Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

python-expert

/python-expert

Pomaga pisać i refaktoryzować kod w Pythonie, diagnozować wydajność i dobierać biblioteki, z typami, asyncio i pandas.

Licencja
MIT
Ostatnia zmiana repozytorium
31.05.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 31.05.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pomaga pisać i refaktoryzować kod w Pythonie, diagnozować wydajność i dobierać biblioteki, z typami, asyncio i pandas.

Oryginalny opis (EN)

Expert Python: Pythonic code, typing, async, the standard library, and performance. Trigger keywords: Python, PEP 8, type hints, mypy, asyncio, generator, decorator, context manager, dataclass, pytest, pandas, numpy, packaging, uv, GIL, profiling. Use for writing/refactoring Python, fixing bugs, performance, or library/tooling guidance.

Jak działa

  1. When to Use
  2. When NOT to Use
  3. Core Principles
  4. Common Mistakes
  5. Examples
  6. See Also
Sekcje z nagłówków SKILL.md, w oryginale · 77 linii, 492 słów
Podgląd SKILL.md
---
name: python-expert
description: "Expert Python: Pythonic code, typing, async, the standard library, and performance. Trigger keywords: Python, PEP 8, type hints, mypy, asyncio, generator, decorator, context manager, dataclass, pytest, pandas, numpy, packaging, uv, GIL, profiling. Use for writing/refactoring Python, fixing bugs, performance, or library/tooling guidance."
---

# Python Expert

> Write code that reads like the problem. Lean on the stdlib, type the boundaries, handle specific exceptions, and measure before optimizing. There's usually one obvious, Pythonic way — find it.

## When to Use
- Writing, refactoring, or reviewing Python.
- Best practices: PEP 8, typing, packaging, project layout.
- Debugging exceptions/tracebacks or unexpected behavior.
- Performance/profiling, async, or data-stack (numpy/pandas) work.

## When NOT to Use
- Another language → relevant language skill.
- Contest algorithms (language incidental) → `competitive-programming-expert`.
- System/architecture design → `software-architect`.
- DL modeling/training → `deep-learning-expert`.

## Core Principles

### 1. Pythonic & typed
- PEP 8 via autoformatter (`ruff format`/`black`) + linter (`ruff`). Comprehensions, generators, `enumerate`/`zip`, `pathlib`, f-strings.
- Type public functions; run `mypy`/`pyright` strict for libraries. Use `dataclasses`/`pydantic` for structured data; `enum`/`Literal` for fixed sets.

### 2. Correct & robust
- Catch **specific** exceptions; never bare `except:`. Re-raise with context (`raise X from e`). EAFP (try/except) over LBYL where it reads cleaner.
- Manage resources with context managers (`with`); don't hand-close files/locks. Prefer pure functions and immutability where practical.

### 3. Use the stdlib first
- `collections` (`Counter`, `defaultdict`, `deque`), `itertools`, `functools` (`lru_cache`, `cached_property`), `contextlib`, `pathlib`, `datetime`/`zoneinfo`. Reach for a dependency only when the stdlib falls short.
- Tooling: `uv` (or Poetry) for envs/deps, `pytest` for tests, `ruff` for lint/format.

### 4. Concurrency & performance
- Measure first (`timeit`, `cProfile`, `py-spy`). Use `set`/`dict` for O(1) membership; pick the right container.
- Concurrency model matters because of the GIL: **`asyncio`** for high-concurrency I/O, **threads** for blocking I/O calls, **`multiprocessing`** (or vectorized numpy) for CPU-bound work. (Free-threaded 3.13+ is changing this — know your runtime.)

## Common Mistakes
- **Mutable default arguments** (`def f(x=[])`) → shared across calls; use `None` + assign inside.
- **Bare `except:`** → swallows `KeyboardInterrupt`/bugs; catch specific types.
- **`==` vs `is`** → `is` only for `None`/singletons, not value equality.
- **Late-binding closures in loops** → capture with a default arg or `functools.partial`.
- **String-concatenating in a loop** / building lists you immediately sum → use `join`/generators.
- **`from module import *`** and deep relative imports → explicit imports.
- **Threads for CPU-bound work** → GIL-bound; use processes or numpy.

## Examples

**Idiomatic, typed, safe**
```python
from __future__ import annotations
from collections import Counter
from collections.abc import Iterable

def top_words(words: Iterable[str], n: int = 3) -> list[tuple[str, int]]:
    """Return the n most common non-empty words, case-insensitively."""
    return Counter(w.casefold() for w in words if w).most_common(n)
```

**Async I/O with bounded concurrency**
```python
import asyncio, httpx

async def fetch_all(urls: list[str], limit: int = 10) -> list[str]:
    sem = asyncio.Semaphore(limit)
    async with httpx.AsyncClient(timeout=10) as client:
        async def one(u: str) -> str:
            async with sem:
                r = await client.get(u); r.raise_for_status()
                return r.text
        return await asyncio.gather(*(one(u) for u in urls))
```

## See Also
- `competitive-programming-expert` — algorithmic Python + fast I/O.
- `deep-learning-expert` — PyTorch/NumPy on Python fundamentals.
- `testing-expert` — `pytest`, fixtures, fakes. `performance-expert` — profiling.
- `rules/python-style-guide.md` — enforceable style rules.

Wersje

RepozytoriumWynikLicencja
Ta strona · miaoge-ge/coding-agent-skills100MIT
jggomez/expert-ai-developer-skills100Apache-2.0
traylinx/switchAILocal100Apache-2.0
personamanagmentlayer/pcl100Apache-2.0
personamanagmentlayer/pcl100Apache-2.0
wesleyegberto/software-engineering-skills90MIT

Migawka bazy z 28.10.2026 · wersja paczki 42e0a561f90d (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100sota-python
    Stosuje zasady pisania i audytu kodu w Pythonie: uv, ścisłe typowanie, asyncio, bezpieczeństwo, wydajność oraz praktyki FastAPI, Django i pytest.
  • 100python
    Prowadzi konfigurację projektu Python: pyproject.toml, ruff, mypy, pytest, Pydantic, dobór modelu danych oraz testów.
  • 90python-conventions
    Dopilnowuje, by zmiany w Pythonie spełniały konwencje repozytorium: PEP 8, pełne podpowiedzi typów sprawdzane mypy lub pyright, dataclasses, ruff, asyncio i pytest z pokryciem przez uv lub poetry.
  • 100python
    Obsługuje sam język Python: generyki PEP 695, typowanie mypy --strict, dataclass, Protocol, TypedDict, asyncio.TaskGroup, układ src/ z pyproject.toml i uv oraz bramkę ruff, mypy i pytest.
  • 100python
    Pisze i modernizuje kod Python 3.11+ z pełnymi adnotacjami typów, async I/O, dataclasses i protokołami, testami pytest oraz bramką jakości ruff i mypy --strict.
  • 80devs:python-core
    Pomaga pisać, debugować i projektować kod Pythona: tracebacki, typowanie, asyncio, pytest, FastAPI i zarządzanie środowiskiem uv.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.