Skip to content

avibebuilder/claude-prime / .claude/starter-skills/backend-fastapi-python

backend-fastapi-python

Unverified

Use this skill for any Python backend work in this project: building FastAPI endpoints, writing service functions, defining Pydantic/SQLModel schemas, running Alembic migrations, or debugging 422 errors. Essential for authentication and authorization patterns — setting up get_current_user, is_superuser checks, admin-only guards, role-based access, and dependency injection chains like Depends(). Also covers middleware, background tasks, async SQLAlchemy sessions, ORM relationship loading, and request/response design. Activate whenever the question involves Python API code, FastAPI patterns, or backend architecture in this codebase. Not for frontend, Docker, CI/CD, or infrastructure.

FileKindSize
SKILL.mdskill md3.9 KB
references/auth.mdmarkdown5.5 KB
references/configuration.mdmarkdown3.5 KB
references/database.mdmarkdown3.9 KB
references/dependencies.mdmarkdown4.4 KB
references/error-handling.mdmarkdown4.7 KB
references/file-structure.mdmarkdown3.8 KB
references/middleware.mdmarkdown4.9 KB
references/models.mdmarkdown3.9 KB
references/routing.mdmarkdown4.5 KB
references/schemas.mdmarkdown4.3 KB
references/services.mdmarkdown5.1 KB

references/file-structure.md

View on GitHub
# File Structure

## Project Layout

```
project/
├── alembic/                 # Database migrations
│   ├── versions/
│   └── env.py
├── alembic.ini
├── src/
│   ├── __init__.py
│   ├── main.py              # FastAPI app entry point
│   ├── core/                # Shared infrastructure
│   │   ├── __init__.py
│   │   ├── config.py        # Settings (pydantic-settings)
│   │   ├── constants.py     # Global constants
│   │   ├── database.py      # Async engine + session factory
│   │   ├── dependencies.py  # Global dependencies
│   │   ├── exceptions.py    # AppException + handlers
│   │   ├── logging.py       # Loguru setup
│   │   ├── schemas.py       # ApiResponse, PaginatedResponse
│   │   ├── utils.py         # Shared utilities (ID generation)
│   │   └── middlewares/
│   │       ├── __init__.py
│   │       ├── request_id_middleware.py
│   │       └── logging_middleware.py
│   ├── models/              # SQLModel definitions
│   │   ├── __init__.py
│   │   ├── base_model.py    # BaseSQLModel
│   │   └── user_model.py
│   └── modules/             # Feature modules
│       ├── auth/
│       │   ├── __init__.py
│       │   ├── auth_config.py
│       │   ├── auth_constants.py
│       │   ├── auth_dependencies.py
│       │   ├── auth_router.py
│       │   ├── auth_schemas.py
│       │   ├── auth_service.py
│       │   └── auth_utils.py
│       └── users/
│           ├── __init__.py
│           ├── user_constants.py
│           ├── user_dependencies.py
│           ├── user_router.py
│           ├── user_schemas.py
│           ├── user_service.py
│           └── user_utils.py
├── pyproject.toml
├── .env
└── .env.example
```

## Module Structure

Each feature module follows consistent naming:

```
modules/{module}/
├── __init__.py
├── {module}_config.py       # Module-specific settings (optional)
├── {module}_constants.py    # Error codes, enums
├── {module}_dependencies.py # FastAPI dependencies
├── {module}_router.py       # API routes
├── {module}_schemas.py      # Pydantic models
├── {module}_service.py      # Business logic
└── {module}_utils.py        # Helper functions (optional)
```

## File Naming Rules

| Type | Pattern | Example |
|------|---------|---------|
| Module router | `{module}_router.py` | `auth_router.py` |
| Module service | `{module}_service.py` | `auth_service.py` |
| Module schemas | `{module}_schemas.py` | `auth_schemas.py` |
| Module dependencies | `{module}_dependencies.py` | `auth_dependencies.py` |
| Module constants | `{module}_constants.py` | `auth_constants.py` |
| Module config | `{module}_config.py` | `auth_config.py` |
| Module utils | `{module}_utils.py` | `auth_utils.py` |

## Import Conventions

Use absolute imports from `src`:

```python
# Good
from src.core.config import settings
from src.core.database import get_db
from src.modules.auth.auth_service import authenticate_user

# Bad - relative imports
from ..core.config import settings
from .auth_service import authenticate_user
```

## Core vs Modules

**`core/`** - Shared infrastructure used across all modules:
- Configuration management
- Database connection
- Exception handling
- Common schemas (ApiResponse, PaginatedResponse)
- Middleware
- Utilities

**`modules/`** - Feature-specific code:
- Each module is self-contained
- Module can depend on `core/` and `models/`
- Modules should minimize cross-dependencies
- If modules share logic, extract to `core/`
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 318kUpdated Claude CodeCodexUnverifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 117kUpdated Claude CodeCodexUnverifiedInstall