r/FastAPI • u/zupiterss • Feb 13 '26
Other Finally got Cursor AI to stop writing deprecated Pydantic v1 code (My strict .cursorrules config)
Hi All,
I spent the weekend tweaking a strict
.cursorrules file for FastAPI + Pydantic v2 projects because I got tired of fixing:
class Config:instead ofmodel_config = ConfigDict(...)- Sync DB calls inside async routes
- Missing type hints
It forces the AI to use:
- Python 3.11+ syntax (
|types) - Async SQLAlchemy 2.0 patterns
- Google-style docstrings
If anyone wants the config file, let me know in the comments and I'll DM it / post the link (it's free)."
==========================================
Here it is. Please leave feedback. Replace "[dot]" with "."
tinyurl [dot] com/cursorrules-free
30
Upvotes
View all comments
Show parent comment
2
u/zupiterss Feb 13 '26
For me, it comes down to three things that VS Code Copilot/Windsurf haven't fully matched yet:
Cmd+Iand say "Rename theUser.idfield toUser.uuidand update all API routes," and it will actually open, edit, and save 5 different files at once. It feels like pair programming rather than just autocomplete.Give it a try.