When working in larger monorepos or multi-service projects, Composer often pulls context from the wrong package or mixes up frontend and backend conventions.
Here is a 3-step configuration that solves cross-package bleeding:
-
Root vs. Package Scoping:
Place lightweight.cursorrulesin individual subpackages rather than one massive root file. Cursor Composer prioritizes the rule file closest to the active open file. -
Strict File Invariants:
In your backend service.cursorrules:
- Backend: FastAPI / Python 3.11
- Scope: Inbound requests must extract authentication from Authorization header. Never accept tenant_id from body.
In your frontend .cursorrules:
- Frontend: Next.js 14 App Router
- Rule: Server components by default. Add 'use client' only when state hooks (useState, useEffect) are strictly required.
- Terminal Context Isolation:
When prompting Composer, reference relative file paths explicitly (@packages/api/src/...) rather than relying on fuzzy semantic search across the entire workspace. This keeps the prompt budget focused on the active package’s AST.