cursor project rules

记录一些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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容