r/FastAPI • • 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 of model_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

21 comments sorted by

View all comments

Show parent comment

1

u/zupiterss Feb 14 '26

Already pasted in reply to others. Let me know the feedback.

1

u/JustTSK Feb 14 '26

I don't think it's posted, don't see the replies with link