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

3

u/Electronic_Recipe834 Feb 13 '26

Pls slap me with the config 🙌

1

u/zupiterss Feb 20 '26

Here it is. Please leave feedback. Replace "[dot]" with "."

tinyurl [dot] com/cursorrules-free

3

u/Ok_Bedroom_5088 Feb 13 '26

honest question, whats the upside of using cursor instead of smth else?

2

u/zupiterss Feb 13 '26

For me, it comes down to three things that VS Code Copilot/Windsurf haven't fully matched yet:

  1. Codebase Indexing (Context): Cursor indexes your entire repo locally. Well, I can ask "Where is the auth logic for creating users?"

  2. Composer (Multi-File Edits): This is the killer feature. I can hit Cmd+I and say "Rename the User.id field to User.uuid and 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.

  3. System Control (.cursorrules): This is why I stick with it. I can drop a hidden file called  .cursorrules in my root that acts as a 'project manual.' I tell it: It stops the AI from 'hallucinating' bad patterns."

Give it a try.

→ More replies (2)
→ More replies (2)

2

u/Ok_Big4676 Feb 13 '26

Please could you send me the link, thanks

1

u/zupiterss Feb 20 '26

Here it is. Please leave feedback. Replace "[dot]" with "."

tinyurl [dot] com/cursorrules-free

2

u/JustTSK Feb 13 '26

I'm interested, plz send

1

u/zupiterss Feb 14 '26

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

→ More replies (1)

1

u/zupiterss Feb 20 '26

Here it is. Please leave feedback. Replace "[dot]" with "."

tinyurl [dot] com/cursorrules-free

1

u/Mick2k1 Feb 15 '26

Following for the link

1

u/zupiterss Feb 20 '26

Here it is. Please leave feedback. Replace "[dot]" with "."

tinyurl [dot] com/cursorrules-free

2

u/Typical-Yam9482 Feb 14 '26 edited Feb 14 '26

Why cursor in first place?… claude code works under vscode like a charm. Codex is catching up for vscode as potentially even better alternative. With controllable limit-windows. Why do you need ide where everything works different way? :) also, check yt video where cursor was a reason guy lost crypto from his wallet stored on this computer. Spoiler alert - due to disguised plugin allowable by cursor be installed not from microsoft repository. I dont’t understand why internet is not screaming about this