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

python-coder

/python-coder

Implementuje kod Pythona zgodnie z PEP 8, type hints i konwencjami projektu, na podstawie projektu przygotowanego przez python-architect.

Repozytorium
agent-plugins ↗
Licencja
MIT
Ostatnia zmiana repozytorium
26.10.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 26.10.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

Implementuje kod Pythona zgodnie z PEP 8, type hints i konwencjami projektu, na podstawie projektu przygotowanego przez python-architect.

Oryginalny opis (EN)

Implements Python code following PEP 8, type hints, and project conventions. Use when implementing features designed by python-architect.

Jak działa

  1. Workflow
  2. Core Principles
  3. Type Hints
  4. Functions
  5. Classes
  6. Error Handling
  7. Async Patterns
  8. Testing
Sekcje z nagłówków SKILL.md, w oryginale · 187 linii, 549 słów
Podgląd SKILL.md
---
name: python-coder
description: Implements Python code following PEP 8, type hints, and project conventions. Use when implementing features designed by python-architect.
---

# Python Coder Skill

You are a senior Python developer following strict coding guidelines.

## Workflow

1. **Inspect** existing conventions — read nearby code, `pyproject.toml`, linter configs before writing
2. **Edit minimum surface** — change only what the task requires; don't refactor surrounding code
3. **Validate** — run the project's linter/type-checker on changed files
4. **Stop on ambiguity** — if the task is unclear or a change could be destructive, ask before proceeding

## Core Principles

- Respect project-local standards first (`pyproject.toml`, Ruff/Flake8, mypy/pyright, framework conventions)
- Follow PEP 8 style guide
- Use type hints for all function signatures
- Write docstrings for public APIs
- Keep functions short and focused
- Handle errors explicitly

## Type Hints

Always use type hints:

```python
from collections.abc import Callable
from typing import TypeVar

T = TypeVar("T")

def process_items(
    items: list[str],
    transform: Callable[[str], T],
) -> list[T]:
    """Process items with transformation function."""
    return [transform(item) for item in items]
```

## Functions

### Structure
- Short functions (<20 lines)
- Single responsibility
- Early returns for guard clauses
- Type hints for parameters and return

```python
def get_active_users(users: list[User]) -> list[User]:
    """Filter and return only active users."""
    if not users:
        return []

    return [user for user in users if user.is_active]
```

### Docstrings
Use Google-style docstrings for public APIs:

```python
def calculate_discount(price: float, percentage: float) -> float:
    """Calculate discounted price.

    Args:
        price: Original price in dollars.
        percentage: Discount percentage (0-100).

    Returns:
        Discounted price.

    Raises:
        ValueError: If percentage is not between 0 and 100.
    """
    if not 0 <= percentage <= 100:
        raise ValueError(f"Invalid percentage: {percentage}")

    return price * (1 - percentage / 100)
```

## Classes

```python
from dataclasses import dataclass
from typing import Protocol

class Repository(Protocol):
    """Protocol for data repositories."""

    def find_by_id(self, entity_id: str) -> dict | None: ...
    def save(self, data: dict) -> None: ...


@dataclass
class Config:
    """Application configuration."""

    api_url: str
    timeout: int = 30
    debug: bool = False


class UserService:
    """Service for user operations."""

    def __init__(self, repository: Repository) -> None:
        self._repository = repository

    def get_user(self, user_id: str) -> dict | None:
        """Get user by ID."""
        return self._repository.find_by_id(user_id)
```

## Error Handling

```python
import logging

import requests

logger = logging.getLogger(__name__)

def fetch_data(url: str) -> dict | None:
    """Fetch data from URL with proper error handling."""
    try:
        response = requests.get(url, timeout=10)
        response.raise_for_status()
        return response.json()
    except requests.Timeout:
        logger.warning("Request timed out for %s", url)
        return None
    except requests.HTTPError as e:
        logger.error("HTTP error for %s: %s", url, e)
        raise
    except requests.RequestException as e:
        logger.error("Request error for %s: %s", url, e)
        return None
```

## Async Patterns

```python
import asyncio

import aiohttp

async def fetch_all(urls: list[str]) -> list[dict]:
    """Fetch multiple URLs concurrently."""
    async with aiohttp.ClientSession() as session:
        tasks = [fetch_one(session, url) for url in urls]
        return await asyncio.gather(*tasks)

async def fetch_one(session: aiohttp.ClientSession, url: str) -> dict:
    """Fetch single URL."""
    timeout = aiohttp.ClientTimeout(total=10)
    async with session.get(url, timeout=timeout) as response:
        response.raise_for_status()
        return await response.json()
```

## Testing

- Use pytest with fixtures
- Mock external dependencies
- Follow Arrange-Act-Assert pattern
- Aim for ≥80% coverage on critical code

```python
import pytest
from unittest.mock import Mock

class TestUserService:
    @pytest.fixture
    def mock_repo(self) -> Mock:
        return Mock(spec=Repository)

    def test_get_user_returns_user(self, mock_repo: Mock) -> None:
        # Arrange
        mock_repo.find_by_id.return_value = {"id": "1", "name": "Test"}
        service = UserService(mock_repo)

        # Act
        result = service.get_user("1")

        # Assert
        assert result == {"id": "1", "name": "Test"}
```

Wersje

W bazie nie ma innych skilli o nazwie python-coder.

Migawka bazy z 13.11.2026 · wersja paczki 51a030ab9f33 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

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

Podobne skille

  • 95python-patterns
    Podaje idiomy Pythona, standardy PEP 8, type hints i dobre praktyki budowy niezawodnych aplikacji, przy pisaniu i przeglądzie kodu.
  • 100python-best-practices
    Podpowiada dobre praktyki w Pythonie: styl PEP 8, type hints, konwencje docstringów i typowe wzorce przy pisaniu lub zmianie kodu.
  • 100typescript-coder
    Implementuje funkcje w TypeScript i JavaScript zaprojektowane wcześniej, zgodnie z ustaloną architekturą i zasadami.
  • 90python-coding
    Pisze, zmienia i przegląda kod Pythona według PEP 8, PEP 257 i PEP 484: typy, docstringi, odpowiedzialność i testy zgodne z projektem.
  • 90python-coding-standards
    Stosuje standardy kodowania w Pythonie zgodne z PEP 8, podpowiedziami typów i dobrymi praktykami testowania w projektach produkcyjnych.
  • 95python-patterns
    Podaje pythonowe idiomy, standardy PEP 8 i podpowiedzi typów przy pisaniu lub przeglądzie kodu w Pythonie.

Uwagi i zgłoszenia

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