Skip to main content
skill CX Codex

python-development · laurigates — Claude Code skill: what it does, how to install

python-development gives your agent Python 3.10+ idioms: type hints, pattern matching, asyncio. Handy for library code and refactors.

MIT 192 installs ★ 60 updated 2026-11-16

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add laurigates/claude-plugins --skill python-development -a claude-code
Open on GitHub

What python-development does

Before touching Python, the agent reads this skill. It covers modern annotations (list[str], str | None), match on dict payloads, context managers, generators. Debugging has its own section: pdb, pytest --pdb, profilers such as cProfile, py-spy, scalene. Async gets asyncio.gather and asyncio.wait_for.

The whole thing is a SKILL.md with code samples and a table that separates it from related skills: uv-run for one-off scripts, uv-project-management for a new project and its dependencies, python-testing for pytest work. Its allowed tools include Read, Edit and Bash, so the agent can open a module, change it, and run a check.

You cannot call it yourself. user-invocable: false means it loads when a request mentions Python, annotations or async, so it never shows up as a slash command. Scaffolding a project or running a script is outside its scope.

What it helps with

  • Rewrite Optional[str] and List[str] into 3.10+ annotations
  • Swap an if/elif ladder for match on a dict payload
  • Run independent requests concurrently with asyncio.gather and a timeout
  • Profile a slow function without adding a dependency to the project
  • Drop into pdb when a pytest test fails

Example prompts for the agent

  • Convert models.py to 3.10 annotations — list[str], str | None.
  • Replace this if/elif chain with a match on the command dict.
  • These coroutines run one after another; gather them with asyncio.gather.

How to install python-development

1Skills CLI (Vercel)

npx skills add laurigates/claude-plugins --skill python-development -a claude-code

2Manually: put the files in place

~/.claude/skills/python-development/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/python-development/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about python-development

How to install python-development in Claude Code?

Run npx skills add laurigates/claude-plugins --skill python-development -a claude-code. The skill lands at ~/.claude/skills/python-development/SKILL.md.

What does python-development do?

It hands the agent Python 3.10+ idioms: annotations, match, context managers, asyncio, plus debugging and profiling recipes. It loads on its own once Python, type hints or async come up.

How is it different from uv-run?

This skill stays on the language itself. uv-run covers running a single script, uv-project-management covers project setup and dependencies, python-testing covers pytest.

Source text

SKILL.md · MIT
---
created: 2025-12-16
modified: 2026-11-14
reviewed: 2026-04-25
name: python-development
description: Core Python development idioms and language features (3.10+). Use when mentioning Python, type hints, or async. For scripts see uv-run; for project setup see uv-project-management.
user-invocable: false
allowed-tools: Glob, Grep, Read, WebFetch, TodoWrite, WebSearch, Edit, Write, NotebookEdit, Bash(uv run pytest *), Bash(uv add *), Bash(uv lock *), Bash(uv build *)
---

# Python Development

Core Python language concepts, idioms, and best practices.

## When to Use This Skill

| Use this skill when... | Use a focused sibling instead when... |
|---|---|
| Writing idiomatic Python 3.10+ code (match statements, structural pattern matching, PEP 604 unions) | Running a single script or one-off command — use uv-run |
| Adding type hints, decorators, or context managers to library code | Initializing a project or adding dependencies — use uv-project-management |
| Designing async/await flows or refactoring to Pythonic patterns | Writing or running pytest tests — use python-testing |

## Core Expertise

- **Python Language**: Modern Python 3.10+ features and idioms
- **Best Practices**: Pythonic code, design patterns, SOLID principles
- **Debugging**: Interactive debugging and profiling techniques
- **Performance**: Optimization strategies and profiling
- **Async Programming**: async/await patterns and asyncio

## Modern Python Features (3.10+)

### Type Hints

```python
# Modern syntax (Python 3.10+)
def process_items(
    items: list[str],                    # Not List[str]
    mapping: dict[str, int],             # Not Dict[str, int]
    optional: str | None = None,         # Not Optional[str]
) -> tuple[bool, str]:                   # Not Tuple[bool, str]
    """Process items with modern type hints."""
    return True, "success"

# Type aliases
type UserId = int
type UserDict = dict[str, str | int]

def get_user(user_id: UserId) -> UserDict:
    return {"id": user_id, "name": "Alice"}
```

### Pattern Matching (3.10+)

```python
def handle_command(command: dict) -> str:
    match command:
        case {"action": "create", "item": item}:
            return f"Creating {item}"
        case {"action": "delete", "item": item}:
            return f"Deleting {item}"
        case {"action": "list"}:
            return "Listing items"
        case _:
            return "Unknown command"
```

### Structural Pattern Matching

```python
def process_response(response):
    match response:
        case {"status": 200, "data": data}:
            return process_success(data)
        case {"status": 404}:
            raise NotFoundError()
        case {"status": code} if code >= 500:
            raise ServerError(code)
```

## Python Idioms

### Context Managers

```python
# File handling
with open("file.txt") as f:
    content = f.read()

# Custom context manager
from contextlib import contextmanager

@contextmanager
def database_connection():
    conn = create_connection()
    try:
        yield conn
    finally:
        conn.close()

with database_connection() as conn:
    conn.execute("SELECT * FROM users")
```

### List Comprehensions

```python
# List comprehension
squares = [x**2 for x in range(10)]

# Dict comprehension
word_lengths = {word: len(word) for word in ["hello", "world"]}

# Set comprehension
unique_lengths = {len(word) for word in ["hello", "world", "hi"]}

# Generator expression
sum_of_squares = sum(x**2 for x in range(1000000))  # Memory efficient
```

### Iterators and Generators

```python
def fibonacci():
    a, b = 0, 1
    while True:
        yield a
        a, b = b, a + b

# Use generator
fib = fibonacci()
first_ten = [next(fib) for _ in range(10)]

# Generator expression
even_squares = (x**2 for x in range(10) if x % 2 == 0)
```

## Debugging

### Interactive Debugging

```python
import pdb

def problematic_function():
    value = calculate()
    pdb.set_trace()  # Debugger breakpoint
    return process(value)
```

```bash
# Debug on error
python -m pdb script.py

# pytest with debugger
uv run pytest --pdb                     # Drop into pdb on failure
uv run pytest --pdb --pdbcls=IPython.terminal.debugger:TerminalPdb
```

### Performance Profiling

```bash
# CPU profiling
uv run python -m cProfile -s cumtime script.py | head -20

# Line-by-line profiling (temporary dependency)
uv run --with line-profiler kernprof -l -v script.py

# Memory profiling (temporary dependency)
uv run --with memory-profiler python -m memory_profiler script.py

# Real-time profiling (ephemeral tool)
uvx py-spy top -- python script.py

# Quick profiling with scalene
uv run --with scalene python -m scalene script.py
```

### Built-in Debugging Tools

```python
# Trace execution
import sys

def trace_calls(frame, event, arg):
    if event == 'call':
        print(f"Calling {frame.f_code.co_name}")
    return trace_calls

sys.settrace(trace_calls)

# Memory tracking
import tracemalloc

tracemalloc.start()
# ... code to profile
snapshot = tracemalloc.take_snapshot()
top_stats = snapshot.statistics('lineno')
for stat in top_stats[:10]:
    print(stat)
```

## Async Programming

### Basic async/await

```python
import asyncio

async def fetch_data(url: str) -> dict:
    async with httpx.AsyncClient() as client:
        response = await client.get(url)
        return response.json()

async def main():
    result = await fetch_data("https://api.example.com")
    print(result)

asyncio.run(main())
```

### Concurrent Tasks

```python
async def process_multiple():
    # Run concurrently
    results = await asyncio.gather(
        fetch_data("url1"),
        fetch_data("url2"),
        fetch_data("url3"),
    )
    return results

# With timeout
async def with_timeout():
    try:
        result = await asyncio.wait_for(fetch_data("url"), timeout=5.0)
    except asyncio.TimeoutError:
        print("Request timed out")
```

## Design Patterns

### Dependency Injection

```python
from typing import Protocol

class Database(Protocol):
    def query(self, sql: str) -> list: ...

def get_users(db: Database) -> list:
    return db.query("SELECT * FROM users")
```

### Factory Pattern

```python
def create_handler(handler_type: str):
    match handler_type:
        case "json":
            return JSONHandler()
        case "xml":
            return XMLHandler()
        case _:
            raise ValueError(f"Unknown handler: {handler_type}")
```

### Decorator Pattern

```python
from functools import wraps
import time

def timer(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        start = time.time()
        result = func(*args, **kwargs)
        end = time.time()
        print(f"{func.__name__} took {end - start:.2f}s")
        return result
    return wrapper

@timer
def slow_function():
    time.sleep(1)
```

## Best Practices

### SOLID Principles

**Single Responsibility:**
```python
# Bad: Class does too much
class User:
    def save(self): pass
    def send_email(self): pass
    def generate_report(self): pass

# Good: Separate concerns
class User:
    def save(self): pass

class EmailService:
    def send_email(self, user): pass

class ReportGenerator:
    def generate(self, user): pass
```

### Fail Fast

```python
def process_data(data: dict) -> str:
    # Validate early
    if not data:
        raise ValueError("Data cannot be empty")
    if "required_field" not in data:
        raise KeyError("Missing required field")

    # Process with confidence
    return data["required_field"].upper()
```

### Functional Approach

```python
# Prefer immutable transformations
def process_items(items: list[int]) -> list[int]:
    return [item * 2 for item in items]  # New list

# Over mutations
def process_items_bad(items: list[int]) -> None:
    for i in range(len(items)):
        items[i] *= 2  # Mutates input
```

## Project Structure (src layout)

```
my-project/
├── pyproject.toml
├── README.md
├── src/
│   └── my_project/
│       ├── __init__.py
│       ├── core.py
│       ├── utils.py
│       └── models.py
└── tests/
    ├── conftest.py
    ├── test_core.py
    └── test_utils.py
```

## See Also

- **uv-run** - Running scripts, temporary dependencies, PEP 723
- **uv-project-management** - Project setup and dependency management
- **uv-tool-management** - Installing CLI tools globally
- **python-testing** - Testing with pytest
- **python-code-quality** - Linting and type checking with ruff/ty
- **python-packaging** - Building and publishing packages
- **uv-python-versions** - Managing Python interpreters

## References

- Python docs: https://docs.python.org/3/
- Type hints: https://docs.python.org/3/library/typing.html
- Async: https://docs.python.org/3/library/asyncio.html
- Detailed guide: See REFERENCE.md

© laurigates · MIT · laurigates/claude-plugins

Similar skills

All skills for Programming languages →

python-development by other authors comes first.

python-development sammcj The python-development skill sets Python coding rules for Claude Code, covering environments, typing, paths, and script dependencies. Use it on Python projects. CX Codex +1 ★ 173repo stars python-pro https://github.com/Jeffallan python-pro — a skill for writing type-safe Python 3.11+ with complete annotations, async code, and test suites. Generates code with type hints, configures mypy in strict mode, writes pytest tests with fixtures and mocking. CX Codex +1 9,300installs python Mindrally This skill tells your coding agent how to write Python: PEP 8, type hints, early returns, async for I/O. Useful when the agent edits or generates code in a Python repo. CX Codex +1 1,100installs python-expert PCL Team python-expert configures AI coding agents for modern Python development with type hints, PEP 8 standards, async patterns, and tools like uv, poetry, or ruff. CX Codex +1 277installs writing-python julianobarbosa writing-python — a skill that keeps an agent on Python 3.14 idioms: standard library first, type hints on every function, uv and ruff in place of pip and black. CX Codex +1 134installs async-python-patterns Seth Hobson The async-python-patterns skill guides async Python work with asyncio, async/await, and concurrent tasks. Use it for APIs and applications with many I/O-bound operations. CX Codex +1 18,055installs python-patterns davila7 python-patterns is a Claude Code skill that guides Python system design, including framework choices, async versus sync execution, project structure, and Pydantic validation. CX Codex +1 1,135installs

From the same set27

The whole set →
uv-advanced-dependencies uv-advanced-dependencies is a skill for managing non-standard dependency sources in uv, including GitHub repositories, editable local packages, and private indexes. It covers projects that need Git, local path, or custom index dependencies. CX Codex +1 332installs uv-tool-management uv-tool-management is a Claude Code skill for managing global Python CLI tools with uv and running them temporarily with uvx, including as an alternative to pipx. CX Codex +1 328installs imagemagick-conversion imagemagick-conversion — a skill for converting, resizing and optimizing images via ImageMagick command-line. Useful for bulk format conversion, thumbnail generation, and large-scale image processing workflows. CX Codex +1 260installs jq-json-processing jq-json-processing — a skill for parsing, filtering and transforming JSON with jq. Extracts fields, filters arrays, reshapes objects and validates syntax. CX Codex +1 245installs generate-image The generate-image skill generates images from text prompts using Google's Gemini 3 Pro Image model on Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. CX Codex +1 177installs justfile-expert justfile-expert is a Claude Code skill for designing Just recipes, parameters, dependencies, and modules. It supports adding project commands and task automation. CX Codex +1 162installs git-commit-workflow The git-commit-workflow Claude Code skill defines commit-message and staging rules. It helps split related edits into focused commits and review staged changes. CX Codex +1 161installs binary-analysis binary-analysis guides your coding agent in inspecting unknown binaries, running hex dumps, and extracting embedded artifacts. CX Codex +1 146installs

Project sponsors

Companies that keep this analytics open