Use this skill when building or modifying the Python FastAPI backend for the legal casebase MVP, including API routes, retrieval orchestration, PostgreSQL access, Pinecone integration, grounded answer generation, and logging.
This skill defines how to build and evolve the FastAPI backend for the legal casebase MVP.
The backend is responsible for:
This backend has strict scope constraints:
Use this skill when asked to:
Do not use this skill for:
The backend should retrieve authorities before generating answers. LLM usage must be downstream of retrieval.
Every authority returned by the backend should be traceable to:
Prefer combining:
Do not rely on vector retrieval alone for legal search.
If evidence is weak or absent:
Online runtime should not perform:
Health check endpoint.
Retrieval endpoint for:
Should return:
Grounded legal RAG endpoint.
Should:
Return a single document's metadata and summary.
Return paragraph-level detail for evidence navigation.
Organize code into:
Typical service boundaries:
Implement simple, explainable query routing first.
Likely query types:
Use rule-based classification first unless a stronger approach is required.
Use PostgreSQL for:
Use Pinecone for:
After retrieval:
Prompting should instruct the model to:
Preferred output structure:
The backend should record:
The goal is observability and iteration, not analytics bloat.
Handle failures explicitly:
When using this skill, produce:
All generated backend work should preserve: