☞☞☞AI 智能聊天, 问答助手, AI 智能搜索, 多模态理解力帮你轻松跨越从0到1的创作门槛☜☜☜
{"type":"doc","content":[{"type":"heading","attrs":{"id":"2f23a260-98e1-4986-abd6-9a680b3ed17c","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"一、背景"}]},{"type":"paragraph","attrs":{"id":"9a272e75-cf46-4bfd-bf52-597d8842cd91","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"在实际迭代开发中,不同需求的代码规模差异很大,有些需求涉及上千行代码,有些则只有一两行。且对于前端的代码验收,主要侧重在界面功能,通过功能验收,没法确保每一行代码都测试到的,以及功能的代码逻辑是否合理,是否健壮、是否规范等问题,都需要通过人工代码 cr 来进一步兜底验收代码的质量,尽量降低业务线上出错的可能。但当面对上千行的代码变更时,人工 cr 也是心有余而力不足。"}]},{"type":"paragraph","attrs":{"id":"faaa1a04-53c5-4270-b37f-08a40cb984d2","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"传统的代码审查依赖人工,面对大规模代码变更时效率有限,而 ai 代码审查能够实现自动化、标准化的质量检查,有效补充人工审查的不足。"}]},{"type":"heading","attrs":{"id":"52bde7d7-7a0e-40ba-add7-de7a903296df","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"二、前端研发 cr 现状与可优化点"}]},{"type":"heading","attrs":{"id":"d8b2ab87-0130-4cd3-9f40-7423e59a3477","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"cr 现状"}]},{"type":"paragraph","attrs":{"id":"fe067c27-11bc-4f46-9395-6c8a14c2222b","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"目前前端研发同学主要使用的代码质量保障工具有前端 apex 插件智能体、uraya 质量分检测。其中 apex 插件智能体是通过前端研发自助点击或 git hook 自动触发 cr 智能体执行,智能体内定制了 cr 规则以及与 mcp 的结合,利用 cursor ide 的 agent 能力进行本地 ai cr ,找出代码问题、本地解决问题。uraya 质量分检测是在创建 mr 后,通过流水线自动触发,uraya 质量分检测代码变更的质量分浮动,产出具体问题的记录,引导研发优化代码。"}]},{"type":"heading","attrs":{"id":"0111827c-d5a4-4bef-a392-76a46da8bff8","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"可优化点"}]},{"type":"orderedlist","attrs":{"id":"797bead3-d3ac-4968-ae89-03ddfed0ecdb","start":1,"ishoverdraghandle":false},"content":[{"type":"listitem","attrs":{"id":"3c3d22da-35e2-4c9f-8114-e00be1ceff28"},"content":[{"type":"paragraph","attrs":{"id":"d5cc0012-172f-43bc-9500-50040eee2b57","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"本地触发 cr 需要研发同学主动点击触发或者通过 apex git hook 执行 cr 智能体,当开发的需求多、分支多、提交次数多的时候,时长容易漏触发、忘记点。"}]}]},{"type":"listitem","attrs":{"id":"de70aa2e-20f6-4e3b-829d-ccea9869b3f1"},"content":[{"type":"paragraph","attrs":{"id":"92c3fe1f-8d37-4bbe-abd6-2a34889fd551","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"对于 mr 评审人员,如果希望通过 cursor cr 时,需要在本地通过调用 cr 智能体再执行一遍,获取 cr 结果,在目前 cursor 按量计费的背景下,重复执行 cr 智能体的成本需要及时关注。"}]}]},{"type":"listitem","attrs":{"id":"8d585f55-3eb3-44c0-905a-f62661ff6093"},"content":[{"type":"paragraph","attrs":{"id":"ee183e56-fc86-4ecd-a2a5-4b7eff087c6a","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"当前流水线 diff + 大模型 api 的 ai cr 方式,误报率较高,研发使用意愿较低。"}]}]}]},{"type":"heading","attrs":{"id":"cc93a232-b5a4-43e2-a84f-faf81dca6ae5","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"三、ai cr 方案对比分析"}]},{"type":"paragraph","attrs":{"id":"f15944b2-a4be-421f-99b8-a0b174e6098f","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"基于以上现状分析,我们对不同 ai cr 方案进行了深入对比。"}]},{"type":"heading","attrs":{"id":"31625aca-0750-49a4-932c-af7c678ab4c2","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"cursor agent cr 主要优势"}]},{"type":"image","attrs":{"id":"d42639e0-ad74-47d3-a740-6a4c2b2d7416","src":"https://developer.qcloudimg.com/http-save/audit-9927536/caebb257c9cd3307a6e4ea1e04f706d2.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"ed079e2d-18f4-498b-af27-52acf107d644","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"流水线集成 cr 与本地 ai cr 差异"}]},{"type":"image","attrs":{"id":"cd8c92d9-f9f1-48aa-864b-c96e1198b0c5","src":"https://developer.qcloudimg.com/http-save/audit-9927536/bcdd727245da59924188d9f0ca352a92.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"cad3e0da-3dc6-4597-ae70-8e47a00823fb","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"四、技术方案设计"}]},{"type":"paragraph","attrs":{"id":"29110bbf-852f-4239-b9bb-88592acac35a","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"结合目前现状与可优化点,我们期望能像 uraya 质量分检测一样,在 mr 过程中通过流水线自动触发,中途每次代码提交也能自动触发,对于流水线中的 cr 不满意时,可以结合 apex cr 智能体进行本地 cr 调整代码。"}]},{"type":"paragraph","attrs":{"id":"10810615-b676-4215-b347-2bbccc907ce4","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"为此我们考虑结合 cursor agent cli 在流水线中增加一个 ai cr 的任务,自动触发 cursor agent 代码 cr,并记录 cr 结论,及时展示给研发或者代码评审的同学,辅助代码质量优化。"}]},{"type":"paragraph","attrs":{"id":"a65de83d-3307-449f-ae4b-a388584e877d","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"整体链路设计如下:"}]},{"type":"image","attrs":{"id":"8d39efc1-2fe9-43a6-ba71-7bccb5da90ba","src":"https://developer.qcloudimg.com/http-save/audit-9927536/181d04f4bc21cfdf1462a2de2ad85a68.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"orderedlist","attrs":{"id":"66d35fbc-8a9d-4ec7-8cfb-1a35a515f1d0","start":1,"ishoverdraghandle":false},"content":[{"type":"listitem","attrs":{"id":"5fc85233-bb29-49de-be63-a9e3385c45e4"},"content":[{"type":"paragraph","attrs":{"id":"7853f87f-efbc-4ff5-b11b-0e30985f5c13","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"当研发创建 mr 后,流水线配置了 ai cr 检测流水线后,将会自动触发 cursor agent cr 任务。"}]}]},{"type":"listitem","attrs":{"id":"432f9582-5eec-46bb-ae0d-45ccf5759b6e"},"content":[{"type":"paragraph","attrs":{"id":"23124dc5-ab19-409b-848c-a48a7ed596fd","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"接收到检测任务后,将会前置将该仓库准备好,并将 mr 的信息以及制定的 cr 规则,一并交给 cursor agent cli 执行,待执行完成,会得到一份 cr 报告。"}]}]},{"type":"listitem","attrs":{"id":"30c58da5-e6c4-4a57-a6b2-faa84852bc75"},"content":[{"type":"paragraph","attrs":{"id":"0d814c45-16bd-44ea-a9b7-2c3a1b6ff47f","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"接收到检测任务完成后,目前会通过 mr 评论的方式添加到对应的 mr 中,引导用户查看。"}]}]},{"type":"listitem","attrs":{"id":"5ffab014-227d-468f-b332-c2284973435e"},"content":[{"type":"paragraph","attrs":{"id":"3523b8fe-04a1-49da-989a-6a304e209ff9","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"对于开发者视角,打开审查报告,可以根据审查出的问题,进行修改。"}]}]},{"type":"listitem","attrs":{"id":"556ba7ac-b060-48ea-b58d-b7a543fe71a2"},"content":[{"type":"paragraph","attrs":{"id":"9a54a887-c556-4373-be70-c10a7e93d528","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"对于 cr 人员视角,打开审查报告,可以根据审查出的问题,一键添加到评论,引导开发者修改。"}]}]}]},{"type":"heading","attrs":{"id":"3c93c846-1d26-4535-b4b9-62772d159f00","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"五、mr 流水线接入与 ai cr 报告"}]},{"type":"heading","attrs":{"id":"9fbb5929-6000-46e4-a05c-4033e21b5d87","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"自动触发"}]},{"type":"paragraph","attrs":{"id":"8d59edbc-1677-4658-a988-7cbd932b3214","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"以下图 mr 为例,在 mr 流水线中,添加了仓库流水线 ai 检测的检测任务,当创建 mr 时,会自动触发执行一次,在 mr 未合入的过程中,每次代码变更也会自动触发。"}]},{"type":"image","attrs":{"id":"21dc0818-8507-4688-9f10-30b243d66f0c","src":"https://developer.qcloudimg.com/http-save/audit-9927536/084c2d325cef304288b58c264b22b6d6.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"982e3b2c-fab4-40b7-8dd6-98d8dd315acd","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"添加审查报告评论"}]},{"type":"paragraph","attrs":{"id":"8827aa12-5aa2-4cad-96fe-e45351aacff0","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"检测完成后会自动添加一条 mr 评论,通知研发已完成检测,可以点击查看 cr 报告。评论概览中有审查摘要,显示聚类问题的数量;还有审查总结,即对所有反馈的总结,概览问题。"}]},{"type":"image","attrs":{"id":"e66484e0-8d8a-4705-bf65-3b1f562db3ec","src":"https://developer.qcloudimg.com/http-save/audit-9927536/3bf4abdaec10daf1ffb930d9f8d3bbb2.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"0ad74623-61d2-4a82-b83b-fa702d737a94","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"ai cr 报告"}]},{"type":"paragraph","attrs":{"id":"cc269f99-47d8-4a90-8908-75b68a8758c8","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"以下为实际 mr 生成的 cr 报告,可以看到,报告主要包括:mr 的基础信息、问题的分类 tab、问题的具体描述、问题的操作。"}]},{"type":"image","attrs":{"id":"34cf214e-c242-4d54-90ea-0572719df95f","src":"https://developer.qcloudimg.com/http-save/audit-9927536/331b37ebecb7b828710c2f56561a0801.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"05229f53-c3b2-42a3-b4ac-549999113620","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"具体问题列表"}]},{"type":"paragraph","attrs":{"id":"56ea35ce-f60f-40be-90b9-b838194dff8c","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"首先报告列表会对问题进行聚类,分为严重问题、警告、建议三类,切换对应 tab 可以看到问题列表。具体的问题信息,主要有类型、问题代码、修复后代码、描述、文件路径、行号、操作等列。"}]},{"type":"image","attrs":{"id":"a3ed6e46-b520-4ade-a088-f4e9311d0906","src":"https://developer.qcloudimg.com/http-save/audit-9927536/a9bfdea981215a61dfbb7d1de31f9ee6.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"b117ab32-0b07-46ad-971a-190b9b61cdcf","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"添加到评论"}]},{"type":"paragraph","attrs":{"id":"b0b7c1f7-5711-4af9-8c10-411db1c3f242","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"点击操作列的添加到评论,将会一键将相关问题的信息,生成格式化描述,添加到 mr 的评论中,提醒开发者关注问题、解决问题。"}]},{"type":"image","attrs":{"id":"586df1c6-8989-4a68-8756-d310bfb2220e","src":"https://developer.qcloudimg.com/http-save/audit-9927536/0b226b6c67a777ef1c97fcedaf20368f.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"7c24c709-f2fa-40f3-921c-d1b90a35eebe","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"ai 智能解决"}]},{"type":"paragraph","attrs":{"id":"44ed9eeb-0c05-4c17-8211-0350dd82c951","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"点击操作列的 cursor 解决,将会一键将相关问题的信息,生成解决问题 prompt,一键打开本地 cursor ,创建 agent 对话去解决问题。打开链接后,cursor 会先接收 prompt ,你可以简单浏览下,点击 create chat ,即可一键创建 chat,回车执行修复。"}]},{"type":"image","attrs":{"id":"4257233f-98fe-4c0b-9e73-886cde01db2d","src":"https://developer.qcloudimg.com/http-save/audit-9927536/53806315f880d00575da00bdbb869773.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"paragraph","attrs":{"id":"da3e8157-0b05-44e8-b294-137816fe3d00","textalign":"center","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"cursor prompt 预览"}]},{"type":"image","attrs":{"id":"0e28ee55-7fad-4de6-8e36-e5263bbafaa5","src":"https://developer.qcloudimg.com/http-save/audit-9927536/3c6b0be0ef4ff22701e26e799e1eabe4.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"paragraph","attrs":{"id":"73e39acf-ed59-4fa7-8632-a61b299ae4fd","textalign":"center","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"确认填入 chat 执行"}]},{"type":"heading","attrs":{"id":"8d9b62d3-ceab-4572-90b6-6eb7ce6e310a","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"复制 prompt"}]},{"type":"paragraph","attrs":{"id":"7f8f0234-70c2-4dab-b1b8-f3c44d9b3479","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"点击复制 prompt,支持一键复制修复问题 prompt,可以放到期望的 ide 里使用。如下图,就是复制的 prompt 示例。"}]},{"type":"image","attrs":{"id":"aa78cf29-5d8a-452f-b73a-2264948430cd","src":"https://developer.qcloudimg.com/http-save/audit-9927536/bce2aff2223da40a77841c3cd2441706.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"228a7da1-cb0e-4a3d-bf7f-b88ea8e07a1c","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"六、推荐研发流程实践"}]},{"type":"heading","attrs":{"id":"501eff93-0d31-4d61-800a-432555a61ba9","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"尽早创建 mr"}]},{"type":"paragraph","attrs":{"id":"7bbef517-cf42-4c3a-99e8-5386d158a265","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"当需求分支第一次提交后,就可以创建到 release 或 test 目标分支的 mr 了,后续每次提交代码都将会自动触发检测,产出 ai cr 报告。"}]},{"type":"heading","attrs":{"id":"43fd94bc-4002-497f-b414-41fc2de3632e","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"研发自主查看与解决"}]},{"type":"paragraph","attrs":{"id":"cc88815c-c010-4467-a615-b0e37722c1c3","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"研发收到 ai cr 报告的通知后,可以及时打开 cr 报告查看,确认反馈的疑问点是否需要调整,如果需要调整可以通过 cursor 一键解决,将问题解决前置到提测以前,这样所有的改动可以尽可能的被测试同学验证到。"}]},{"type":"heading","attrs":{"id":"5080efc9-8ad3-4c41-b615-23a2a8e30151","textalign":"inherit","indent":0,"level":2,"ishoverdraghandle":false},"content":[{"type":"text","text":"人工 cr"}]},{"type":"paragraph","attrs":{"id":"1c828dde-ed19-4022-bbab-3a36fb6c61aa","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"发布前最后的人工 cr 可以通过前置的 ai cr 发现与问题前置解决,大幅提升靠最后人工 cr 的反馈、修改等环节效率。特别是当业务需求代码量较大时,人工 cr 浏览的效率和质量也是无法保证的。"}]},{"type":"heading","attrs":{"id":"2145c963-365f-44c6-96b5-0a470705708c","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"七、内置提示词工程"}]},{"type":"paragraph","attrs":{"id":"435ce04b-c439-4796-ad57-8a0a29b2e828","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"ai cr 其实就像给 ai 一个详细的检查清单。这个清单分两部分:一部分是基本规则,比如\"你要扮演什么样的角色\"、\"按什么流程检查\";另一部分是具体的技术要点,比如\"注意空指针问题\"、\"检查react用法是否正确\"等。有了这个清单,ai 就能像有经验的程序员一样,系统地检查代码,发现各种潜在问题,让代码质量得到保障。"}]},{"type":"paragraph","attrs":{"id":"9c24716d-212b-45ca-9ae7-be4940ce505b","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"具体这个规则体系的结构如下:"}]},{"type":"codeblock","attrs":{"id":"605d8593-a060-40cf-ba1d-55eabb7bc591","language":"javascript","theme":"atom-one-dark","runtimes":0,"ishoverdraghandle":false,"key":"","languagebyai":"javascript"},"content":[{"type":"text","text":".cursor/rules├── 00-role-and-constraints.mdc # 角色与约束 - 定义ai代码审查助手的角色和基本约束条件├── 01-workflow-steps.mdc # 工作流程步骤 - 描述代码审查的工作流程和步骤├── 02-detection-standards.mdc # 检测标准 - 定义代码问题的检测标准和准则├── 03-output-format.mdc # 输出格式 - 规定代码审查结果的输出格式和规范├── 04-best-practices.mdc # 最佳实践 - 提供代码审查中的最佳实践建议├── common # 通用规则目录 - 包含各种常见的代码问题检测规则│ ├── 01-null-pointer-defense.md # 空指针防御 - 防止空指针异常的最佳实践│ ├── 02-react-hooks-usage.md # react hooks 使用 - react hooks 的正确使用方式│ ├── 03-data-merge-state.md # 数据合并状态 - 处理数据合并时的状态管理问题│ ├── 04-async-programming.md # 异步编程 - 异步编程模式和常见陷阱│ ├── 05-memory-leak-performance.md # 内存泄漏性能 - 检测和防止内存泄漏问题│ ├── 06-security-coding.md # 安全编码 - 安全编程实践和漏洞防范│ ├── 07-compatibility.md # 兼容性 - 确保代码兼容性的检查点│ ├── 08-git-conflict-detection.md # git 冲突检测 - 检测并解决 git 合并冲突│ ├── 09-code-quality.md # 代码质量 - 代码质量评估和改进规则│ ├── 10-resource-handling.md # 资源处理 - 正确处理系统资源的规则│ ├── 11-url-params.md # url 参数 - url 参数处理的安全和有效性检查│ ├── 12-business-logic-consistency.md # 业务逻辑一致性 - 确保业务逻辑一致性的规则│ └── 13-monorepo-dependency.md # 大仓依赖 - monorepo 架构中的依赖管理规则└── readme.md # 说明文档 - 规则系统的介绍和使用说明"}]},{"type":"heading","attrs":{"id":"c7bddf36-1067-4d5c-8d5d-20da2ed30ba3","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"八、模型选择"}]},{"type":"paragraph","attrs":{"id":"882ae3b0-95be-4175-acbc-f4e80132d003","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"在 ai cr 环节,模型的选择需要考虑模型对于代码理解的复杂性、上下文长度需求以及推理准确性、模型的速度、模型的使用成本等考量。在 cursor 的模型列表中,我们优先使用 compose 1.5,当额度不足时,我们也会降级使用 auto 模型。"}]},{"type":"paragraph","attrs":{"id":"c4b9128b-9a1d-444b-b5ad-8f06b9bcf017","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"以下为 cursor auto 模型与 composer 1.5 模型对比,可以看出,两个模型都找出了 4 个问题,但在时间上,composer 1.5 进行需 44 秒即可完成,而 auto 模型需要 91 秒。"}]},{"type":"image","attrs":{"id":"94ff2162-8f88-4df4-a61e-ed42d28e1d81","src":"https://developer.qcloudimg.com/http-save/audit-9927536/98f11a86b21276a2d21ef2d236dd60a0.webp","extension":"","align":"center","alt":"","showalt":false,"href":"","boxshadow":"","width":"","aspectratio":0,"status":"success","showtext":true,"ispercentage":false,"percentage":0,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"fe94e54f-1256-41b3-be8e-5673fdd87f4a","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"九、总结与规划"}]},{"type":"paragraph","attrs":{"id":"18243ea9-50f6-4400-ad6b-e377c163135e","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"通过多个迭代实践与数据统计,cursor agent cr 挖掘的有效问题数可以达到 50% 左右,研发使用的意愿也相比原来有不少提升。当前我们也在将 ai cr 报告融合到 cursor ide 插件中,进一步融合到研发流程里。"}]},{"type":"paragraph","attrs":{"id":"ce416ebb-3ba3-4ba8-b2e2-5973d098f2f1","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"随着 ai 生成代码在开发流程中越来越普遍,ai cr 的重要性将进一步凸显。相比传统的人工审查,ai 审查能够自动发现 ai 生成代码中可能存在的逻辑错误、安全性问题和规范性缺陷,提前在开发过程中消除隐患。同时,ai cr 还能确保 ai 生成的代码符合团队的技术规范和最佳实践,保持代码风格的一致性。为 ai 时代的开发流程提供了可靠的质保机制,让开发流程更加顺畅,是现代软件开发的重要保障。"}]},{"type":"paragraph","attrs":{"id":"052b93ee-8fb8-4b36-a518-dc212fc3e936","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"fd907cf1-294e-48d1-98de-cd1a79b98953","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"往期回顾"}]},{"type":"paragraph","attrs":{"id":"b18fd537-5950-4505-b809-8b4b42dc2b9c","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false}},{"type":"paragraph","attrs":{"id":"0642eba0-9c7b-4f1c-9675-720e66ec7321","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"1.从ide到terminal:适合后端宝宝体质的claude code工作流|得物技术"}]},{"type":"paragraph","attrs":{"id":"286ba4fe-0f6e-4759-b5d2-bee0ac166baf","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"2.ai编程能力边界探索:基于 claude code 的 spec coding 项目实战|得物技术"}]},{"type":"paragraph","attrs":{"id":"0e6792a1-7542-4a2b-8af3-b08c7cfa276a","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"3.搜索 c++ 引擎回归能力建设:从自测到工程化准出|得物技术"}]},{"type":"paragraph","attrs":{"id":"0108d099-32b3-4039-80b6-28eb4f73abd2","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"4.得物社区搜推公式融合调参框架-加乘树3.0实战"}]},{"type":"paragraph","attrs":{"id":"1ae48794-49e4-4bb8-b105-14a46451366e","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"5.深入剖析spark ui界面:参数与界面详解|得物技术"}]},{"type":"paragraph","attrs":{"id":"bda42230-69a1-4ee7-812c-cb1313aab6f8","textalign":"inherit","indent":0,"color":null,"background":null,"ishoverdraghandle":false}},{"type":"heading","attrs":{"id":"b84509f6-4eae-45cc-b8e1-916ae618c120","textalign":"inherit","indent":0,"level":1,"ishoverdraghandle":false},"content":[{"type":"text","text":"文 /大圣"}]},{"type":"paragraph","attrs":{"id":"12ef6df6-cfad-459f-aa6c-86a2c01ae49a","textalign":"center","indent":0,"color":null,"background":null,"ishoverdraghandle":false}},{"type":"paragraph","attrs":{"id":"266090ac-3c10-4978-bcd7-f5b1bf54169b","textalign":"center","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"关注得物技术,每周更新技术干货"}]},{"type":"paragraph","attrs":{"id":"9d4b9bcc-1f88-4a77-97ba-3ff3bebf502e","textalign":"center","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"要是觉得文章对你有帮助的话,欢迎评论转发点赞~"}]},{"type":"paragraph","attrs":{"id":"314c4b07-034f-440c-8106-724ee7a61717","textalign":"center","indent":0,"color":null,"background":null,"ishoverdraghandle":false},"content":[{"type":"text","text":"未经得物技术许可严禁转载,否则依法追究法律责任。"}]}]}