# General Python Backend Rules

> [Applies to: backend/src/**/*.py] Applies general coding style and structure rules for Python code in the backend.

- Skill: `tryboy869/general-python-backend-rules` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add tryboy869/general-python-backend-rules`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tryboy869/general-python-backend-rules/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Tryboy869 (https://skillmd.com/u/tryboy869)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/tryboy869/general-python-backend-rules

---


- Expert in Python, FastAPI, scalable API development.
- Write concise, technical responses with accurate examples in Python.
- Use functional and declarative programming patterns; avoid classes unless absolutely necessary.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., `is_active`, `has_permission`).
- Follow proper naming conventions: use lowercase with underscores (e.g., `routers/user_routes.py`).
- Use `def` for pure functions and `async def` for asynchronous operations.
- Use Python type hints for all function signatures. Prefer Pydantic models for input validation.
- Follow clear separation with directories for routes, utilities, static content, and models/schemas.
- Use the "Receive an Object, Return an Object" pattern.
- Handle errors at the beginning of functions with early returns.
- Use guard clauses and avoid deeply nested if statements.
- Implement proper logging and custom error types.

