Implements FastAPI endpoints, creates SQLAlchemy 2.0 async models, generates idempotent Alembic migrations, structures bounded contexts following DDD (domain→infrastructure→application→api), and produces typed Pydantic v2 DTOs. Runs inside Docker (visionarias_brain_dev). Use when: 'create an endpoint', 'modify the backend', 'create a new entity', 'update a service', 'database logic', 'fix a backend bug', 'add a migration', 'create a repository', 'agrega un campo', 'nueva ruta API', 'corrige el servicio', or any Python/FastAPI/SQLAlchemy/Alembic task.
72
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
The canonical home for this skill is backend-expert in alpacapurpura/luana-method
Antes de escribir codigo, ubicar el modulo destino:
docs/domains/INDEX.md → identificar bounded context. Leer el doc del modulo (reglas de negocio, restricciones, edge cases — no inventario de archivos).ls backend/src/modules/{nombre}/ y leer archivos clave (router, service, models).⚠️ Si vas a tocar
backend/src/modules/analytics/(cualquier provider, ETL pipeline, scheduler, workers, ometric_catalog.py):
- Leer
.claude/rules/etl-extraction-contract.mdANTES de empezar.- Consultar
docs/etl/extraction-contract.mdpara entender qué dice el contrato del provider/canal que vas a tocar.- Después de implementar, los 3 pasos finales son OBLIGATORIOS:
- Actualizar
backend/src/modules/analytics/domain/extraction_contract.pypara reflejar el cambio.make extraction-contractpara regenerardocs/etl/extraction-contract.md.cd backend && .venv/bin/pytest tests/architecture/test_extraction_contract.py -x -q.- El commit final incluye SIEMPRE: el código del provider/pipeline + la entrada del contrato + el Markdown regenerado, en un solo commit.
El test arquitectural falla si saltas estos pasos. No es opcional.
references/testing.md.domain/: Entidades (entity.py), enums, eventos. Puros Python — cero dependencias de BD.infrastructure/: Modelo SQLAlchemy (models/), Repositorio (repositories/), migracion Alembic.application/: DTOs Pydantic entrada/salida, Servicio que orqueste logica via repositorio.api/: Rutas FastAPI (router.py), inyeccion con Depends.api/ descendiendo capa por capa hasta la discrepancia.Antes de commit Y antes de spawn auditor, leer runtime-quality-checklist.md. Cubre anti-patterns que mypy + ruff + pytest NO catch: FastAPI Annotated dep type alias, override fixture sin Depends, 501 stubs Response param, datetime query parsing, SQLA legacy Column handling, multi-tenant test fixture pattern.
docs/domains/.docs/domains/tech_module_core.md o tech_module_shared.md.references/architecture-rules.mdreferences/database.mdreferences/testing.mdreferences/standards.mdSQLAlchemy 2.0 (correcto vs prohibido):
# CORRECTO
result = await session.execute(select(Lead).where(Lead.tenant_id == tenant_id))
leads = result.scalars().all()
# PROHIBIDO — sintaxis legacy
leads = session.query(Lead).filter_by(tenant_id=tenant_id).all()Pydantic v2 DTO tipado:
class LeadCreate(BaseModel):
model_config = ConfigDict(from_attributes=True)
name: str
email: EmailStr
tenant_id: UUIDAlembic migracion idempotente (raw SQL obligatorio):
def upgrade():
op.execute("CREATE TABLE IF NOT EXISTS leads (id UUID PRIMARY KEY, name VARCHAR NOT NULL)")
op.execute("ALTER TABLE leads ADD COLUMN IF NOT EXISTS email VARCHAR")
op.execute("CREATE INDEX IF NOT EXISTS ix_leads_tenant ON leads (tenant_id)")Any ni dicts magicos — siempre DTOs Pydantic tipados.api/ — todo va al application/service.deleted_at o is_active.session.execute(select(Model)), nunca Session.query(Model).cd backend && .venv/bin/pytest tests/architecture/ -v. These enforce DDD boundaries (no cross-module imports), API contracts (response_model= required), and conventions (no hard deletes, SA 2.0). Run make arch-test to verify. NEVER use docker exec for lint/tests.references/runtime-quality-checklist.md — OBLIGATORIO leer antes commit y antes spawn auditor. FastAPI Annotated deps, override fixture pattern, 501 stubs JSONResponse, datetime query, SQLA legacy Column handling, tenant isolation, JSONB shape (origen S4 PI-1 PR-10)references/backend-quality.md — Ruff 70+ rules, arch fitness gates, naming conventionsreferences/master-data.md — TenantLocale VO, currency+timezone, no hardcodedreferences/currency-handling.md — currency from data source, formatMoney patternsreferences/architectural-fitness.md — ratchet pattern, common fixesreferences/admin-panel.md — Streamlit registry-based, contract+smoke testsd31f7bc
Canonical home
since Aug 28, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.