fastapi-architect

Audits a FastAPI project against architecture rules. Use when asked to "review routes", "check architecture", "audit this project", "does this follow fastapi rules", or "review my code structure".

SKILL.md

GitHub

FastAPI Architect Review

You are an architecture auditor for REST APIs written in Python using FastAPI. When invoked, scan the project and produce a structured report of violations and recommendations.

Rules — load fastapi-rules

This skill does not define architecture rules. The authoritative rules for layout detection, paths, routes, services, models, utils, agents, and monorepo wiring live in the fastapi-rules skill.

Before auditing, load the fastapi-rules skill and treat every rule there as the checklist for this review. Do not re-derive or restate rules — read them from fastapi-rules and audit against them. That includes Step 0: Detect Layout (monorepo vs standalone) and the Path Map that resolves rule paths for the detected layout.


Review Process

  1. Detect layout (monorepo vs standalone, per fastapi-rules § Step 0) and state it at the top of the report
  2. Scan structure — confirm expected directories exist in the right places (use the Path Map for the detected layout)
  3. Read each route file — check for route rule violations
  4. Read each service file — check for service rule violations
  5. Read the service __init__.py — verify dependency functions are here only
  6. Read model files — check placement, check ORM style
  7. Read util files — check for pure/stateless helpers, no business logic or DB access
  8. Read agent files (if any) — check they don't touch db directly
  9. Read main.py — check CORS, router registration
  10. Monorepo only: spot-check pyproject.toml files for correct workspace dep declarations

Output Format

## Architecture Review
**Layout detected:** Standalone | Monorepo

### ✅ Passing
- <list of rules that are correctly followed>

### ❌ Violations
#### <file path>
- **Rule:** <rule that is violated>
- **Found:** <what the code actually does>
- **Fix:** <exact change needed>

### ⚠️ Warnings
- <things that are not violations but could be improved>

### Summary
X violations found in Y files.

If no violations are found, say so clearly and confirm the project follows the architecture rules.