python

Python programming with type hints, async/await, decorators, and package management. Use for .py files and data science.

16 stars

Best use case

python is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Python programming with type hints, async/await, decorators, and package management. Use for .py files and data science.

Teams using python should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/python/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/data-ai/python/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/python/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How python Compares

Feature / AgentpythonStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Python programming with type hints, async/await, decorators, and package management. Use for .py files and data science.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Python

Modern Python development with type hints, async/await, and best practices.

## When to Use

- Working with `.py` files
- Building APIs with FastAPI/Django
- Data analysis with pandas/numpy
- Scripting and automation

## 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

### Type Hints

```python
from typing import TypeVar, Generic
from collections.abc import Callable, Iterator

def process_items(
    items: list[str],
    transform: Callable[[str], str] | None = None,
) -> list[str]:
    if transform:
        return [transform(item) for item in items]
    return items

# Use TypeVar for generics
T = TypeVar('T')

def first(items: list[T]) -> T | None:
    return items[0] if items else None
```

### Dataclasses & Pydantic

```python
from dataclasses import dataclass, field
from pydantic import BaseModel, Field

# Dataclass for simple data containers
@dataclass
class User:
    name: str
    email: str
    tags: list[str] = field(default_factory=list)

# Pydantic for validation
class UserCreate(BaseModel):
    name: str = Field(..., min_length=1, max_length=100)
    email: str = Field(..., pattern=r'^[\w\.-]+@[\w\.-]+\.\w+$')
```

## Common Patterns

### Async Patterns

```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

```python
from contextlib import contextmanager, asynccontextmanager

@contextmanager
def managed_resource() -> Iterator[Resource]:
    resource = Resource()
    try:
        yield resource
    finally:
        resource.cleanup()
```

## Best Practices

**Do**:

- Use type hints for function signatures
- Use `pyproject.toml` for project configuration
- Use virtual environments (`venv`, `poetry`)
- Use generators for large datasets

**Don't**:

- Use mutable default arguments (`def f(x=[]`)
- Use `import *` (pollutes namespace)
- Catch bare `except:` (catch specific exceptions)
- Use `assert` for input validation

## 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/)

Related Skills

agent-python-pro

16
from diegosouzapw/awesome-omni-skill

Expert Python developer specializing in modern Python 3.11+ development with deep expertise in type safety, async programming, data science, and web frameworks. Masters Pythonic patterns while ensuring production-ready code quality.

agent-ops-create-python-project

16
from diegosouzapw/awesome-omni-skill

Create a plan and issues for implementation of a production-ready Python project with proper structure, tooling, and best practices.

affinity-python-sdk

16
from diegosouzapw/awesome-omni-skill

Use when writing Python code with the Affinity SDK, or when user asks about "affinity-sdk", "affinity package", typed IDs, async Affinity client, pagination, or Python scripts for Affinity CRM.

moai-lang-python

16
from diegosouzapw/awesome-omni-skill

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.

lang-python

16
from diegosouzapw/awesome-omni-skill

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.

Add prerequisite install script for Python deps (self-contained skill)

16
from diegosouzapw/awesome-omni-skill

No description provided.

python-github-actions

16
from diegosouzapw/awesome-omni-skill

Complete Python GitHub Actions system. PROACTIVELY activate for: (1) uv-based CI workflows (10-100x faster), (2) Matrix testing across Python versions, (3) Dependency caching with setup-uv, (4) Parallel test execution, (5) Reusable workflows, (6) Publishing to PyPI with trusted publishing, (7) Code coverage with codecov, (8) Security scanning. Provides: Workflow templates, caching config, matrix strategies, composite actions. Ensures fast, reliable CI/CD pipelines.

biopython

16
from diegosouzapw/awesome-omni-skill

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

python-v3.14

16
from diegosouzapw/awesome-omni-skill

Python 3.14 / FastAPI. Proyecto usa este skill; contenido canónico en .ai-system.

python-uv

16
from diegosouzapw/awesome-omni-skill

Modern Python development with uv package manager. Use when working on Python projects using uv, pytest, FastAPI, or Django. Covers development workflow, testing, and EC2 deployment.

python-pro

16
from diegosouzapw/awesome-omni-skill

Master Python 3.12+ with modern features, async programming, performance optimization, and production-ready practices. Expert in the latest Python ecosystem including uv, ruff, pydantic, and FastAPI.

python-fastapi

16
from diegosouzapw/awesome-omni-skill

Python FastAPI development with uv package manager, modular project structure, SQLAlchemy ORM, and production-ready patterns.