with one click
python
Python development guidelines and best practices. Use when working with Python code.
Menu
Python development guidelines and best practices. Use when working with Python code.
| name | python |
| description | Python development guidelines and best practices. Use when working with Python code. |
Standards and best practices for Python development. Follow these guidelines when writing or modifying Python code.
Apply DRY, KISS, and SOLID consistently. Prefer functional methods where relevant; use classes for stateful behavior. Use composition with Protocol classes for interfaces rather than inheritance. Each module should have a single responsibility. Use dependency injection for class dependencies.
Any unless necessary__init__.py; prefer blank filesdict, list instead of typing.Dict, typing.Liststr | None instead of Optional[str]from __future__ import annotations at top of files with type hintsenvironment.py file with individual methods per variable (e.g., api_key() for API_KEY, database_url() for DATABASE_URL)src/ directory structuretest_def foo() create class TestFoopytest over unittestpytest-mock for mockingconftest.py for shared fixturestests/__test_<package_name>__ for shared testing codeWhen implementing Python code:
references/uv-scripts.md.references/uv-monorepo.md.Manage Git commits using conventional commit format with atomic staging. Always generate plain git commands before running them and offer to let the user run them manually.
Create AGENTS.md files for project-specific inline rules. Use when adding small, project-specific instructions that should be committed in repos.
Media processing utilities for images, audio, and video using FFmpeg and ImageMagick. Use when working with media conversion, optimization, or batch processing tasks.
Core software engineering principles for code style, documentation, and development workflow. Applies when editing code, working in software repositories, or performing software development tasks.
Build robust backend systems with modern technologies (Node.js, Python, Go, Rust), frameworks (NestJS, FastAPI, Django), databases (PostgreSQL, MongoDB, Redis), APIs (REST, GraphQL, gRPC), authentication (OAuth 2.1, JWT), testing strategies, security best practices (OWASP Top 10), performance optimization, scalability patterns (microservices, caching, sharding), DevOps practices (Docker, Kubernetes, CI/CD), and monitoring. Use when designing APIs, implementing authentication, optimizing database queries, setting up CI/CD pipelines, handling security vulnerabilities, building microservices, or developing production-ready backend systems.
Build command-line interfaces with async-first design, composable commands, and proper output formatting. Use when creating CLI tools, commands, or interactive terminal applications.