# python-patterns

Architectural principles for Python in Claude Code: framework trade-offs, async versus sync decisions, project layouts, and Pydantic validation.

- skill · `type=skill` · Claude Code · 1135 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/python-patterns
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/python-patterns

## What it does

This skill guides Claude Code to reason through Python system design rather than pasting canned snippets. It directs the assistant to pick frameworks intentionally: Django for apps needing a built-in admin, FastAPI for microservices, or Flask for lightweight scripts.

Execution models stay strictly segregated. The guidance pairs I/O-bound workflows with async drivers such as `httpx` and `asyncpg`. CPU-bound jobs remain synchronous because mixing blocking calls into asynchronous loops stalls execution.

The rules cover directory layouts grouped by feature or layer, Pydantic schemas, and background processing options spanning Celery, ARQ, and FastAPI background tasks. The assistant prompts for team preferences whenever the requirements leave room for ambiguity.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --skill development/python-patterns
```

2. **Skills CLI (Vercel)**
```bash
npx skills add davila7/claude-code-templates --skill python-patterns -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/python-patterns/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/python-patterns/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/python-patterns/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/python-patterns/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davila7/claude-code-templates python-patterns
```

2. **Manually: put the files in place**
- File: `.github/skills/python-patterns/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/development/python-patterns
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/python-patterns/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/python-patterns

## When to use it
- choose between FastAPI, Django, and Flask based on workload
- separate async I/O from CPU-bound synchronous logic
- organize backend repositories by feature or technical layer
- select background job runners from in-process tasks to distributed queues

## Example prompts
- Organize our new FastAPI service by domain feature instead of technical layers.
- Help me decide between Celery and ARQ for handling delayed tasks.
- Refactor this synchronous database script to use asyncpg without blocking the loop.

## Similar
- [mcp-builder](https://affpapa.org/en/nevibecode/skills/mcp-builder.md) — skill · 130949 installs
- [claude-api](https://affpapa.org/en/nevibecode/skills/claude-api.md) — skill · 74198 installs
- [lark-im](https://affpapa.org/en/nevibecode/skills/lark-im.md) — skill · 472900 installs
- [lark-event](https://affpapa.org/en/nevibecode/skills/lark-event.md) — skill · 466800 installs
- [caveman-discover](https://affpapa.org/en/nevibecode/skills/caveman-discover.md) — skill · 104400 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs

## Other versions with the same name
- [python-patterns · affaan-m](https://affpapa.org/en/nevibecode/skills/affaan-m-python-patterns.md) — 5500 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 495 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
