Back to Skills

python-expert

verified

Use for Python development requiring async programming, type system expertise, testing patterns, or performance optimization.

View on GitHub

Marketplace

s5y-dev

rstarkey/s5y-plugins

Plugin

s5y-plugins

Repository

rstarkey/s5y-plugins
1stars

skills/python-expert/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/rstarkey/s5y-plugins/blob/main/skills/python-expert/SKILL.md -a claude-code --skill python-expert

Installation paths:

Claude
.claude/skills/python-expert/
Powered by add-skill CLI

Instructions

# Python Expert

Elite Python 3.13+ expertise for backend development, testing, async programming, and type systems.

## When to Use

- Async/await, asyncio, concurrency patterns
- Type errors or complex annotations
- Writing/debugging tests (pytest, async, mocking)
- Performance optimization
- Security review
- Backend architecture (FastAPI, Django, SQLAlchemy)

## Core Expertise

**Python Mastery**: Decorators, context managers, metaclasses, descriptors, generators, coroutines, data model, GIL internals

**Backend**: FastAPI/Django/Flask, PostgreSQL/Redis/MongoDB, SQLAlchemy/Django ORM, REST/GraphQL/WebSockets/gRPC, OAuth2/JWT, microservices

## Code Standards

- Full type hints, Google/NumPy docstrings, 88-char lines
- PEP 8 naming, SOLID principles, secure by default
- Use f-strings for formatting, focused small functions

## Testing

**pytest**: Use `setup_method`, `pytest.raises`, `@patch` for mocking
**Async**: Use anyio for test fixtures, `AsyncMock` for mocking async functions
**Integration**: In-memory SQLite fixtures with proper cleanup
**All network calls must be mocked**

## Async/Await

- `asyncio.run()` for entry, `TaskGroup` for structured concurrency (preferred over `gather()`)
- `asyncio.timeout()` for timeouts, `Semaphore` for rate limiting
- Handle cancellation with try/finally, use `ExceptionGroup` for multiple errors
- Type: `async def foo() -> T` or `Awaitable[T]`

## Type System

**Modern syntax** (Python 3.10+): `list[str]`, `dict[str, int]`, `str | None`
**Variance**: dict invariant, Mapping covariant—use `Mapping[K, V]` when needed
**Advanced**: `Self` for fluent methods, `ParamSpec` for decorator typing, `TypedDict`

**Minimize `Any`**:
- Use `Protocol` for structural typing instead of `Any`
- Use `TypedDict` for dicts with known structure instead of `dict[str, Any]`
- Document why `Any` is necessary when it must be used

**Common fixes**: Mixed type ops, SQLAlchemy column assignments, API response access
**Atomic processing**: Fix ALL ty

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3974 chars