python
/python
Expert modern Python (3.11+) assistance covering type annotations, async/await, generators, dataclasses, context managers, and virtual environment tooling. Use when writing idiomatic Python, building web backends, structuring data science pipelines, or optimizing Python performance.
- Author
- G1Joshi ↗
- Repository
- Agent-Skills ↗
- Licence
- MIT
- Last repository change
- 01.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 3
No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Expert modern Python (3.11+) assistance covering type annotations, async/await, generators, dataclasses, context managers, and virtual environment tooling. Use when writing idiomatic Python, building web backends, structuring data science pipelines, or optimizing Python performance.
Original author description
Expert modern Python (3.11+) assistance covering type annotations, async/await, generators, dataclasses, context managers, and virtual environment tooling. Use when writing idiomatic Python, building web backends, structuring data science pipelines, or optimizing Python performance.
How it works
- When to Use
- Quick Start
- Core Concepts
- Common Patterns
- Best Practices
- Troubleshooting
- References
SKILL.md preview
---
name: python
description: Expert modern Python (3.11+) assistance covering type annotations, async/await, generators, dataclasses, context managers, and virtual environment tooling. Use when writing idiomatic Python, building web backends, structuring data science pipelines, or optimizing Python performance.
---
# Python
Modern Python development with type hints, async/await, and best practices.
## When to Use
- **Artificial Intelligence, Machine Learning & LLMs**: Developing AI models with PyTorch, TensorFlow, Hugging Face, LangChain, and vLLM.
- **High-Performance Web APIs (FastAPI / Django)**: Building async web backends, microservices, and enterprise applications.
- **Data Engineering & Analytics**: Processing data pipelines using Pandas, Polars, PySpark, and DuckDB.
- **Automation, Scripting & DevOps**: Writing robust infrastructure automation, system utilities, and CLI tools.
## Quick Start
```python
from typing import Optional, List
def process_items(
items: list[str],
transform: Optional[callable] = None,
) -> list[str]:
if transform:
return [transform(item) for item in items]
return items
```
## Core Concepts
### Strict Type Hints & Runtime Validation (Pydantic / Mypy)
Modern Python (3.11/3.12+) features comprehensive type annotations and structural models:
```python
from typing import Annotated
from pydantic import BaseModel, EmailStr, Field
class UserProfile(BaseModel):
id: str
email: EmailStr
age: Annotated[int, Field(ge=18, le=120)]
roles: list[str] = ["member"]
# Automatic validation and serialization
user = UserProfile(id="usr_415", email="alice@example.com", age=28)
print(user.model_dump_json())
```
### Asynchronous Event Loop & Asyncio Task Groups
Concurrent asynchronous I/O with modern exception handling:
```python
import asyncio
import httpx
async def fetch_metric(client: httpx.AsyncClient, metric_id: int) -> dict:
resp = await client.get(f"https://api.example.com/metrics/{metric_id}")
return resp.json()
async def main():
async with httpx.AsyncClient() as client:
# Python 3.11+ TaskGroup manages structured concurrency cleanly
async with asyncio.TaskGroup() as tg:
task1 = tg.create_task(fetch_metric(client, 1))
task2 = tg.create_task(fetch_metric(client, 2))
print("Results:", task1.result(), task2.result())
asyncio.run(main())
```
### Modern Dependency Management with `uv` / `poetry`
Replaces slow legacy pip and virtualenv workflows with lightning-fast Rust-based tooling:
```bash
# Instant package installation and lockfile management via uv
uv venv
uv pip install -r requirements.txt
```
## Common Patterns
### Structured Concurrency with Asyncio TaskGroups
**Problem**: Concurrent asynchronous operations risking dangling unhandled tasks or memory leaks on exceptions.
**Solution**:
```python
import asyncio
async def fetch_all(urls: list[str]) -> list[Response]:
async with aiohttp.ClientSession() as session:
tasks = [fetch_one(session, url) for url in urls]
return await asyncio.gather(*tasks)
# Use TaskGroup for structured concurrency (3.11+)
async def process_batch(items: list[Item]) -> list[Result]:
results = []
async with asyncio.TaskGroup() as tg:
for item in items:
tg.create_task(process_item(item, results))
return results
```
### Context Managers
**Problem**: Safely managing acquisition and release of external resources (locks, files, sockets) in the face of unhandled exceptions.
**Solution**:
```python
from contextlib import contextmanager, asynccontextmanager
@contextmanager
def managed_resource() -> Iterator[Resource]:
resource = Resource()
try:
yield resource
finally:
resource.cleanup()
```
## Best Practices
**Do**:
- Adopt `uv` for Package Management: Use `uv` (10-100x faster than pip) for virtual environments and dependency resolution.
- Lint and Format with Ruff: Replace Flake8, Black, and isort with the blazing-fast Rust-based `ruff` linter/formatter.
- Enforce Strict Static Typing with Mypy or Pyright: Catch type errors and missing attributes in CI before production.
- Use Context Managers for Resources: Always manage files, sockets, and locks using `with` and `async with` statements.
**Don't**:
- Use mutable default arguments in functions: Avoid `def append_to(item, target=[])`; use `target: list | None = None`.
- Catch generic `except Exception:` blindly: Catch specific exception classes to avoid masking unexpected programming errors.
- Install global packages directly: Always isolate project dependencies in dedicated virtual environments (`.venv`).
## Troubleshooting
| Error | Cause | Solution |
| ---------------------------- | ---------------------- | ---------------------------------- |
| `ModuleNotFoundError` | Package not installed | Run `pip install package` |
| `IndentationError` | Mixed tabs/spaces | Use consistent 4-space indentation |
| `TypeError: unhashable type` | Using list as dict key | Use tuple instead |
## References
- [Python Official Docs](https://docs.python.org/3/)
- [Real Python](https://realpython.com/)
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · G1Joshi/Agent-Skills | 100 | MIT |
| ericrisco/rsc-harness | 100 | MIT |
| xobotyi/cc-foundry | 100 | MIT |
| nimadorostkar/Claude-Skills-collection | 100 | MIT |
| Aadarsh-x54/deep-agents-with-langchain | 100 | MIT |
| ahgraber/skills | 100 | CC0-1.0 |
| appwrite/claude-plugin | 100 | BSD-3-Clause |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
Database snapshot: 13.11.2026 · package version ac5f8798c1e9 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100python-patterns
Python-specific design patterns and best practices including protocols, dataclasses, context managers, decorators, async/await, type hints, and package organization. Use when working with Python code to apply Pythonic patterns. - 90python-expert
Use when building Python 3.11+ applications requiring type safety, async programming, or production-grade patterns. Invoke for type hints, pytest, async/await, dataclasses, mypy configuration. - 100python-expert
Expert-level Python development with Python 3.12+ features, async/await, type hints, and modern best practices. Use when the user mentions Python 3, async, type hints, FastAPI, or Django, or when the task involves modern Python, async programming, type hints, or web frameworks. - 100rc-python
Idiomatic typed Python 3.12+ — asyncio, dataclasses, pytest, ruff, uv. Use when writing or reviewing Python. Do not use for JS/TS or Go. - 90modern-python
Idiomatic, secure and efficient Python for 3.13+ - choosing collections, comprehensions and generators, decorators, typing with PEP 695 generics, dataclasses, pattern matching, exceptions and asyncio, with the legacy idioms each one replaces; security for untrusted input, pytest… - 100python-patterns
Idiomatic, typed, maintainable Python. Covers readability rules, type hints, exceptions, context managers, generators, dataclasses, choosing a concurrency model, project layout and tooling. Use when writing, refactoring or reviewing Python code. For tests load python-testing;…