python-patterns

Guides Python framework selection, async decisions, and project structure using decision-making principles.

1|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/mst-software-vn/mst-checkscam --skill python-patterns-mst-software-vn
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-patterns
Source: https://github.com/mst-software-vn/mst-checkscam/tree/main/.agent/skills/python-patterns
Command: npx skills add https://github.com/mst-software-vn/mst-checkscam --skill python-patterns-mst-software-vn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Python developers often default to the same framework or pattern regardless of context, leading to over-engineered or mismatched architectures. This Skill provides decision-making frameworks for choosing between FastAPI, Django, and Flask, deciding async vs sync, and structuring projects correctly. ## Core Features & Use Cases - Framework Selection: Decision trees and comparison tables for choosing FastAPI, Django, or Flask based on project type (API-first, full-stack, scripts, AI/ML serving). - Async vs Sync Guidance: Rules for when to use async def, which async libraries to pick (httpx, asyncpg, aiofiles), and how to avoid mixing sync and async carelessly. - Architecture Principles: Type hint strategies, Pydantic validation, project structure templates, background task selection (Celery, ARQ, BackgroundTasks), error handling, and testing patterns. - Use Case: When starting a new microservice, use this Skill to evaluate whether FastAPI with async SQLAlchemy fits better than Django, then structure the codebase by feature or layer. ## Quick Start Ask the AI to help you choose the right Python framework and architecture for your new API project using the python-patterns skill.

Frequently Asked Questions about python-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between FastAPI, Django, and Flask?▼

Choose FastAPI for API-first microservices and AI/ML serving, Django for full-stack apps needing a built-in admin, and Flask for simple scripts or learning. Base the decision on whether you need async support, an admin interface, and your team's familiarity with async Python.

When should I use async def vs def in FastAPI?▼

Use async def for I/O-bound operations like database queries with asyncpg or HTTP calls with httpx. Use regular def for CPU-bound work or blocking libraries, since FastAPI runs sync endpoints in a threadpool automatically.

Does Django support async views and ORM?▼

Django 5.0+ supports async views, async middleware, and limited async ORM operations under ASGI deployment. Async in Django is best for external API calls, WebSockets via Channels, and high-concurrency views.

What background task library should I use with FastAPI?▼

Use FastAPI's built-in BackgroundTasks for simple fire-and-forget work in the same process. Choose Celery for distributed long-running tasks with retries, or ARQ for async Redis-based queues.

Why is mixing sync and async code a problem in Python?▼

Calling blocking sync libraries inside async code blocks the event loop, stalling all concurrent requests. Use async-native libraries like httpx, asyncpg, and aiofiles, or offload sync work to a threadpool.