python-backend
Python backend development expertise for FastAPI, security patterns, database operations, Upstash integrations, and code quality. Use when: (1) Building REST APIs with FastAPI, (2) Implementing JWT/OAuth2 authentication, (3) Setting up SQLAlchemy/async databases, (4) Integrating Redis/Upstash caching, (5) Refactoring AI-generated Python code (deslopification), (6) Designing API patterns, or (7) Optimizing backend performance.
Security Assessment
Detected risks:
About python-backend
Production-ready Python backend patterns focused on FastAPI, SQLAlchemy, and Upstash. Reach for it when building REST APIs with FastAPI, implementing JWT or OAuth2 authentication, setting up async SQLAlchemy databases, integrating Redis/Upstash caching and rate limiting, refactoring AI-generated Python code, or designing API structure and improving backend performance.
Its core principles are async-first I/O, typing everything with Pydantic models, dependency injection via the FastAPI Depends() helper, failing fast with early validation and HTTPException, and security by default. The guide bundles quick patterns: a modular project structure that groups each domain (auth, posts) into router, schemas, models, service, and dependencies files; the distinction between blocking and non-blocking route handlers (avoiding time.sleep in async handlers, preferring await asyncio.sleep); Pydantic validation with constrained fields such as EmailStr and Field with min/max length, pattern, and ge; dependency-injected current-user resolution; async SQLAlchemy engine and session setup with async_sessionmaker; Redis caching through upstash_redis; and sliding-window rate limiting through upstash_ratelimit that returns HTTP 429 when exceeded.
For deeper detail it points to reference documents shipped with the skill: fastapi_patterns.md covers project structure, async, Pydantic, dependencies, and testing; security_patterns.md covers JWT, OAuth2, password hashing, CORS, and API keys; database_patterns.md covers SQLAlchemy async, transactions, eager loading, and migrations; and upstash_patterns.md covers Redis, rate limiting, and QStash background jobs. It works best as a curated pattern library and checklist for writing idiomatic, secure, high-performance FastAPI services.
FAQ
What stack does this skill target?
FastAPI for APIs, async SQLAlchemy for databases, and Upstash (Redis, rate limiting, QStash) for caching and background jobs, with Pydantic for validation.
What are its core principles?
Async-first I/O, typing everything with Pydantic, dependency injection via Depends(), failing fast with HTTPException, and security by default.
How does it suggest structuring a project?
Group each domain into router, schemas, models, service, and dependencies files, alongside top-level config, database, and main modules.
Does it cover authentication?
Yes, JWT and OAuth2 authentication, password hashing, CORS, and API keys are covered in the security_patterns.md reference document.
How is rate limiting handled?
Through upstash_ratelimit with a SlidingWindow limiter keyed on the client, raising HTTP 429 when the request limit is exceeded.
Install python-backend
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
jiatastic/open-python-skills