记录一些cursor的project rules
1、editing.mdc(防止乱改代码)
---
alwaysApply: true
---
# Safe Code Editing Rules
When modifying code:
1. Only modify the file explicitly mentioned by the user.
2. Never modify unrelated files.
3. Do not refactor code unless explicitly requested.
4. Preserve existing code style and structure.
5. Do not rename variables or functions unless necessary.
6. Do not remove existing comments unless asked.
7. If multiple files must be changed to fix a bug:
- explain why
- list the files that will be modified.
- and you need to notify me, and I can only proceed after I agree.
Focus on minimal and precise changes.
2、精准修改规则:patch.mdc
---
alwaysApply: true
---
# Minimal Patch Editing
When editing code:
- Prefer minimal diffs.
- Modify only the necessary lines.
- Avoid rewriting entire files.
- Keep existing structure intact.
- Do not reorganize imports unless necessary.
Always prefer small targeted edits instead of large rewrites.
3、项目结构规则:architecture.mdc
---
alwaysApply: true
---
# Project Architecture
Follow this project structure:
src/
components/ -> React UI components
hooks/ -> custom React hooks
utils/ -> helper functions
services/ -> API calls
store/ -> Redux logic
Rules:
- Do not place business logic inside UI components.
- Reusable logic should be placed in hooks or utils.
- Components should remain small and focused.
4、防止 AI 创建垃圾文件:file-creation.mdc
---
alwaysApply: true
---
# File Creation Rules
Do not create new files unless:
1. The user explicitly requests it.
2. A new file is required for the solution.
3. The file name is clearly specified.
Avoid creating unnecessary helper files.
Prefer modifying existing files when possible.
5、userules全局规则
Always respond in Chinese.
When modifying code:
- Only change the minimal required lines
- Do not rewrite entire files unless asked
- Do not modify unrelated files
- Preserve project structure