python-best-practices

Pythonic code with modern type hints, dataclasses, async patterns, packaging, and testing

Content Preview
---
name: python-best-practices
description: Pythonic code with modern type hints, dataclasses, async patterns, packaging, and testing
---

# Python Best Practices

## Type Hints (3.12+ Syntax)

```python
# Use built-in generics (3.9+), no need for typing.List, typing.Dict
def process_items(items: list[str]) -> dict[str, int]:
    return {item: len(item) for item in items}

# Union with | syntax (3.10+)
def find_user(user_id: int) -> User | None:
    ...

# Type parameter syntax (3.12+)
type Vec
How to Use

Recommended: Install to project (local)

mkdir -p .claude/skills
curl -o .claude/skills/python-best-practices.md \
  https://raw.githubusercontent.com/rohitg00/awesome-claude-code-toolkit/main/skills/python-best-practices/SKILL.md

Skill is scoped to this project only. Add .claude/skills/ to your .gitignoreif you don't want to commit it.

Alternative: Clone full repo

git clone https://github.com/rohitg00/awesome-claude-code-toolkit

Then reference at skills/python-best-practices/SKILL.md

Related Skills