推荐使用配置

(1)不推荐import vscode extensions有些插件会有问题,如remote ssh工具连不上远程。
notion image
图1 vscode extension配置导入
(2)推荐插件
  • Chinese:汉化
  • Dev containers
  • ESLint:括号修饰
  • Prettier:代码高亮
  • Python:Python相关插件,对python识别,支持Python Interpreter
  • Remote-ssh:远程链接集群代码工具。
notion image
(3)其他使用和Vscode配置一模一样,字体大小如Font,窗口字体大小如Zoom配置等。
notion image
图2 cursor页面

使用技巧

提示词

(1)规范化提示词清晰传达我们的需求。
(2)使用ASK模式,让Cursor优化提示词。

使用经验

2.1 经验分享

引用Cursor设计总监的经验话语
  1. Set 5-10 clear project rules upfront so Cursor knows your structure and constraints. Try /generate rules for existing codebases. # 设置5-10规则,减少大模型的幻觉,让AI过度聪明
  1. Be specific in prompts. Spell out tech stack, behavior, and constraints like a mini spec. # 清晰的提示词,说明你的技术栈,行为,包括最终需要达到的一个目的,限制条件,可以合理使用ASK模式
  1. Work file by file; generate, test, and review in small, focused chunks. # 小颗粒度修改如文件夹或者文件级别去修改,用测试驱动开发的形式,让Cursor针对自行改动的内容进行测试
  1. Write tests first, lock them, and generate code until all tests pass. # 先写测试用例,测试驱动开发,非常推荐的功能
  1. Always review AI output and hard‑fix anything that breaks, then tell Cursor to use them as examples. # 审查AI的输出,这一段对于我们来说是强项
  1. Use @ file, @ folders, @ git to scope Cursor’s attention to the right parts of your codebase. # 使用@来限用上下文,高频使用功能
  1. Keep design docs and checklists in .cursor/ so the agent has full context on what to do next. # 在.cursor/下给出清晰的清单,不要一次性做完,而是一个一个的做,一个一个做阶段性测试。
  1. If code is wrong, just write it yourself. Cursor learns faster from edits than explanations.# 代码如果百分之百写错了,就自己写,Cursor会汲取经验
  1. Use chat history to iterate on old prompts without starting over. # 利用聊天记录复用旧的提示词,项目级别保留历史对话
  1. Choose models intentionally. Gemini for precision, Claude for breadth. # 根据需要选择模型
  1. In new or unfamiliar stacks, paste in link to documentation. Make Cursor explain all errors and fixes line by line.# 文档首页粘贴
  1. Let big projects index overnight and limit context scope to keep performance snappy. # 大工程索引完后再动工

1.2 Cursor Rules

  1. ASK模式->Agent模式:适用于所有的IDE模式。
    1. Step1: 利用ASK模式将自然语言转换成结构化的提示词
      我现在需要做一个个人作品集的展示网站,它是一个单页网站,然后作品都是以图片的展示形式,请你帮我生成提示词
      Step2: 然后再切换为Agent模式
  1. 测试驱动开发:需要实现一个特定的功能,先让AI想一些需要测试的功能,直到所有的测试用例全部跑通后
    1. Step1:
  1. Project Rules->User Rule
  1. @限用上下文
    1. notion image
  1. 学会复用历史会话
notion image

Cursor实战

3.1 CvToolkit

3.1.1 第一步:Rules定义

notion image
第一步:利用Cursor定义Rules的规则
.cursor\rules\general.mdc 原版
.cursor\rules\general.mdc 优化版本
.cursor\rules\python.mdc 原版
.cursor\rules\python.mdc 优化后版本
.cursor\rules\git.mdc原版
.cursor\rules\git.mdc优化版本

3.1.2 第二步:功能补全

@common_rm.py 优化analyze_3df_content函数,添加针对AITXT文件中grp9:e:0/0/0/20/2_0_0grp9:ef:0/0/0/20/20/0解析功能, 要求统计e第一个数值表示闭眼时长,以100ms为单元,ef第一个数值表示闭眼帧数。要求打印最长e或者ef对应的最长闭眼时间和最长闭眼帧,以及对应的FCNT以及时间戳
notion image

3.1.3 第三步:其他使用

DOING