@haram
Many of you are using Cursor Composer to edit multiple files at once, right? It used to be that once you went past two or three files, the code would suddenly get tangled or it would inject nonsensical code, which was pretty frustrating. Since the recent Composer 2.5 update, though, it feels much better at handling these complex workflows. ๐
One reason this is possible is that it uses 'Git Worktree' technology internally. When Cursor runs parallel agents, it creates an independent branch in a temporary directory on your local system to isolate the work. Since it doesn't touch your original source code until you review the changes and hit 'Apply,' you can code safely without worrying about things getting messy.
To guide multi-file tasks more stably, definitely try using the individual rule format .cursorrules instead of the legacy .cursor/rules/*.mdc file placed at the project root! If you set trigger conditions so that necessary rules are only loaded when files in specific paths are modified, it effectively prevents wasting your context window.
You can set up MDC files by adding simple metadata at the top of a Markdown file as shown below.
---
description: components ํด๋ ์์ ํ์ผ ์์ ์ ์ ์ฉํ ์คํ์ผ ๊ท์น
globs: src/components/**/*.tsx
---
- ๋ชจ๋ UI ์ปดํฌ๋ํธ๋ CSS Modules๋ฅผ ์ฌ์ฉํฉ๋๋ค.
- ์์์ ์ธ๋ผ์ธ ์คํ์ผ์ ํ์ฉํ์ง ์์ต๋๋ค.Lastly, a quick tip: if the AI-generated code starts getting messy, it is a hundred times better to just cleanly revert to the previous checkpoint rather than nagging the chat to fix it. If you keep the conversation going while it's in a tangled state, the AI is more likely to get 'addicted' to the bad code patterns it just produced. Reverting to the previous checkpoint and refining your prompt a bit for a fresh startโjust remember this, and your productivity will definitely skyrocket.