---
description: Backend-specific rules for Flask services, migrations, and tests
globs:
alwaysApply: false
---

<!-- Generated by scripts/generate_ai_collab_docs.py. Edit metadata in that script. -->

# Cursor Rule: Backend API

- Inspect existing service helpers, repositories, DTOs, and pytest coverage
  before changing backend behavior.

- Use `docs/engineering-baseline.md` for backend-wide engineering conventions
  such as model layout, response envelopes, migrations, configuration, and
  i18n workflow.

- Reuse the shared API response envelope with `code`, `message`, and `data`,
  provider wrappers, configuration helpers, and existing backend service
  modules before adding new abstractions.

- Keep shared translations in `src/i18n/` and use backend helpers instead of
  inventing per-service translation or error patterns.

- Generate and review new Alembic migrations instead of editing applied
  revisions, do not add hard business-key foreign-key constraints, and keep
  OpenAI-compatible providers behind the LiteLLM and shared helper layers.
