/python-clean-architecture:scaffold-api <project-name>from python-clean-architecture
Scaffolds a new FastAPI project with clean architecture, generating CRUD endpoints, Pydantic models, SQLAlchemy ORM models, business logic, and tests for each entity.
Ships in python-clean-architecture. Installing the plugin adds it to Claude Code.
Generate a new FastAPI project named $ARGUMENTS with the three-layer clean architecture structure.
Ask for entities — Use AskUserQuestion: "What are the main entities for this API? (e.g., users, products, orders)" to determine what to scaffold.
Create project structure — Generate the full directory tree:
{project_name}/
├── main.py # FastAPI app, include_router, startup
├── routers/
│ ├── __init__.py
│ └── {entity}.py # APIRouter, endpoints, composition root
├── operations/
│ ├── __init__.py
│ ├── interface.py # DataInterface Protocol + DataInterfaceStub
│ └── {entity}.py # Business logic, accepts DataInterface
├── db/
│ ├── __init__.py
│ ├── database.py # Engine, SessionLocal, Base
│ ├── db_interface.py # Generic DBInterface implementing DataInterface
│ └── models.py # SQLAlchemy ORM models
├── models/
│ ├── __init__.py
│ └── {entity}.py # Pydantic Create/Read models
├── tests/
│ ├── __init__.py
│ └── test_{entity}.py # Tests using DataInterfaceStub
├── requirements.txt
└── .gitignore
Generate files — For each entity, create:
data_interface: DataInterfaceDataInterfaceStub with no database dependencyWire it together — main.py includes all routers and sets up the database.
Consult ${CLAUDE_PLUGIN_ROOT}/skills/clean-architecture/references/layered-architecture.md and ${CLAUDE_PLUGIN_ROOT}/skills/clean-architecture/references/testable-api.md for the full architecture patterns. Use ${CLAUDE_PLUGIN_ROOT}/skills/clean-architecture/examples/fastapi-hotel-api/ as a working reference.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
13 commands in this plugin
/add-endpointScaffold a new endpoint across all three architecture layers/check-qualityQuick code quality check against the 22 design rules/decoupleFind tight coupling and suggest dependency injection improvements/diagnose-smellsDetect code smells and anti-patterns with fix suggestions/extract-god-classFind and split god classes into focused collaborators/learn-architectureLearn an architecture or design topic — theory, the Pythonic way, and how it applies in your codenpx claudepluginhub mktoronto/python-clean-architecture --plugin python-clean-architectureOther plugins' commands for the same job