[{"data":1,"prerenderedAt":3262},["ShallowReactive",2],{"article-/topics/ai/ai-agent-workflow-change-management-versioned-migration":3,"related-ai":291,"content-query-v0AyhUKjIF":3058},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"topic":5,"author":11,"tags":12,"image":17,"imageQuery":18,"pexelsPhotoId":19,"pexelsUrl":20,"featured":6,"readingTime":21,"body":22,"_type":285,"_id":286,"_source":287,"_file":288,"_stem":289,"_extension":290},"/topics/ai/ai-agent-workflow-change-management-versioned-migration","ai",false,"","AI agent Workflow Change Management：版本化迁移如何避免线上断流","工作流改版不是替换 JSON 那么简单。本文讲清 AI agent workflow 的版本化、兼容迁移、灰度发布和回滚策略。","2026-05-30","HTMLPAGE 团队",[13,14,15,16],"AI agent","Workflow Change Management","Versioning","Migration","/images/articles/ai-agent-workflow-change-management-versioned-migration-featured.jpg","software migration planning roadmap team",3688761,"https://www.pexels.com/photo/photo-of-people-using-laptop-3688761/",14,{"type":23,"children":24,"toc":277},"root",[25,33,39,59,64,69,156,170,176,181,187,241,246],{"type":26,"tag":27,"props":28,"children":29},"element","p",{},[30],{"type":31,"value":32},"text","当 workflow 进入生产，最大的风险不是“当前版本不够好”，而是“改版时把在跑任务切断”。",{"type":26,"tag":34,"props":35,"children":37},"h2",{"id":36},"版本迁移的核心原则",[38],{"type":31,"value":36},{"type":26,"tag":40,"props":41,"children":42},"ul",{},[43,49,54],{"type":26,"tag":44,"props":45,"children":46},"li",{},[47],{"type":31,"value":48},"新旧版本并存，不做瞬时替换",{"type":26,"tag":44,"props":50,"children":51},{},[52],{"type":31,"value":53},"在跑任务按原版本收敛",{"type":26,"tag":44,"props":55,"children":56},{},[57],{"type":31,"value":58},"新任务按灰度策略进入新版本",{"type":26,"tag":27,"props":60,"children":61},{},[62],{"type":31,"value":63},"这三条能避免大多数迁移事故。",{"type":26,"tag":34,"props":65,"children":67},{"id":66},"迁移策略对比",[68],{"type":31,"value":66},{"type":26,"tag":70,"props":71,"children":72},"table",{},[73,97],{"type":26,"tag":74,"props":75,"children":76},"thead",{},[77],{"type":26,"tag":78,"props":79,"children":80},"tr",{},[81,87,92],{"type":26,"tag":82,"props":83,"children":84},"th",{},[85],{"type":31,"value":86},"策略",{"type":26,"tag":82,"props":88,"children":89},{},[90],{"type":31,"value":91},"优点",{"type":26,"tag":82,"props":93,"children":94},{},[95],{"type":31,"value":96},"风险",{"type":26,"tag":98,"props":99,"children":100},"tbody",{},[101,120,138],{"type":26,"tag":78,"props":102,"children":103},{},[104,110,115],{"type":26,"tag":105,"props":106,"children":107},"td",{},[108],{"type":31,"value":109},"big bang",{"type":26,"tag":105,"props":111,"children":112},{},[113],{"type":31,"value":114},"实施简单",{"type":26,"tag":105,"props":116,"children":117},{},[118],{"type":31,"value":119},"风险最高",{"type":26,"tag":78,"props":121,"children":122},{},[123,128,133],{"type":26,"tag":105,"props":124,"children":125},{},[126],{"type":31,"value":127},"dual-run",{"type":26,"tag":105,"props":129,"children":130},{},[131],{"type":31,"value":132},"对比充分",{"type":26,"tag":105,"props":134,"children":135},{},[136],{"type":31,"value":137},"成本较高",{"type":26,"tag":78,"props":139,"children":140},{},[141,146,151],{"type":26,"tag":105,"props":142,"children":143},{},[144],{"type":31,"value":145},"traffic-split",{"type":26,"tag":105,"props":147,"children":148},{},[149],{"type":31,"value":150},"渐进稳定",{"type":26,"tag":105,"props":152,"children":153},{},[154],{"type":31,"value":155},"需完善观测",{"type":26,"tag":27,"props":157,"children":158},{},[159,161,168],{"type":31,"value":160},"对 agent workflow，默认应优先 ",{"type":26,"tag":162,"props":163,"children":165},"code",{"className":164},[],[166],{"type":31,"value":167},"traffic-split + rollback",{"type":31,"value":169},"。",{"type":26,"tag":34,"props":171,"children":173},{"id":172},"失败案例节点删除导致在跑任务中断",[174],{"type":31,"value":175},"失败案例：节点删除导致在跑任务中断",{"type":26,"tag":27,"props":177,"children":178},{},[179],{"type":31,"value":180},"某团队删除了旧节点并上线新图，导致旧版本 run 无法恢复。修复后改为“节点软废弃 + 兼容适配层”，等旧 run 清空后再硬删除。",{"type":26,"tag":34,"props":182,"children":184},{"id":183},"checklist",[185],{"type":31,"value":186},"Checklist",{"type":26,"tag":40,"props":188,"children":191},{"className":189},[190],"contains-task-list",[192,205,214,223,232],{"type":26,"tag":44,"props":193,"children":196},{"className":194},[195],"task-list-item",[197,203],{"type":26,"tag":198,"props":199,"children":202},"input",{"disabled":200,"type":201},true,"checkbox",[],{"type":31,"value":204}," workflow 配置有明确版本号",{"type":26,"tag":44,"props":206,"children":208},{"className":207},[195],[209,212],{"type":26,"tag":198,"props":210,"children":211},{"disabled":200,"type":201},[],{"type":31,"value":213}," 在跑任务绑定固定版本",{"type":26,"tag":44,"props":215,"children":217},{"className":216},[195],[218,221],{"type":26,"tag":198,"props":219,"children":220},{"disabled":200,"type":201},[],{"type":31,"value":222}," 迁移期间支持双版本观测",{"type":26,"tag":44,"props":224,"children":226},{"className":225},[195],[227,230],{"type":26,"tag":198,"props":228,"children":229},{"disabled":200,"type":201},[],{"type":31,"value":231}," 回滚策略可在分钟级执行",{"type":26,"tag":44,"props":233,"children":235},{"className":234},[195],[236,239],{"type":26,"tag":198,"props":237,"children":238},{"disabled":200,"type":201},[],{"type":31,"value":240}," 节点废弃遵循软删除窗口",{"type":26,"tag":27,"props":242,"children":243},{},[244],{"type":31,"value":245},"延伸阅读：",{"type":26,"tag":40,"props":247,"children":248},{},[249,259,268],{"type":26,"tag":44,"props":250,"children":251},{},[252],{"type":26,"tag":253,"props":254,"children":256},"a",{"href":255},"/topics/ai/ai-agent-version-set-pinning-rollback",[257],{"type":31,"value":258},"AI agent Version Set Pinning 与回滚",{"type":26,"tag":44,"props":260,"children":261},{},[262],{"type":26,"tag":253,"props":263,"children":265},{"href":264},"/topics/ai/ai-agent-prompt-tool-model-release",[266],{"type":31,"value":267},"AI agent Prompt-Tool-Model Release Train",{"type":26,"tag":44,"props":269,"children":270},{},[271],{"type":26,"tag":253,"props":272,"children":274},{"href":273},"/topics/ai/ai-agent-rollout-wave-cohort-migration",[275],{"type":31,"value":276},"AI agent Rollout Wave 与 Cohort Migration",{"title":7,"searchDepth":278,"depth":278,"links":279},3,[280,282,283,284],{"id":36,"depth":281,"text":36},2,{"id":66,"depth":281,"text":66},{"id":172,"depth":281,"text":175},{"id":183,"depth":281,"text":186},"markdown","content:topics:ai:ai-agent-workflow-change-management-versioned-migration.md","content","topics/ai/ai-agent-workflow-change-management-versioned-migration.md","topics/ai/ai-agent-workflow-change-management-versioned-migration","md",[292,1446,2395],{"_path":293,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":294,"description":295,"date":296,"topic":5,"author":11,"tags":297,"image":303,"imageAlt":304,"pexelsPhotoId":305,"pexelsUrl":306,"readingTime":307,"body":308,"_type":285,"_id":1443,"_source":287,"_file":1444,"_stem":1445,"_extension":290},"/topics/ai/cursor-keyboard-shortcuts-cheatsheet","Cursor 快捷键速查表（macOS/Windows）：从“会用”到“能提效”的 10 个工作流","把 Cursor 常用快捷键按任务分组（查代码、改代码、多文件、对话、审查与回滚），给出可直接照抄的工作流与最小回归清单，避免“快捷键背了也没变快”。","2026-03-02",[298,299,300,301,302],"Cursor","快捷键","AI IDE","VS Code","开发效率","/images/topics/ai/cursor-keyboard-shortcuts-cheatsheet.jpg","彩色机械键盘与鼠标的工作台面",34563105,"https://www.pexels.com/photo/colorful-mechanical-keyboard-and-mouse-setup-34563105/",12,{"type":23,"children":309,"toc":1417},[310,315,333,338,367,372,408,412,418,423,456,461,484,487,493,498,716,725,728,734,741,760,768,789,794,800,815,846,851,864,870,889,907,915,920,926,931,952,960,966,971,994,999,1005,1018,1024,1042,1060,1066,1077,1095,1101,1112,1118,1123,1166,1169,1175,1183,1236,1239,1245,1251,1256,1261,1284,1301,1306,1331,1334,1340,1346,1351,1357,1362,1368,1373,1376,1382],{"type":26,"tag":27,"props":311,"children":312},{},[313],{"type":31,"value":314},"如果你在搜“Cursor 快捷键”，你大概率不是想背一张表，而是想解决这类问题：",{"type":26,"tag":40,"props":316,"children":317},{},[318,323,328],{"type":26,"tag":44,"props":319,"children":320},{},[321],{"type":31,"value":322},"为什么我用了 AI，还是很慢？（对话来回太多、改动不可控）",{"type":26,"tag":44,"props":324,"children":325},{},[326],{"type":31,"value":327},"为什么它“看起来懂了”，却改错文件/改出回归？（上下文与范围没锁住）",{"type":26,"tag":44,"props":329,"children":330},{},[331],{"type":31,"value":332},"多文件改动怎么做得安全？（验收、回滚、最小回归集）",{"type":26,"tag":27,"props":334,"children":335},{},[336],{"type":31,"value":337},"这篇文章给你两份东西：",{"type":26,"tag":339,"props":340,"children":341},"ol",{},[342,355],{"type":26,"tag":44,"props":343,"children":344},{},[345,347,353],{"type":31,"value":346},"一张",{"type":26,"tag":348,"props":349,"children":350},"strong",{},[351],{"type":31,"value":352},"按任务分组",{"type":31,"value":354},"的快捷键表（不是按功能堆在一起）",{"type":26,"tag":44,"props":356,"children":357},{},[358,360,365],{"type":31,"value":359},"一套“从需求到落地”的",{"type":26,"tag":348,"props":361,"children":362},{},[363],{"type":31,"value":364},"最小闭环工作流",{"type":31,"value":366},"（每一步都有快捷键）",{"type":26,"tag":27,"props":368,"children":369},{},[370],{"type":31,"value":371},"想看系统玩法：",{"type":26,"tag":40,"props":373,"children":374},{},[375,386,397],{"type":26,"tag":44,"props":376,"children":377},{},[378,380],{"type":31,"value":379},"入门教程看：",{"type":26,"tag":253,"props":381,"children":383},{"href":382},"/topics/ai/cursor-tutorial",[384],{"type":31,"value":385},"Cursor 使用教程（2026）",{"type":26,"tag":44,"props":387,"children":388},{},[389,391],{"type":31,"value":390},"进阶玩法看：",{"type":26,"tag":253,"props":392,"children":394},{"href":393},"/topics/ai/cursor-editor-guide",[395],{"type":31,"value":396},"Cursor 编辑器深度玩法",{"type":26,"tag":44,"props":398,"children":399},{},[400,402],{"type":31,"value":401},"规则与忽略看：",{"type":26,"tag":253,"props":403,"children":405},{"href":404},"/topics/ai/cursor-rules-cursorrules",[406],{"type":31,"value":407},"Cursor Rules 与 .cursorrules",{"type":26,"tag":409,"props":410,"children":411},"hr",{},[],{"type":26,"tag":34,"props":413,"children":415},{"id":414},"先给结论提效不是按得快而是闭环更短",[416],{"type":31,"value":417},"先给结论：提效不是“按得快”，而是“闭环更短”",{"type":26,"tag":27,"props":419,"children":420},{},[421],{"type":31,"value":422},"你可以把 Cursor 的快捷键理解为 3 条流水线：",{"type":26,"tag":40,"props":424,"children":425},{},[426,436,446],{"type":26,"tag":44,"props":427,"children":428},{},[429,434],{"type":26,"tag":348,"props":430,"children":431},{},[432],{"type":31,"value":433},"改一小段",{"type":31,"value":435},"（内联编辑）：把改动限制在一个函数/一段样式",{"type":26,"tag":44,"props":437,"children":438},{},[439,444],{"type":26,"tag":348,"props":440,"children":441},{},[442],{"type":31,"value":443},"改一组文件",{"type":31,"value":445},"（Composer）：把改动限制在一组明确文件，并要求输出 diff + 验收点",{"type":26,"tag":44,"props":447,"children":448},{},[449,454],{"type":26,"tag":348,"props":450,"children":451},{},[452],{"type":31,"value":453},"聊清楚再动手",{"type":31,"value":455},"（侧边对话）：先对齐目标、范围、验收、回滚",{"type":26,"tag":27,"props":457,"children":458},{},[459],{"type":31,"value":460},"当你觉得“它乱改/改太大”时，往往不是快捷键没记住，而是缺了两件事：",{"type":26,"tag":40,"props":462,"children":463},{},[464,474],{"type":26,"tag":44,"props":465,"children":466},{},[467,469],{"type":31,"value":468},"没有在动手前锁定",{"type":26,"tag":348,"props":470,"children":471},{},[472],{"type":31,"value":473},"范围",{"type":26,"tag":44,"props":475,"children":476},{},[477,479],{"type":31,"value":478},"没有在接受改动前准备",{"type":26,"tag":348,"props":480,"children":481},{},[482],{"type":31,"value":483},"验收/回滚",{"type":26,"tag":409,"props":485,"children":486},{},[],{"type":26,"tag":34,"props":488,"children":490},{"id":489},"快捷键速查表按任务分组",[491],{"type":31,"value":492},"快捷键速查表（按任务分组）",{"type":26,"tag":27,"props":494,"children":495},{},[496],{"type":31,"value":497},"说明：下表按“你正在做什么”组织，而不是按“功能名字”组织。不同版本快捷键可能略有差异，但核心逻辑一致。",{"type":26,"tag":70,"props":499,"children":500},{},[501,527],{"type":26,"tag":74,"props":502,"children":503},{},[504],{"type":26,"tag":78,"props":505,"children":506},{},[507,512,517,522],{"type":26,"tag":82,"props":508,"children":509},{},[510],{"type":31,"value":511},"任务",{"type":26,"tag":82,"props":513,"children":514},{},[515],{"type":31,"value":516},"macOS",{"type":26,"tag":82,"props":518,"children":519},{},[520],{"type":31,"value":521},"Windows",{"type":26,"tag":82,"props":523,"children":524},{},[525],{"type":31,"value":526},"你该在什么时候用",{"type":26,"tag":98,"props":528,"children":529},{},[530,561,592,623,654,685],{"type":26,"tag":78,"props":531,"children":532},{},[533,538,547,556],{"type":26,"tag":105,"props":534,"children":535},{},[536],{"type":31,"value":537},"改一小段（最安全）",{"type":26,"tag":105,"props":539,"children":540},{},[541],{"type":26,"tag":162,"props":542,"children":544},{"className":543},[],[545],{"type":31,"value":546},"Cmd + K",{"type":26,"tag":105,"props":548,"children":549},{},[550],{"type":26,"tag":162,"props":551,"children":553},{"className":552},[],[554],{"type":31,"value":555},"Ctrl + K",{"type":26,"tag":105,"props":557,"children":558},{},[559],{"type":31,"value":560},"只想改一个函数/一段 CSS，不想动别的",{"type":26,"tag":78,"props":562,"children":563},{},[564,569,578,587],{"type":26,"tag":105,"props":565,"children":566},{},[567],{"type":31,"value":568},"打开 AI 对话（先对齐再动手）",{"type":26,"tag":105,"props":570,"children":571},{},[572],{"type":26,"tag":162,"props":573,"children":575},{"className":574},[],[576],{"type":31,"value":577},"Cmd + L",{"type":26,"tag":105,"props":579,"children":580},{},[581],{"type":26,"tag":162,"props":582,"children":584},{"className":583},[],[585],{"type":31,"value":586},"Ctrl + L",{"type":26,"tag":105,"props":588,"children":589},{},[590],{"type":31,"value":591},"需要澄清目标、制定步骤、给验收点",{"type":26,"tag":78,"props":593,"children":594},{},[595,600,609,618],{"type":26,"tag":105,"props":596,"children":597},{},[598],{"type":31,"value":599},"多文件编辑（有组织地改一组文件）",{"type":26,"tag":105,"props":601,"children":602},{},[603],{"type":26,"tag":162,"props":604,"children":606},{"className":605},[],[607],{"type":31,"value":608},"Cmd + I",{"type":26,"tag":105,"props":610,"children":611},{},[612],{"type":26,"tag":162,"props":613,"children":615},{"className":614},[],[616],{"type":31,"value":617},"Ctrl + I",{"type":26,"tag":105,"props":619,"children":620},{},[621],{"type":31,"value":622},"改动涉及多个文件：组件+样式+测试",{"type":26,"tag":78,"props":624,"children":625},{},[626,631,640,649],{"type":26,"tag":105,"props":627,"children":628},{},[629],{"type":31,"value":630},"把选中代码加入对话上下文",{"type":26,"tag":105,"props":632,"children":633},{},[634],{"type":26,"tag":162,"props":635,"children":637},{"className":636},[],[638],{"type":31,"value":639},"Cmd + Shift + L",{"type":26,"tag":105,"props":641,"children":642},{},[643],{"type":26,"tag":162,"props":644,"children":646},{"className":645},[],[647],{"type":31,"value":648},"Ctrl + Shift + L",{"type":26,"tag":105,"props":650,"children":651},{},[652],{"type":31,"value":653},"让 AI 只看你选的片段（降低噪音）",{"type":26,"tag":78,"props":655,"children":656},{},[657,662,671,680],{"type":26,"tag":105,"props":658,"children":659},{},[660],{"type":31,"value":661},"接受当前建议",{"type":26,"tag":105,"props":663,"children":664},{},[665],{"type":26,"tag":162,"props":666,"children":668},{"className":667},[],[669],{"type":31,"value":670},"Cmd + Y",{"type":26,"tag":105,"props":672,"children":673},{},[674],{"type":26,"tag":162,"props":675,"children":677},{"className":676},[],[678],{"type":31,"value":679},"Ctrl + Y",{"type":26,"tag":105,"props":681,"children":682},{},[683],{"type":31,"value":684},"你已经准备好验收/回滚，并确认改动范围",{"type":26,"tag":78,"props":686,"children":687},{},[688,693,702,711],{"type":26,"tag":105,"props":689,"children":690},{},[691],{"type":31,"value":692},"拒绝当前建议",{"type":26,"tag":105,"props":694,"children":695},{},[696],{"type":26,"tag":162,"props":697,"children":699},{"className":698},[],[700],{"type":31,"value":701},"Cmd + N",{"type":26,"tag":105,"props":703,"children":704},{},[705],{"type":26,"tag":162,"props":706,"children":708},{"className":707},[],[709],{"type":31,"value":710},"Ctrl + N",{"type":26,"tag":105,"props":712,"children":713},{},[714],{"type":31,"value":715},"改得太大、改错方向，立刻收手",{"type":26,"tag":717,"props":718,"children":719},"blockquote",{},[720],{"type":26,"tag":27,"props":721,"children":722},{},[723],{"type":31,"value":724},"小技巧：把“改一小段”当默认路径。只有当你能清晰写出“会改哪几类文件、怎么验收”时再进入多文件。",{"type":26,"tag":409,"props":726,"children":727},{},[],{"type":26,"tag":34,"props":729,"children":731},{"id":730},"_10-个可直接照抄的提效工作流每个都能闭环",[732],{"type":31,"value":733},"10 个可直接照抄的提效工作流（每个都能闭环）",{"type":26,"tag":735,"props":736,"children":738},"h3",{"id":737},"工作流-1需求计划小步改新手最稳",[739],{"type":31,"value":740},"工作流 1：需求→计划→小步改（新手最稳）",{"type":26,"tag":339,"props":742,"children":743},{},[744,755],{"type":26,"tag":44,"props":745,"children":746},{},[747,753],{"type":26,"tag":162,"props":748,"children":750},{"className":749},[],[751],{"type":31,"value":752},"Cmd/Ctrl + L",{"type":31,"value":754}," 打开对话",{"type":26,"tag":44,"props":756,"children":757},{},[758],{"type":31,"value":759},"先发这段（可复制）：",{"type":26,"tag":717,"props":761,"children":762},{},[763],{"type":26,"tag":27,"props":764,"children":765},{},[766],{"type":31,"value":767},"目标：……\n范围：只修改以下文件/模块：……\n非目标：……（明确不做）\n验收：……（可测试/可手动检查）\n输出格式：先给计划，再逐步执行；每一步写出 diff 摘要。",{"type":26,"tag":339,"props":769,"children":770},{"start":278},[771,776],{"type":26,"tag":44,"props":772,"children":773},{},[774],{"type":31,"value":775},"让 AI 先给“计划（3~6 步）”，你确认后再执行",{"type":26,"tag":44,"props":777,"children":778},{},[779,781,787],{"type":31,"value":780},"任何一步涉及改代码：优先回到编辑区，选中片段用 ",{"type":26,"tag":162,"props":782,"children":784},{"className":783},[],[785],{"type":31,"value":786},"Cmd/Ctrl + K",{"type":31,"value":788}," 小步改",{"type":26,"tag":27,"props":790,"children":791},{},[792],{"type":31,"value":793},"为什么有效：你把“想法”变成了“可执行约束”，这就是 GEO（面向 AI/模型的可理解结构）。",{"type":26,"tag":735,"props":795,"children":797},{"id":796},"工作流-2只改一个函数高频低风险",[798],{"type":31,"value":799},"工作流 2：只改一个函数（高频、低风险）",{"type":26,"tag":40,"props":801,"children":802},{},[803],{"type":26,"tag":44,"props":804,"children":805},{},[806,808,813],{"type":31,"value":807},"选中函数 → ",{"type":26,"tag":162,"props":809,"children":811},{"className":810},[],[812],{"type":31,"value":786},{"type":31,"value":814}," → 输入指令：",{"type":26,"tag":717,"props":816,"children":817},{},[818,823],{"type":26,"tag":27,"props":819,"children":820},{},[821],{"type":31,"value":822},"把这段改成更可读：",{"type":26,"tag":40,"props":824,"children":825},{},[826,831,836,841],{"type":26,"tag":44,"props":827,"children":828},{},[829],{"type":31,"value":830},"用 async/await",{"type":26,"tag":44,"props":832,"children":833},{},[834],{"type":31,"value":835},"错误处理不要吞掉",{"type":26,"tag":44,"props":837,"children":838},{},[839],{"type":31,"value":840},"添加类型（若可推断）",{"type":26,"tag":44,"props":842,"children":843},{},[844],{"type":31,"value":845},"不要改函数签名",{"type":26,"tag":27,"props":847,"children":848},{},[849],{"type":31,"value":850},"验收方式（强制）：",{"type":26,"tag":40,"props":852,"children":853},{},[854,859],{"type":26,"tag":44,"props":855,"children":856},{},[857],{"type":31,"value":858},"输出前后函数行为一致（输入/输出）",{"type":26,"tag":44,"props":860,"children":861},{},[862],{"type":31,"value":863},"失败分支有可观测日志（不要悄悄 return null）",{"type":26,"tag":735,"props":865,"children":867},{"id":866},"工作流-3多文件改动先定文件清单",[868],{"type":31,"value":869},"工作流 3：多文件改动（先定“文件清单”）",{"type":26,"tag":339,"props":871,"children":872},{},[873,884],{"type":26,"tag":44,"props":874,"children":875},{},[876,882],{"type":26,"tag":162,"props":877,"children":879},{"className":878},[],[880],{"type":31,"value":881},"Cmd/Ctrl + I",{"type":31,"value":883}," 进入多文件",{"type":26,"tag":44,"props":885,"children":886},{},[887],{"type":31,"value":888},"先让 AI 输出：",{"type":26,"tag":40,"props":890,"children":891},{},[892,897,902],{"type":26,"tag":44,"props":893,"children":894},{},[895],{"type":31,"value":896},"预计会改哪些文件（最多 5 个）",{"type":26,"tag":44,"props":898,"children":899},{},[900],{"type":31,"value":901},"每个文件改什么",{"type":26,"tag":44,"props":903,"children":904},{},[905],{"type":31,"value":906},"每一步怎么验收",{"type":26,"tag":339,"props":908,"children":909},{"start":278},[910],{"type":26,"tag":44,"props":911,"children":912},{},[913],{"type":31,"value":914},"你确认文件清单后再开始生成改动",{"type":26,"tag":27,"props":916,"children":917},{},[918],{"type":31,"value":919},"关键点：多文件最容易翻车的是“它把你没想到的文件也改了”。所以文件清单是第一道闸门。",{"type":26,"tag":735,"props":921,"children":923},{"id":922},"工作流-4把上下文噪音砍掉防跑偏",[924],{"type":31,"value":925},"工作流 4：把“上下文噪音”砍掉（防跑偏）",{"type":26,"tag":27,"props":927,"children":928},{},[929],{"type":31,"value":930},"当你怀疑它在胡说/乱改时：",{"type":26,"tag":40,"props":932,"children":933},{},[934,947],{"type":26,"tag":44,"props":935,"children":936},{},[937,939,945],{"type":31,"value":938},"只选择关键代码片段 → ",{"type":26,"tag":162,"props":940,"children":942},{"className":941},[],[943],{"type":31,"value":944},"Cmd/Ctrl + Shift + L",{"type":31,"value":946}," 加入对话",{"type":26,"tag":44,"props":948,"children":949},{},[950],{"type":31,"value":951},"然后在对话里要求：",{"type":26,"tag":717,"props":953,"children":954},{},[955],{"type":26,"tag":27,"props":956,"children":957},{},[958],{"type":31,"value":959},"只基于我提供的代码片段回答，不要假设其它文件存在。",{"type":26,"tag":735,"props":961,"children":963},{"id":962},"工作流-5生成变更说明让-code-review-变快",[964],{"type":31,"value":965},"工作流 5：生成变更说明（让 code review 变快）",{"type":26,"tag":27,"props":967,"children":968},{},[969],{"type":31,"value":970},"改完后在对话里让它输出：",{"type":26,"tag":40,"props":972,"children":973},{},[974,979,984,989],{"type":26,"tag":44,"props":975,"children":976},{},[977],{"type":31,"value":978},"改动摘要（3~7 条）",{"type":26,"tag":44,"props":980,"children":981},{},[982],{"type":31,"value":983},"风险点（依赖/边界条件）",{"type":26,"tag":44,"props":985,"children":986},{},[987],{"type":31,"value":988},"回滚方式",{"type":26,"tag":44,"props":990,"children":991},{},[992],{"type":31,"value":993},"验收步骤",{"type":26,"tag":27,"props":995,"children":996},{},[997],{"type":31,"value":998},"这套结构能直接贴进 PR 描述。",{"type":26,"tag":735,"props":1000,"children":1002},{"id":1001},"工作流-6写最小回归集不写回归-等事故",[1003],{"type":31,"value":1004},"工作流 6：写“最小回归集”（不写回归 = 等事故）",{"type":26,"tag":27,"props":1006,"children":1007},{},[1008,1010,1016],{"type":31,"value":1009},"每次改动都至少做 10 条最小回归（见下文清单）。你可以把它写在 ",{"type":26,"tag":162,"props":1011,"children":1013},{"className":1012},[],[1014],{"type":31,"value":1015},"README",{"type":31,"value":1017}," 或团队 wiki。",{"type":26,"tag":735,"props":1019,"children":1021},{"id":1020},"工作流-7把接受建议变成最后一步",[1022],{"type":31,"value":1023},"工作流 7：把“接受建议”变成最后一步",{"type":26,"tag":27,"props":1025,"children":1026},{},[1027,1033,1035,1040],{"type":26,"tag":162,"props":1028,"children":1030},{"className":1029},[],[1031],{"type":31,"value":1032},"Cmd/Ctrl + Y",{"type":31,"value":1034}," 应该是",{"type":26,"tag":348,"props":1036,"children":1037},{},[1038],{"type":31,"value":1039},"最后一步",{"type":31,"value":1041},"：",{"type":26,"tag":40,"props":1043,"children":1044},{},[1045,1050,1055],{"type":26,"tag":44,"props":1046,"children":1047},{},[1048],{"type":31,"value":1049},"你已经看过 diff",{"type":26,"tag":44,"props":1051,"children":1052},{},[1053],{"type":31,"value":1054},"你能说清楚“怎么验收”",{"type":26,"tag":44,"props":1056,"children":1057},{},[1058],{"type":31,"value":1059},"你知道“怎么回滚”",{"type":26,"tag":735,"props":1061,"children":1063},{"id":1062},"工作流-8拒绝建议不是失败是风控动作",[1064],{"type":31,"value":1065},"工作流 8：拒绝建议不是失败，是风控动作",{"type":26,"tag":27,"props":1067,"children":1068},{},[1069,1075],{"type":26,"tag":162,"props":1070,"children":1072},{"className":1071},[],[1073],{"type":31,"value":1074},"Cmd/Ctrl + N",{"type":31,"value":1076}," 的使用时机：",{"type":26,"tag":40,"props":1078,"children":1079},{},[1080,1085,1090],{"type":26,"tag":44,"props":1081,"children":1082},{},[1083],{"type":31,"value":1084},"它开始改你没提过的东西（范围漂移）",{"type":26,"tag":44,"props":1086,"children":1087},{},[1088],{"type":31,"value":1089},"它改了 10 个文件但你只想改 1 个",{"type":26,"tag":44,"props":1091,"children":1092},{},[1093],{"type":31,"value":1094},"它为了“更优雅”引入新依赖/新抽象",{"type":26,"tag":735,"props":1096,"children":1098},{"id":1097},"工作流-9重复任务做成模板提示词不是一次性",[1099],{"type":31,"value":1100},"工作流 9：重复任务做成模板（提示词不是一次性）",{"type":26,"tag":27,"props":1102,"children":1103},{},[1104,1106,1110],{"type":31,"value":1105},"把高频任务（比如“写组件+样式+验收”）固化成模板，放进 Rules（见：",{"type":26,"tag":253,"props":1107,"children":1108},{"href":404},[1109],{"type":31,"value":407},{"type":31,"value":1111},"）。",{"type":26,"tag":735,"props":1113,"children":1115},{"id":1114},"工作流-10把快捷键表做成你自己的任务表",[1116],{"type":31,"value":1117},"工作流 10：把“快捷键表”做成你自己的任务表",{"type":26,"tag":27,"props":1119,"children":1120},{},[1121],{"type":31,"value":1122},"你不需要记住所有快捷键，只需要记住：",{"type":26,"tag":40,"props":1124,"children":1125},{},[1126,1136,1146,1156],{"type":26,"tag":44,"props":1127,"children":1128},{},[1129,1131],{"type":31,"value":1130},"小步改：",{"type":26,"tag":162,"props":1132,"children":1134},{"className":1133},[],[1135],{"type":31,"value":786},{"type":26,"tag":44,"props":1137,"children":1138},{},[1139,1141],{"type":31,"value":1140},"先对齐：",{"type":26,"tag":162,"props":1142,"children":1144},{"className":1143},[],[1145],{"type":31,"value":752},{"type":26,"tag":44,"props":1147,"children":1148},{},[1149,1151],{"type":31,"value":1150},"多文件：",{"type":26,"tag":162,"props":1152,"children":1154},{"className":1153},[],[1155],{"type":31,"value":881},{"type":26,"tag":44,"props":1157,"children":1158},{},[1159,1161],{"type":31,"value":1160},"上下文聚焦：",{"type":26,"tag":162,"props":1162,"children":1164},{"className":1163},[],[1165],{"type":31,"value":944},{"type":26,"tag":409,"props":1167,"children":1168},{},[],{"type":26,"tag":34,"props":1170,"children":1172},{"id":1171},"必交付物-1最小回归任务清单10-条通用",[1173],{"type":31,"value":1174},"必交付物 1：最小回归任务清单（10 条，通用）",{"type":26,"tag":717,"props":1176,"children":1177},{},[1178],{"type":26,"tag":27,"props":1179,"children":1180},{},[1181],{"type":31,"value":1182},"这份清单的意义：让每次 AI 改动都能“被验证”。否则你只是把不可控变成了更快的不可控。",{"type":26,"tag":339,"props":1184,"children":1185},{},[1186,1191,1196,1201,1206,1211,1216,1221,1226,1231],{"type":26,"tag":44,"props":1187,"children":1188},{},[1189],{"type":31,"value":1190},"关键路径能跑通（手动点击/请求一次）",{"type":26,"tag":44,"props":1192,"children":1193},{},[1194],{"type":31,"value":1195},"错误路径能触发（模拟一次失败输入）",{"type":26,"tag":44,"props":1197,"children":1198},{},[1199],{"type":31,"value":1200},"控制台无新增错误（至少关注 1 次真实操作）",{"type":26,"tag":44,"props":1202,"children":1203},{},[1204],{"type":31,"value":1205},"关键 UI 未错位（移动端/桌面端各看一眼）",{"type":26,"tag":44,"props":1207,"children":1208},{},[1209],{"type":31,"value":1210},"刷新后状态正确（尤其是表单/列表）",{"type":26,"tag":44,"props":1212,"children":1213},{},[1214],{"type":31,"value":1215},"路由跳转没断（从入口到目标页）",{"type":26,"tag":44,"props":1217,"children":1218},{},[1219],{"type":31,"value":1220},"相关接口未改变契约（字段名/类型）",{"type":26,"tag":44,"props":1222,"children":1223},{},[1224],{"type":31,"value":1225},"性能没有明显退化（首屏、交互卡顿）",{"type":26,"tag":44,"props":1227,"children":1228},{},[1229],{"type":31,"value":1230},"回滚方案可执行（知道回滚哪几个文件/commit）",{"type":26,"tag":44,"props":1232,"children":1233},{},[1234],{"type":31,"value":1235},"写下“这次改动解决了什么、风险是什么”（可贴 PR）",{"type":26,"tag":409,"props":1237,"children":1238},{},[],{"type":26,"tag":34,"props":1240,"children":1242},{"id":1241},"必交付物-2失败案例复盘真实会发生",[1243],{"type":31,"value":1244},"必交付物 2：失败案例复盘（真实会发生）",{"type":26,"tag":735,"props":1246,"children":1248},{"id":1247},"现象快捷键用得很熟但交付还是慢",[1249],{"type":31,"value":1250},"现象：快捷键用得很熟，但交付还是慢",{"type":26,"tag":27,"props":1252,"children":1253},{},[1254],{"type":31,"value":1255},"典型原因：你把 Cursor 当成“更聪明的搜索框”，不断对话，直到它给出你想要的答案。",{"type":26,"tag":27,"props":1257,"children":1258},{},[1259],{"type":31,"value":1260},"复现路径：",{"type":26,"tag":40,"props":1262,"children":1263},{},[1264,1269,1274,1279],{"type":26,"tag":44,"props":1265,"children":1266},{},[1267],{"type":31,"value":1268},"你直接说“把页面做得更好看、更高级”",{"type":26,"tag":44,"props":1270,"children":1271},{},[1272],{"type":31,"value":1273},"AI 开始大改样式、抽象组件、甚至引入新依赖",{"type":26,"tag":44,"props":1275,"children":1276},{},[1277],{"type":31,"value":1278},"你为了省事按了“接受建议”",{"type":26,"tag":44,"props":1280,"children":1281},{},[1282],{"type":31,"value":1283},"最后发现：设计没统一、移动端崩、甚至埋了性能问题",{"type":26,"tag":27,"props":1285,"children":1286},{},[1287,1289,1293,1295,1300],{"type":31,"value":1288},"根因：缺少",{"type":26,"tag":348,"props":1290,"children":1291},{},[1292],{"type":31,"value":473},{"type":31,"value":1294},"与",{"type":26,"tag":348,"props":1296,"children":1297},{},[1298],{"type":31,"value":1299},"验收",{"type":31,"value":169},{"type":26,"tag":27,"props":1302,"children":1303},{},[1304],{"type":31,"value":1305},"修复方式（可照抄）：",{"type":26,"tag":40,"props":1307,"children":1308},{},[1309,1314,1326],{"type":26,"tag":44,"props":1310,"children":1311},{},[1312],{"type":31,"value":1313},"把需求拆成 3 个可验证目标：例如“按钮样式统一”“首屏 CTA 更明显”“移动端间距不挤”",{"type":26,"tag":44,"props":1315,"children":1316},{},[1317,1319,1324],{"type":31,"value":1318},"每个目标只用 ",{"type":26,"tag":162,"props":1320,"children":1322},{"className":1321},[],[1323],{"type":31,"value":786},{"type":31,"value":1325}," 改一个局部",{"type":26,"tag":44,"props":1327,"children":1328},{},[1329],{"type":31,"value":1330},"每次接受建议前跑一遍“最小回归集”",{"type":26,"tag":409,"props":1332,"children":1333},{},[],{"type":26,"tag":34,"props":1335,"children":1337},{"id":1336},"faq高频问题",[1338],{"type":31,"value":1339},"FAQ（高频问题）",{"type":26,"tag":735,"props":1341,"children":1343},{"id":1342},"q1我应该先记快捷键还是先学工作流",[1344],{"type":31,"value":1345},"Q1：我应该先记快捷键还是先学工作流？",{"type":26,"tag":27,"props":1347,"children":1348},{},[1349],{"type":31,"value":1350},"先学工作流。快捷键只是把工作流的步骤变短。",{"type":26,"tag":735,"props":1352,"children":1354},{"id":1353},"q2为什么我一用多文件就容易翻车",[1355],{"type":31,"value":1356},"Q2：为什么我一用多文件就容易翻车？",{"type":26,"tag":27,"props":1358,"children":1359},{},[1360],{"type":31,"value":1361},"因为多文件意味着范围更大、依赖更多、验收更难。先锁定“文件清单 + 每步验收”，再让它动手。",{"type":26,"tag":735,"props":1363,"children":1365},{"id":1364},"q3有没有万能提示词",[1366],{"type":31,"value":1367},"Q3：有没有“万能提示词”？",{"type":26,"tag":27,"props":1369,"children":1370},{},[1371],{"type":31,"value":1372},"没有，但有“万能结构”：目标、范围、非目标、验收、输出格式。",{"type":26,"tag":409,"props":1374,"children":1375},{},[],{"type":26,"tag":34,"props":1377,"children":1379},{"id":1378},"延伸阅读建议按顺序",[1380],{"type":31,"value":1381},"延伸阅读（建议按顺序）",{"type":26,"tag":40,"props":1383,"children":1384},{},[1385,1392,1399,1406],{"type":26,"tag":44,"props":1386,"children":1387},{},[1388],{"type":26,"tag":253,"props":1389,"children":1390},{"href":382},[1391],{"type":31,"value":385},{"type":26,"tag":44,"props":1393,"children":1394},{},[1395],{"type":26,"tag":253,"props":1396,"children":1397},{"href":393},[1398],{"type":31,"value":396},{"type":26,"tag":44,"props":1400,"children":1401},{},[1402],{"type":26,"tag":253,"props":1403,"children":1404},{"href":404},[1405],{"type":31,"value":407},{"type":26,"tag":44,"props":1407,"children":1408},{},[1409,1411],{"type":31,"value":1410},"如果你更关心“网页制作落地”：看这篇 ",{"type":26,"tag":253,"props":1412,"children":1414},{"href":1413},"/topics/practical-tips/htmlpage-quick-landing-page",[1415],{"type":31,"value":1416},"3 分钟用 HTMLPAGE 做落地页",{"title":7,"searchDepth":278,"depth":278,"links":1418},[1419,1420,1421,1433,1434,1437,1442],{"id":414,"depth":281,"text":417},{"id":489,"depth":281,"text":492},{"id":730,"depth":281,"text":733,"children":1422},[1423,1424,1425,1426,1427,1428,1429,1430,1431,1432],{"id":737,"depth":278,"text":740},{"id":796,"depth":278,"text":799},{"id":866,"depth":278,"text":869},{"id":922,"depth":278,"text":925},{"id":962,"depth":278,"text":965},{"id":1001,"depth":278,"text":1004},{"id":1020,"depth":278,"text":1023},{"id":1062,"depth":278,"text":1065},{"id":1097,"depth":278,"text":1100},{"id":1114,"depth":278,"text":1117},{"id":1171,"depth":281,"text":1174},{"id":1241,"depth":281,"text":1244,"children":1435},[1436],{"id":1247,"depth":278,"text":1250},{"id":1336,"depth":281,"text":1339,"children":1438},[1439,1440,1441],{"id":1342,"depth":278,"text":1345},{"id":1353,"depth":278,"text":1356},{"id":1364,"depth":278,"text":1367},{"id":1378,"depth":281,"text":1381},"content:topics:ai:cursor-keyboard-shortcuts-cheatsheet.md","topics/ai/cursor-keyboard-shortcuts-cheatsheet.md","topics/ai/cursor-keyboard-shortcuts-cheatsheet",{"_path":1447,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1448,"description":1449,"date":1450,"topic":5,"author":11,"tags":1451,"image":1455,"imageAlt":1456,"pexelsPhotoId":1457,"pexelsUrl":1458,"readingTime":1459,"body":1460,"_type":285,"_id":2392,"_source":287,"_file":2393,"_stem":2394,"_extension":290},"/topics/ai/cursor-vs-copilot-vscode-workflow","Cursor vs GitHub Copilot vs VS Code：怎么选、怎么搭配、怎么把风险关在笼子里","用“任务类型×风险×验收成本”的选择矩阵解释 Cursor/Copilot/VS Code 的差异，并给出一套可落地的协作工作流（范围闸门、最小回归集、回滚策略）。","2026-03-01",[298,1452,301,1453,1454],"GitHub Copilot","AI 编程","工作流","/images/topics/ai/cursor-vs-copilot-vscode-workflow.jpg","团队在电脑前进行协作讨论",1181371,"https://www.pexels.com/photo/man-wearing-blue-dress-shirt-1181371/",15,{"type":23,"children":1461,"toc":2370},[1462,1467,1472,1490,1495,1513,1516,1522,1527,1558,1563,1566,1572,1580,1783,1791,1804,1807,1813,1819,1832,1837,1850,1856,1861,1894,1900,1905,1923,1926,1932,1937,1943,1948,1981,1987,2000,2005,2018,2024,2036,2042,2047,2060,2065,2068,2074,2079,2200,2203,2209,2219,2228,2246,2255,2263,2272,2290,2293,2299,2305,2310,2316,2321,2324,2329],{"type":26,"tag":27,"props":1463,"children":1464},{},[1465],{"type":31,"value":1466},"“Cursor 和 Copilot 到底有什么区别？”",{"type":26,"tag":27,"props":1468,"children":1469},{},[1470],{"type":31,"value":1471},"这个问题问得越早越好，因为你一旦把工具选错，后面所有痛苦都不是“提示词不够好”，而是：",{"type":26,"tag":40,"props":1473,"children":1474},{},[1475,1480,1485],{"type":26,"tag":44,"props":1476,"children":1477},{},[1478],{"type":31,"value":1479},"改动不可控（范围漂移、改错文件）",{"type":26,"tag":44,"props":1481,"children":1482},{},[1483],{"type":31,"value":1484},"验收成本爆炸（不知道要测什么）",{"type":26,"tag":44,"props":1486,"children":1487},{},[1488],{"type":31,"value":1489},"团队协作崩盘（没有闸门、没有回滚）",{"type":26,"tag":27,"props":1491,"children":1492},{},[1493],{"type":31,"value":1494},"这篇文章用一张选择矩阵 + 一套可执行工作流，帮你做到两件事：",{"type":26,"tag":339,"props":1496,"children":1497},{},[1498,1503],{"type":26,"tag":44,"props":1499,"children":1500},{},[1501],{"type":31,"value":1502},"知道什么时候用 Cursor、什么时候用 Copilot、什么时候“纯 VS Code 更快”",{"type":26,"tag":44,"props":1504,"children":1505},{},[1506,1508],{"type":31,"value":1507},"就算用 AI，也能把风险关在笼子里：",{"type":26,"tag":348,"props":1509,"children":1510},{},[1511],{"type":31,"value":1512},"可审查、可验证、可回滚",{"type":26,"tag":409,"props":1514,"children":1515},{},[],{"type":26,"tag":34,"props":1517,"children":1519},{"id":1518},"结论先说三者不是互斥而是分工",[1520],{"type":31,"value":1521},"结论先说：三者不是互斥，而是分工",{"type":26,"tag":27,"props":1523,"children":1524},{},[1525],{"type":31,"value":1526},"你可以把它们看成三层能力：",{"type":26,"tag":40,"props":1528,"children":1529},{},[1530,1539,1549],{"type":26,"tag":44,"props":1531,"children":1532},{},[1533,1537],{"type":26,"tag":348,"props":1534,"children":1535},{},[1536],{"type":31,"value":301},{"type":31,"value":1538},"：编辑器与生态（调试、插件、任务、终端、语言服务）",{"type":26,"tag":44,"props":1540,"children":1541},{},[1542,1547],{"type":26,"tag":348,"props":1543,"children":1544},{},[1545],{"type":31,"value":1546},"Copilot",{"type":31,"value":1548},"：代码补全与局部建议（“我正在写这一行/这一段”）",{"type":26,"tag":44,"props":1550,"children":1551},{},[1552,1556],{"type":26,"tag":348,"props":1553,"children":1554},{},[1555],{"type":31,"value":298},{"type":31,"value":1557},"：以项目为单位的 AI 协作（对话、索引、多文件编辑、规则）",{"type":26,"tag":27,"props":1559,"children":1560},{},[1561],{"type":31,"value":1562},"最常见的误区是：把“局部补全能力”当作“能做架构与多文件落地”。",{"type":26,"tag":409,"props":1564,"children":1565},{},[],{"type":26,"tag":34,"props":1567,"children":1569},{"id":1568},"选择矩阵按任务类型选工具不是按偏好",[1570],{"type":31,"value":1571},"选择矩阵：按任务类型选工具（不是按偏好）",{"type":26,"tag":717,"props":1573,"children":1574},{},[1575],{"type":26,"tag":27,"props":1576,"children":1577},{},[1578],{"type":31,"value":1579},"你只要把自己的任务放进表格，就能得到推荐路径。",{"type":26,"tag":70,"props":1581,"children":1582},{},[1583,1614],{"type":26,"tag":74,"props":1584,"children":1585},{},[1586],{"type":26,"tag":78,"props":1587,"children":1588},{},[1589,1594,1599,1604,1609],{"type":26,"tag":82,"props":1590,"children":1591},{},[1592],{"type":31,"value":1593},"任务类型",{"type":26,"tag":82,"props":1595,"children":1597},{"align":1596},"right",[1598],{"type":31,"value":96},{"type":26,"tag":82,"props":1600,"children":1601},{"align":1596},[1602],{"type":31,"value":1603},"验收成本",{"type":26,"tag":82,"props":1605,"children":1606},{},[1607],{"type":31,"value":1608},"更推荐",{"type":26,"tag":82,"props":1610,"children":1611},{},[1612],{"type":31,"value":1613},"为什么",{"type":26,"tag":98,"props":1615,"children":1616},{},[1617,1644,1677,1703,1730,1757],{"type":26,"tag":78,"props":1618,"children":1619},{},[1620,1625,1630,1634,1639],{"type":26,"tag":105,"props":1621,"children":1622},{},[1623],{"type":31,"value":1624},"写一段代码/补一个 if",{"type":26,"tag":105,"props":1626,"children":1627},{"align":1596},[1628],{"type":31,"value":1629},"低",{"type":26,"tag":105,"props":1631,"children":1632},{"align":1596},[1633],{"type":31,"value":1629},{"type":26,"tag":105,"props":1635,"children":1636},{},[1637],{"type":31,"value":1638},"Copilot / Cursor 内联编辑",{"type":26,"tag":105,"props":1640,"children":1641},{},[1642],{"type":31,"value":1643},"局部建议足够，成本最低",{"type":26,"tag":78,"props":1645,"children":1646},{},[1647,1652,1657,1661,1672],{"type":26,"tag":105,"props":1648,"children":1649},{},[1650],{"type":31,"value":1651},"重构一个函数",{"type":26,"tag":105,"props":1653,"children":1654},{"align":1596},[1655],{"type":31,"value":1656},"中",{"type":26,"tag":105,"props":1658,"children":1659},{"align":1596},[1660],{"type":31,"value":1656},{"type":26,"tag":105,"props":1662,"children":1663},{},[1664,1666],{"type":31,"value":1665},"Cursor ",{"type":26,"tag":162,"props":1667,"children":1669},{"className":1668},[],[1670],{"type":31,"value":1671},"内联编辑",{"type":26,"tag":105,"props":1673,"children":1674},{},[1675],{"type":31,"value":1676},"需要解释、需要约束输出",{"type":26,"tag":78,"props":1678,"children":1679},{},[1680,1685,1689,1693,1698],{"type":26,"tag":105,"props":1681,"children":1682},{},[1683],{"type":31,"value":1684},"改一个组件 + 样式",{"type":26,"tag":105,"props":1686,"children":1687},{"align":1596},[1688],{"type":31,"value":1656},{"type":26,"tag":105,"props":1690,"children":1691},{"align":1596},[1692],{"type":31,"value":1656},{"type":26,"tag":105,"props":1694,"children":1695},{},[1696],{"type":31,"value":1697},"Cursor（小范围多文件）",{"type":26,"tag":105,"props":1699,"children":1700},{},[1701],{"type":31,"value":1702},"需要同时改模板与样式",{"type":26,"tag":78,"props":1704,"children":1705},{},[1706,1711,1716,1720,1725],{"type":26,"tag":105,"props":1707,"children":1708},{},[1709],{"type":31,"value":1710},"改 3~5 个文件（组件+api+测试）",{"type":26,"tag":105,"props":1712,"children":1713},{"align":1596},[1714],{"type":31,"value":1715},"高",{"type":26,"tag":105,"props":1717,"children":1718},{"align":1596},[1719],{"type":31,"value":1715},{"type":26,"tag":105,"props":1721,"children":1722},{},[1723],{"type":31,"value":1724},"Cursor Composer + 闸门",{"type":26,"tag":105,"props":1726,"children":1727},{},[1728],{"type":31,"value":1729},"需要计划、验收、回滚",{"type":26,"tag":78,"props":1731,"children":1732},{},[1733,1738,1743,1747,1752],{"type":26,"tag":105,"props":1734,"children":1735},{},[1736],{"type":31,"value":1737},"重写一段架构/引入新依赖",{"type":26,"tag":105,"props":1739,"children":1740},{"align":1596},[1741],{"type":31,"value":1742},"很高",{"type":26,"tag":105,"props":1744,"children":1745},{"align":1596},[1746],{"type":31,"value":1742},{"type":26,"tag":105,"props":1748,"children":1749},{},[1750],{"type":31,"value":1751},"先人脑设计 + VS Code 实现",{"type":26,"tag":105,"props":1753,"children":1754},{},[1755],{"type":31,"value":1756},"AI 易发散，最好先设计再执行",{"type":26,"tag":78,"props":1758,"children":1759},{},[1760,1765,1769,1773,1778],{"type":26,"tag":105,"props":1761,"children":1762},{},[1763],{"type":31,"value":1764},"排查线上问题/性能抖动",{"type":26,"tag":105,"props":1766,"children":1767},{"align":1596},[1768],{"type":31,"value":1715},{"type":26,"tag":105,"props":1770,"children":1771},{"align":1596},[1772],{"type":31,"value":1742},{"type":26,"tag":105,"props":1774,"children":1775},{},[1776],{"type":31,"value":1777},"VS Code + 工具链优先，AI 辅助归纳",{"type":26,"tag":105,"props":1779,"children":1780},{},[1781],{"type":31,"value":1782},"需要证据，不要“猜”",{"type":26,"tag":27,"props":1784,"children":1785},{},[1786],{"type":26,"tag":348,"props":1787,"children":1788},{},[1789],{"type":31,"value":1790},"一句话规则：",{"type":26,"tag":40,"props":1792,"children":1793},{},[1794,1799],{"type":26,"tag":44,"props":1795,"children":1796},{},[1797],{"type":31,"value":1798},"当你的改动可以用“10 条最小回归集”覆盖时，用 Cursor。",{"type":26,"tag":44,"props":1800,"children":1801},{},[1802],{"type":31,"value":1803},"当你的改动无法验证时，先别让 AI 动手。",{"type":26,"tag":409,"props":1805,"children":1806},{},[],{"type":26,"tag":34,"props":1808,"children":1810},{"id":1809},"差异拆解到底差在哪里",[1811],{"type":31,"value":1812},"差异拆解：到底差在哪里？",{"type":26,"tag":735,"props":1814,"children":1816},{"id":1815},"_1-上下文来源补全-vs-项目索引",[1817],{"type":31,"value":1818},"1) 上下文来源：补全 vs 项目索引",{"type":26,"tag":40,"props":1820,"children":1821},{},[1822,1827],{"type":26,"tag":44,"props":1823,"children":1824},{},[1825],{"type":31,"value":1826},"Copilot 更擅长：你正在写的这几行、当前文件的局部上下文",{"type":26,"tag":44,"props":1828,"children":1829},{},[1830],{"type":31,"value":1831},"Cursor 更擅长：项目级索引 + 多文件关联理解",{"type":26,"tag":27,"props":1833,"children":1834},{},[1835],{"type":31,"value":1836},"因此：",{"type":26,"tag":40,"props":1838,"children":1839},{},[1840,1845],{"type":26,"tag":44,"props":1841,"children":1842},{},[1843],{"type":31,"value":1844},"写代码片段：Copilot 速度更快",{"type":26,"tag":44,"props":1846,"children":1847},{},[1848],{"type":31,"value":1849},"改一坨工程：Cursor 更有胜算（但更需要闸门）",{"type":26,"tag":735,"props":1851,"children":1853},{"id":1852},"_2-交互方式你能不能控制范围",[1854],{"type":31,"value":1855},"2) 交互方式：你能不能控制范围",{"type":26,"tag":27,"props":1857,"children":1858},{},[1859],{"type":31,"value":1860},"范围控制的三个层级：",{"type":26,"tag":339,"props":1862,"children":1863},{},[1864,1874,1884],{"type":26,"tag":44,"props":1865,"children":1866},{},[1867,1869],{"type":31,"value":1868},"内联编辑（选中一段）→ ",{"type":26,"tag":348,"props":1870,"children":1871},{},[1872],{"type":31,"value":1873},"最强范围控制",{"type":26,"tag":44,"props":1875,"children":1876},{},[1877,1879],{"type":31,"value":1878},"Composer 多文件（先列文件清单）→ ",{"type":26,"tag":348,"props":1880,"children":1881},{},[1882],{"type":31,"value":1883},"可控但要闸门",{"type":26,"tag":44,"props":1885,"children":1886},{},[1887,1889],{"type":31,"value":1888},"大对话（泛目标）→ ",{"type":26,"tag":348,"props":1890,"children":1891},{},[1892],{"type":31,"value":1893},"最容易跑偏",{"type":26,"tag":735,"props":1895,"children":1897},{"id":1896},"_3-输出形态建议-vs-可审查的变更",[1898],{"type":31,"value":1899},"3) 输出形态：建议 vs 可审查的变更",{"type":26,"tag":27,"props":1901,"children":1902},{},[1903],{"type":31,"value":1904},"最好的 AI 输出不是“给我一段代码”，而是：",{"type":26,"tag":40,"props":1906,"children":1907},{},[1908,1913,1918],{"type":26,"tag":44,"props":1909,"children":1910},{},[1911],{"type":31,"value":1912},"改动摘要（做了什么）",{"type":26,"tag":44,"props":1914,"children":1915},{},[1916],{"type":31,"value":1917},"diff 级别的可审查变更",{"type":26,"tag":44,"props":1919,"children":1920},{},[1921],{"type":31,"value":1922},"验收步骤与回滚方案",{"type":26,"tag":409,"props":1924,"children":1925},{},[],{"type":26,"tag":34,"props":1927,"children":1929},{"id":1928},"一套可落地的团队工作流把风险关住",[1930],{"type":31,"value":1931},"一套可落地的团队工作流（把风险关住）",{"type":26,"tag":27,"props":1933,"children":1934},{},[1935],{"type":31,"value":1936},"下面这套流程，你可以直接写进团队规范：",{"type":26,"tag":735,"props":1938,"children":1940},{"id":1939},"step-1先写任务单geo-友好结构",[1941],{"type":31,"value":1942},"Step 1：先写任务单（GEO 友好结构）",{"type":26,"tag":27,"props":1944,"children":1945},{},[1946],{"type":31,"value":1947},"模板：",{"type":26,"tag":40,"props":1949,"children":1950},{},[1951,1956,1961,1966,1971,1976],{"type":26,"tag":44,"props":1952,"children":1953},{},[1954],{"type":31,"value":1955},"目标：……",{"type":26,"tag":44,"props":1957,"children":1958},{},[1959],{"type":31,"value":1960},"背景：……",{"type":26,"tag":44,"props":1962,"children":1963},{},[1964],{"type":31,"value":1965},"范围：只改这些文件/模块：……",{"type":26,"tag":44,"props":1967,"children":1968},{},[1969],{"type":31,"value":1970},"非目标：不做哪些事情：……",{"type":26,"tag":44,"props":1972,"children":1973},{},[1974],{"type":31,"value":1975},"验收：如何判断完成（可测试/可观察）：……",{"type":26,"tag":44,"props":1977,"children":1978},{},[1979],{"type":31,"value":1980},"回滚：如果失败怎么撤回：……",{"type":26,"tag":735,"props":1982,"children":1984},{"id":1983},"step-2用范围闸门限制-ai",[1985],{"type":31,"value":1986},"Step 2：用“范围闸门”限制 AI",{"type":26,"tag":40,"props":1988,"children":1989},{},[1990,1995],{"type":26,"tag":44,"props":1991,"children":1992},{},[1993],{"type":31,"value":1994},"单文件改动：优先 Cursor 内联编辑",{"type":26,"tag":44,"props":1996,"children":1997},{},[1998],{"type":31,"value":1999},"多文件改动：必须先让 AI 输出“文件清单（≤5）+ 每步验收”",{"type":26,"tag":27,"props":2001,"children":2002},{},[2003],{"type":31,"value":2004},"如果 AI 输出的文件清单超过 5 个：",{"type":26,"tag":40,"props":2006,"children":2007},{},[2008,2013],{"type":26,"tag":44,"props":2009,"children":2010},{},[2011],{"type":31,"value":2012},"不是它太强，是任务太大",{"type":26,"tag":44,"props":2014,"children":2015},{},[2016],{"type":31,"value":2017},"你需要拆任务，而不是继续推进",{"type":26,"tag":735,"props":2019,"children":2021},{"id":2020},"step-3最小回归集10-条",[2022],{"type":31,"value":2023},"Step 3：最小回归集（10 条）",{"type":26,"tag":27,"props":2025,"children":2026},{},[2027,2029,2034],{"type":31,"value":2028},"每次接受改动前必须跑（可参考：",{"type":26,"tag":253,"props":2030,"children":2031},{"href":293},[2032],{"type":31,"value":2033},"Cursor 快捷键速查表",{"type":31,"value":2035}," 里的清单）。",{"type":26,"tag":735,"props":2037,"children":2039},{"id":2038},"step-4回滚策略不用等事故才想",[2040],{"type":31,"value":2041},"Step 4：回滚策略（不用等事故才想）",{"type":26,"tag":27,"props":2043,"children":2044},{},[2045],{"type":31,"value":2046},"回滚最常见的两条路：",{"type":26,"tag":40,"props":2048,"children":2049},{},[2050,2055],{"type":26,"tag":44,"props":2051,"children":2052},{},[2053],{"type":31,"value":2054},"git 回滚 commit",{"type":26,"tag":44,"props":2056,"children":2057},{},[2058],{"type":31,"value":2059},"对关键文件保留前版本（至少能快速恢复）",{"type":26,"tag":27,"props":2061,"children":2062},{},[2063],{"type":31,"value":2064},"你需要做到：任何一轮 AI 改动都能在 5 分钟内撤回。",{"type":26,"tag":409,"props":2066,"children":2067},{},[],{"type":26,"tag":34,"props":2069,"children":2071},{"id":2070},"必交付物对比矩阵可复制",[2072],{"type":31,"value":2073},"必交付物：对比矩阵（可复制）",{"type":26,"tag":27,"props":2075,"children":2076},{},[2077],{"type":31,"value":2078},"下面这张表可以直接贴到你的团队 wiki：",{"type":26,"tag":70,"props":2080,"children":2081},{},[2082,2105],{"type":26,"tag":74,"props":2083,"children":2084},{},[2085],{"type":26,"tag":78,"props":2086,"children":2087},{},[2088,2093,2097,2101],{"type":26,"tag":82,"props":2089,"children":2090},{},[2091],{"type":31,"value":2092},"维度",{"type":26,"tag":82,"props":2094,"children":2095},{},[2096],{"type":31,"value":301},{"type":26,"tag":82,"props":2098,"children":2099},{},[2100],{"type":31,"value":1546},{"type":26,"tag":82,"props":2102,"children":2103},{},[2104],{"type":31,"value":298},{"type":26,"tag":98,"props":2106,"children":2107},{},[2108,2131,2154,2177],{"type":26,"tag":78,"props":2109,"children":2110},{},[2111,2116,2121,2126],{"type":26,"tag":105,"props":2112,"children":2113},{},[2114],{"type":31,"value":2115},"强项",{"type":26,"tag":105,"props":2117,"children":2118},{},[2119],{"type":31,"value":2120},"工具链、调试、生态",{"type":26,"tag":105,"props":2122,"children":2123},{},[2124],{"type":31,"value":2125},"补全与局部建议",{"type":26,"tag":105,"props":2127,"children":2128},{},[2129],{"type":31,"value":2130},"项目上下文、多文件落地",{"type":26,"tag":78,"props":2132,"children":2133},{},[2134,2139,2144,2149],{"type":26,"tag":105,"props":2135,"children":2136},{},[2137],{"type":31,"value":2138},"适合任务",{"type":26,"tag":105,"props":2140,"children":2141},{},[2142],{"type":31,"value":2143},"排查、调试、验证",{"type":26,"tag":105,"props":2145,"children":2146},{},[2147],{"type":31,"value":2148},"写一段、补一段",{"type":26,"tag":105,"props":2150,"children":2151},{},[2152],{"type":31,"value":2153},"改一段、改一组文件",{"type":26,"tag":78,"props":2155,"children":2156},{},[2157,2162,2167,2172],{"type":26,"tag":105,"props":2158,"children":2159},{},[2160],{"type":31,"value":2161},"最大风险",{"type":26,"tag":105,"props":2163,"children":2164},{},[2165],{"type":31,"value":2166},"无",{"type":26,"tag":105,"props":2168,"children":2169},{},[2170],{"type":31,"value":2171},"过度依赖建议",{"type":26,"tag":105,"props":2173,"children":2174},{},[2175],{"type":31,"value":2176},"范围漂移、多文件回归",{"type":26,"tag":78,"props":2178,"children":2179},{},[2180,2185,2190,2195],{"type":26,"tag":105,"props":2181,"children":2182},{},[2183],{"type":31,"value":2184},"必须搭配",{"type":26,"tag":105,"props":2186,"children":2187},{},[2188],{"type":31,"value":2189},"规范与检查",{"type":26,"tag":105,"props":2191,"children":2192},{},[2193],{"type":31,"value":2194},"代码评审",{"type":26,"tag":105,"props":2196,"children":2197},{},[2198],{"type":31,"value":2199},"闸门 + 最小回归集",{"type":26,"tag":409,"props":2201,"children":2202},{},[],{"type":26,"tag":34,"props":2204,"children":2206},{"id":2205},"失败案例多文件看似成功实际埋雷",[2207],{"type":31,"value":2208},"失败案例：多文件“看似成功”，实际埋雷",{"type":26,"tag":27,"props":2210,"children":2211},{},[2212,2217],{"type":26,"tag":348,"props":2213,"children":2214},{},[2215],{"type":31,"value":2216},"现象",{"type":31,"value":2218},"：AI 说“我已经把所有地方都改了”，你也接受了，结果上线后 404 或样式错位。",{"type":26,"tag":27,"props":2220,"children":2221},{},[2222,2227],{"type":26,"tag":348,"props":2223,"children":2224},{},[2225],{"type":31,"value":2226},"复现条件",{"type":31,"value":1041},{"type":26,"tag":40,"props":2229,"children":2230},{},[2231,2236,2241],{"type":26,"tag":44,"props":2232,"children":2233},{},[2234],{"type":31,"value":2235},"你给了一个大目标（例如“把所有按钮统一成主题色”）",{"type":26,"tag":44,"props":2237,"children":2238},{},[2239],{"type":31,"value":2240},"它改了组件、样式、甚至主题配置",{"type":26,"tag":44,"props":2242,"children":2243},{},[2244],{"type":31,"value":2245},"你没有按页面模块走一遍，直接合并",{"type":26,"tag":27,"props":2247,"children":2248},{},[2249,2254],{"type":26,"tag":348,"props":2250,"children":2251},{},[2252],{"type":31,"value":2253},"根因",{"type":31,"value":1041},{"type":26,"tag":40,"props":2256,"children":2257},{},[2258],{"type":26,"tag":44,"props":2259,"children":2260},{},[2261],{"type":31,"value":2262},"改动范围大，但验收仍按“小改动”的方式做（只看一处）",{"type":26,"tag":27,"props":2264,"children":2265},{},[2266,2271],{"type":26,"tag":348,"props":2267,"children":2268},{},[2269],{"type":31,"value":2270},"修复",{"type":31,"value":1041},{"type":26,"tag":40,"props":2273,"children":2274},{},[2275,2280,2285],{"type":26,"tag":44,"props":2276,"children":2277},{},[2278],{"type":31,"value":2279},"强制把任务拆成“模块级目标”：Hero、Feature、Pricing、Form",{"type":26,"tag":44,"props":2281,"children":2282},{},[2283],{"type":31,"value":2284},"每个模块改完就验收一次",{"type":26,"tag":44,"props":2286,"children":2287},{},[2288],{"type":31,"value":2289},"验收通过再进入下一个模块",{"type":26,"tag":409,"props":2291,"children":2292},{},[],{"type":26,"tag":34,"props":2294,"children":2296},{"id":2295},"faq",[2297],{"type":31,"value":2298},"FAQ",{"type":26,"tag":735,"props":2300,"children":2302},{"id":2301},"q1我已经用了-cursor为什么还要用-copilot",[2303],{"type":31,"value":2304},"Q1：我已经用了 Cursor，为什么还要用 Copilot？",{"type":26,"tag":27,"props":2306,"children":2307},{},[2308],{"type":31,"value":2309},"因为“补全”这种高频低风险任务，Copilot 的交互成本更低；Cursor 更适合需要解释与约束的改动。",{"type":26,"tag":735,"props":2311,"children":2313},{"id":2312},"q2什么时候应该完全不用-ai",[2314],{"type":31,"value":2315},"Q2：什么时候应该完全不用 AI？",{"type":26,"tag":27,"props":2317,"children":2318},{},[2319],{"type":31,"value":2320},"当你无法定义验收标准时。比如“更高级”“更好看”这种目标，先做信息结构与设计规则，再让 AI 帮你落地局部。",{"type":26,"tag":409,"props":2322,"children":2323},{},[],{"type":26,"tag":34,"props":2325,"children":2327},{"id":2326},"延伸阅读",[2328],{"type":31,"value":2326},{"type":26,"tag":40,"props":2330,"children":2331},{},[2332,2341,2350,2359],{"type":26,"tag":44,"props":2333,"children":2334},{},[2335,2337],{"type":31,"value":2336},"Cursor 入门：",{"type":26,"tag":253,"props":2338,"children":2339},{"href":382},[2340],{"type":31,"value":385},{"type":26,"tag":44,"props":2342,"children":2343},{},[2344,2346],{"type":31,"value":2345},"Cursor 进阶：",{"type":26,"tag":253,"props":2347,"children":2348},{"href":393},[2349],{"type":31,"value":396},{"type":26,"tag":44,"props":2351,"children":2352},{},[2353,2355],{"type":31,"value":2354},"规则配置：",{"type":26,"tag":253,"props":2356,"children":2357},{"href":404},[2358],{"type":31,"value":407},{"type":26,"tag":44,"props":2360,"children":2361},{},[2362,2364],{"type":31,"value":2363},"Copilot 实战：",{"type":26,"tag":253,"props":2365,"children":2367},{"href":2366},"/topics/ai/github-copilot-tips",[2368],{"type":31,"value":2369},"GitHub Copilot 实用技巧",{"title":7,"searchDepth":278,"depth":278,"links":2371},[2372,2373,2374,2379,2385,2386,2387,2391],{"id":1518,"depth":281,"text":1521},{"id":1568,"depth":281,"text":1571},{"id":1809,"depth":281,"text":1812,"children":2375},[2376,2377,2378],{"id":1815,"depth":278,"text":1818},{"id":1852,"depth":278,"text":1855},{"id":1896,"depth":278,"text":1899},{"id":1928,"depth":281,"text":1931,"children":2380},[2381,2382,2383,2384],{"id":1939,"depth":278,"text":1942},{"id":1983,"depth":278,"text":1986},{"id":2020,"depth":278,"text":2023},{"id":2038,"depth":278,"text":2041},{"id":2070,"depth":281,"text":2073},{"id":2205,"depth":281,"text":2208},{"id":2295,"depth":281,"text":2298,"children":2388},[2389,2390],{"id":2301,"depth":278,"text":2304},{"id":2312,"depth":278,"text":2315},{"id":2326,"depth":281,"text":2326},"content:topics:ai:cursor-vs-copilot-vscode-workflow.md","topics/ai/cursor-vs-copilot-vscode-workflow.md","topics/ai/cursor-vs-copilot-vscode-workflow",{"_path":2396,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":2397,"description":2398,"date":2399,"topic":5,"author":11,"tags":2400,"image":2405,"featured":200,"readingTime":1459,"body":2406,"_type":285,"_id":3055,"_source":287,"_file":3056,"_stem":3057,"_extension":290},"/topics/ai/ai-debugging-troubleshooting-guide","AI 辅助调试与问题排查：让 AI 成为你的调试搭档","深入探讨如何利用 AI 工具提升调试效率，包括错误信息分析、日志解读、性能问题定位、复杂 bug 排查等实战场景，构建 AI 驱动的调试工作流。","2026-01-18",[2401,2402,2403,302,2404],"AI 调试","问题排查","Debug","错误处理","/images/topics/ai/ai-debugging-guide.jpg",{"type":23,"children":2407,"toc":3026},[2408,2414,2420,2425,2430,2435,2441,2447,2452,2460,2488,2496,2519,2525,2536,2545,2553,2561,2594,2602,2632,2645,2653,2658,2666,2674,2685,2691,2699,2710,2718,2727,2733,2739,2744,2753,2759,2764,2773,2779,2785,2794,2800,2809,2815,2826,2832,2838,2847,2853,2862,2868,2874,2882,2888,2897,2905,2913,2916,2922,2927,2946,2958,2961,2967,2972,2981,2986,2989,2995,3000,3018],{"type":26,"tag":34,"props":2409,"children":2411},{"id":2410},"ai-辅助调试与问题排查",[2412],{"type":31,"value":2413},"AI 辅助调试与问题排查",{"type":26,"tag":34,"props":2415,"children":2417},{"id":2416},"引言调试的痛与-ai-的解药",[2418],{"type":31,"value":2419},"引言：调试的痛与 AI 的解药",{"type":26,"tag":27,"props":2421,"children":2422},{},[2423],{"type":31,"value":2424},"调试是每个程序员的日常，也是最消耗时间和精力的工作之一。我们都有过这样的经历：盯着一个莫名其妙的错误信息，翻遍 Stack Overflow，尝试各种方案，几个小时后才发现是一个愚蠢的拼写错误。",{"type":26,"tag":27,"props":2426,"children":2427},{},[2428],{"type":31,"value":2429},"AI 工具的出现，正在改变调试的方式。不是替代你的思考，而是加速你的分析过程——帮你快速理解错误、缩小排查范围、验证假设。",{"type":26,"tag":27,"props":2431,"children":2432},{},[2433],{"type":31,"value":2434},"这篇文章分享我在实际项目中使用 AI 辅助调试的经验和方法论。",{"type":26,"tag":34,"props":2436,"children":2438},{"id":2437},"第一部分建立-ai-调试的思维模型",[2439],{"type":31,"value":2440},"第一部分：建立 AI 调试的思维模型",{"type":26,"tag":735,"props":2442,"children":2444},{"id":2443},"_11-ai-在调试中的角色",[2445],{"type":31,"value":2446},"1.1 AI 在调试中的角色",{"type":26,"tag":27,"props":2448,"children":2449},{},[2450],{"type":31,"value":2451},"把 AI 想象成一个经验丰富但不了解你项目的高级工程师。它：",{"type":26,"tag":27,"props":2453,"children":2454},{},[2455],{"type":26,"tag":348,"props":2456,"children":2457},{},[2458],{"type":31,"value":2459},"擅长的事情：",{"type":26,"tag":40,"props":2461,"children":2462},{},[2463,2468,2473,2478,2483],{"type":26,"tag":44,"props":2464,"children":2465},{},[2466],{"type":31,"value":2467},"解读错误信息的含义",{"type":26,"tag":44,"props":2469,"children":2470},{},[2471],{"type":31,"value":2472},"提供可能的原因列表",{"type":26,"tag":44,"props":2474,"children":2475},{},[2476],{"type":31,"value":2477},"给出排查方向建议",{"type":26,"tag":44,"props":2479,"children":2480},{},[2481],{"type":31,"value":2482},"解释复杂的技术概念",{"type":26,"tag":44,"props":2484,"children":2485},{},[2486],{"type":31,"value":2487},"生成调试代码片段",{"type":26,"tag":27,"props":2489,"children":2490},{},[2491],{"type":26,"tag":348,"props":2492,"children":2493},{},[2494],{"type":31,"value":2495},"不擅长的事情：",{"type":26,"tag":40,"props":2497,"children":2498},{},[2499,2504,2509,2514],{"type":26,"tag":44,"props":2500,"children":2501},{},[2502],{"type":31,"value":2503},"了解你的业务逻辑",{"type":26,"tag":44,"props":2505,"children":2506},{},[2507],{"type":31,"value":2508},"知道你的代码历史",{"type":26,"tag":44,"props":2510,"children":2511},{},[2512],{"type":31,"value":2513},"理解项目特定的约定",{"type":26,"tag":44,"props":2515,"children":2516},{},[2517],{"type":31,"value":2518},"做出架构级判断",{"type":26,"tag":735,"props":2520,"children":2522},{"id":2521},"_12-有效提问的结构",[2523],{"type":31,"value":2524},"1.2 有效提问的结构",{"type":26,"tag":2526,"props":2527,"children":2531},"pre",{"code":2528,"language":285,"meta":7,"className":2529},"## 高效的调试提问模板\n\n**问题描述**\n[简洁描述遇到的问题]\n\n**错误信息**\n",[2530],"language-markdown",[2532],{"type":26,"tag":162,"props":2533,"children":2534},{"__ignoreMap":7},[2535],{"type":31,"value":2528},{"type":26,"tag":27,"props":2537,"children":2538},{},[2539],{"type":26,"tag":2540,"props":2541,"children":2542},"span",{},[2543],{"type":31,"value":2544},"完整的错误信息，不要截断",{"type":26,"tag":2526,"props":2546,"children":2548},{"code":2547},"\n**相关代码**\n```javascript\n[精简但完整的相关代码]\n",[2549],{"type":26,"tag":162,"props":2550,"children":2551},{"__ignoreMap":7},[2552],{"type":31,"value":2547},{"type":26,"tag":27,"props":2554,"children":2555},{},[2556],{"type":26,"tag":348,"props":2557,"children":2558},{},[2559],{"type":31,"value":2560},"环境信息",{"type":26,"tag":40,"props":2562,"children":2563},{},[2564,2574,2584],{"type":26,"tag":44,"props":2565,"children":2566},{},[2567,2569],{"type":31,"value":2568},"运行环境：",{"type":26,"tag":2540,"props":2570,"children":2571},{},[2572],{"type":31,"value":2573},"Node 版本/浏览器版本",{"type":26,"tag":44,"props":2575,"children":2576},{},[2577,2579],{"type":31,"value":2578},"框架版本：",{"type":26,"tag":2540,"props":2580,"children":2581},{},[2582],{"type":31,"value":2583},"相关框架版本",{"type":26,"tag":44,"props":2585,"children":2586},{},[2587,2589],{"type":31,"value":2588},"操作系统：",{"type":26,"tag":2540,"props":2590,"children":2591},{},[2592],{"type":31,"value":2593},"如果相关",{"type":26,"tag":27,"props":2595,"children":2596},{},[2597],{"type":26,"tag":348,"props":2598,"children":2599},{},[2600],{"type":31,"value":2601},"已尝试的方案",{"type":26,"tag":40,"props":2603,"children":2604},{},[2605,2619],{"type":26,"tag":44,"props":2606,"children":2607},{},[2608,2613,2614],{"type":26,"tag":2540,"props":2609,"children":2610},{},[2611],{"type":31,"value":2612},"方案1",{"type":31,"value":1041},{"type":26,"tag":2540,"props":2615,"children":2616},{},[2617],{"type":31,"value":2618},"结果",{"type":26,"tag":44,"props":2620,"children":2621},{},[2622,2627,2628],{"type":26,"tag":2540,"props":2623,"children":2624},{},[2625],{"type":31,"value":2626},"方案2",{"type":31,"value":1041},{"type":26,"tag":2540,"props":2629,"children":2630},{},[2631],{"type":31,"value":2618},{"type":26,"tag":27,"props":2633,"children":2634},{},[2635,2640],{"type":26,"tag":348,"props":2636,"children":2637},{},[2638],{"type":31,"value":2639},"期望的结果",{"type":26,"tag":2540,"props":2641,"children":2642},{},[2643],{"type":31,"value":2644},"描述期望的行为",{"type":26,"tag":2526,"props":2646,"children":2648},{"code":2647},"\n### 1.3 分级调试策略\n\n",[2649],{"type":26,"tag":162,"props":2650,"children":2651},{"__ignoreMap":7},[2652],{"type":31,"value":2647},{"type":26,"tag":27,"props":2654,"children":2655},{},[2656],{"type":31,"value":2657},"┌───────────────────────────────────────────────────────────┐\n│                    AI 辅助调试决策树                        │\n├───────────────────────────────────────────────────────────┤\n│                                                           │\n│  Level 1：简单错误（5分钟内解决）                           │\n│  ├── 语法错误、拼写错误                                    │\n│  ├── 方法：直接复制错误信息给 AI                           │\n│  └── 工具：Copilot Chat / ChatGPT                        │\n│                                                           │\n│  Level 2：中等复杂度（30分钟内解决）                        │\n│  ├── 类型错误、逻辑错误、API 使用错误                      │\n│  ├── 方法：提供错误信息 + 相关代码 + 上下文                 │\n│  └── 工具：Cursor Chat / Claude                          │\n│                                                           │\n│  Level 3：复杂问题（需要深入分析）                          │\n│  ├── 竞态条件、内存泄漏、性能问题                          │\n│  ├── 方法：详细描述场景 + 提供多个文件 + 讨论               │\n│  └── 工具：Cursor Composer / 专门的 AI 会话                │\n│                                                           │\n│  Level 4：架构级问题                                       │\n│  ├── 设计缺陷、技术债务                                    │\n│  ├── 方法：AI 辅助分析 + 人工判断                          │\n│  └── 工具：与团队讨论 + AI 作为顾问                        │\n│                                                           │\n└───────────────────────────────────────────────────────────┘",{"type":26,"tag":2526,"props":2659,"children":2661},{"code":2660},"\n## 第二部分：错误信息分析\n\n### 2.1 前端错误分析\n\n**场景 1：React 错误边界触发**\n\n```typescript\n// 错误信息：\n// Error: Hydration failed because the initial UI does not match \n// what was rendered on the server.\n\n// 提问方式：\n/**\n * 我在 Next.js 14 App Router 项目中遇到这个错误：\n * \n * Error: Hydration failed because the initial UI does not match \n * what was rendered on the server.\n * \n * 相关代码：\n */\nfunction UserStatus() {\n  const [isLoggedIn, setIsLoggedIn] = useState(false);\n  \n  useEffect(() => {\n    setIsLoggedIn(localStorage.getItem('token') !== null);\n  }, []);\n  \n  return \u003Cdiv>{isLoggedIn ? '已登录' : '未登录'}\u003C/div>;\n}\n\n// AI 会分析出：\n// 1. 服务端渲染时 localStorage 不可用，默认 false\n// 2. 客户端 hydration 时可能是 true\n// 3. 导致服务端和客户端渲染结果不一致\n\n// AI 建议的解决方案：\nfunction UserStatus() {\n  const [isLoggedIn, setIsLoggedIn] = useState\u003Cboolean | null>(null);\n  \n  useEffect(() => {\n    setIsLoggedIn(localStorage.getItem('token') !== null);\n  }, []);\n  \n  // 初始状态显示加载中，避免 hydration 不匹配\n  if (isLoggedIn === null) {\n    return \u003Cdiv>加载中...\u003C/div>;\n  }\n  \n  return \u003Cdiv>{isLoggedIn ? '已登录' : '未登录'}\u003C/div>;\n}\n",[2662],{"type":26,"tag":162,"props":2663,"children":2664},{"__ignoreMap":7},[2665],{"type":31,"value":2660},{"type":26,"tag":27,"props":2667,"children":2668},{},[2669],{"type":26,"tag":348,"props":2670,"children":2671},{},[2672],{"type":31,"value":2673},"场景 2：Vue 响应式警告",{"type":26,"tag":2526,"props":2675,"children":2680},{"code":2676,"language":2677,"meta":7,"className":2678},"// 警告信息：\n// [Vue warn]: Property \"xxx\" was accessed during render but is not \n// defined on instance.\n\n// 提问方式：\n/**\n * Vue 3 项目中出现这个警告：\n * [Vue warn]: Property \"userInfo\" was accessed during render \n * but is not defined on instance.\n * \n * 组件代码：\n */\n\u003Ctemplate>\n  \u003Cdiv>{{ userInfo.name }}\u003C/div>\n\u003C/template>\n\n\u003Cscript setup>\nconst { data: userInfo } = await useFetch('/api/user');\n\u003C/script>\n\n// AI 分析：\n// 1. useFetch 是异步的，初始渲染时 userInfo 可能是 undefined\n// 2. 直接访问 userInfo.name 会报错\n\n// AI 建议：\n\u003Ctemplate>\n  \u003Cdiv v-if=\"userInfo\">{{ userInfo.name }}\u003C/div>\n  \u003Cdiv v-else>加载中...\u003C/div>\n\u003C/template>\n\n\u003Cscript setup>\nconst { data: userInfo, pending } = await useFetch('/api/user');\n\u003C/script>\n","typescript",[2679],"language-typescript",[2681],{"type":26,"tag":162,"props":2682,"children":2683},{"__ignoreMap":7},[2684],{"type":31,"value":2676},{"type":26,"tag":735,"props":2686,"children":2688},{"id":2687},"_22-后端错误分析",[2689],{"type":31,"value":2690},"2.2 后端错误分析",{"type":26,"tag":27,"props":2692,"children":2693},{},[2694],{"type":26,"tag":348,"props":2695,"children":2696},{},[2697],{"type":31,"value":2698},"场景 1：Node.js 内存问题",{"type":26,"tag":2526,"props":2700,"children":2705},{"code":2701,"language":2702,"meta":7,"className":2703},"// 错误信息：\n// FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - \n// JavaScript heap out of memory\n\n// 提问方式（包含上下文）：\n/**\n * Node.js 服务运行几小时后崩溃，错误信息：\n * FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - \n * JavaScript heap out of memory\n * \n * 服务功能：处理 CSV 文件上传，每次约 100MB\n * \n * 处理代码：\n */\nasync function processCSV(filePath) {\n  const content = fs.readFileSync(filePath, 'utf-8');\n  const rows = content.split('\\n');\n  const results = [];\n  \n  for (const row of rows) {\n    const processed = await processRow(row);\n    results.push(processed);\n  }\n  \n  return results;\n}\n\n// AI 分析会指出：\n// 1. 一次性读取整个文件到内存\n// 2. 所有处理结果累积在 results 数组\n// 3. 建议使用流式处理\n\n// AI 提供的优化方案：\nconst { createReadStream } = require('fs');\nconst { createInterface } = require('readline');\n\nasync function processCSVStream(filePath, onRow) {\n  const fileStream = createReadStream(filePath);\n  const rl = createInterface({\n    input: fileStream,\n    crlfDelay: Infinity\n  });\n  \n  let count = 0;\n  for await (const line of rl) {\n    await onRow(line);\n    count++;\n    \n    // 每处理 1000 行，给 GC 机会运行\n    if (count % 1000 === 0) {\n      await new Promise(r => setImmediate(r));\n    }\n  }\n}\n","javascript",[2704],"language-javascript",[2706],{"type":26,"tag":162,"props":2707,"children":2708},{"__ignoreMap":7},[2709],{"type":31,"value":2701},{"type":26,"tag":27,"props":2711,"children":2712},{},[2713],{"type":26,"tag":348,"props":2714,"children":2715},{},[2716],{"type":31,"value":2717},"场景 2：数据库连接问题",{"type":26,"tag":2526,"props":2719,"children":2722},{"code":2720,"language":2677,"meta":7,"className":2721},"// 错误信息：\n// Error: Connection pool exhausted - \n// max connections (10) already in use\n\n// 提问方式：\n/**\n * PostgreSQL 连接池耗尽错误，高并发时出现：\n * Error: Connection pool exhausted\n * \n * 当前配置：\n * - max connections: 10\n * - 并发请求: 约 100/秒\n * \n * 数据库调用代码：\n */\nasync function getUserData(userId: string) {\n  const client = await pool.connect();\n  try {\n    const user = await client.query('SELECT * FROM users WHERE id = $1', [userId]);\n    const orders = await client.query('SELECT * FROM orders WHERE user_id = $1', [userId]);\n    const payments = await client.query('SELECT * FROM payments WHERE user_id = $1', [userId]);\n    return { user: user.rows[0], orders: orders.rows, payments: payments.rows };\n  } finally {\n    client.release();\n  }\n}\n\n// AI 会分析出多个可能原因并给出综合方案\n",[2679],[2723],{"type":26,"tag":162,"props":2724,"children":2725},{"__ignoreMap":7},[2726],{"type":31,"value":2720},{"type":26,"tag":34,"props":2728,"children":2730},{"id":2729},"第三部分日志分析与问题定位",[2731],{"type":31,"value":2732},"第三部分：日志分析与问题定位",{"type":26,"tag":735,"props":2734,"children":2736},{"id":2735},"_31-结构化日志分析",[2737],{"type":31,"value":2738},"3.1 结构化日志分析",{"type":26,"tag":27,"props":2740,"children":2741},{},[2742],{"type":31,"value":2743},"当面对大量日志时，让 AI 帮你快速定位问题：",{"type":26,"tag":2526,"props":2745,"children":2748},{"code":2746,"language":2702,"meta":7,"className":2747},"// 提问示例：\n/**\n * 分析以下日志，找出导致请求失败的原因：\n * \n * 日志片段：\n */\nconst logs = `\n2024-01-15 10:23:45.123 INFO  [req-abc123] 收到请求 POST /api/order\n2024-01-15 10:23:45.125 DEBUG [req-abc123] 用户认证通过 userId=u001\n2024-01-15 10:23:45.130 DEBUG [req-abc123] 开始库存检查 productId=p001\n2024-01-15 10:23:45.145 DEBUG [req-abc123] 库存检查通过 available=50\n2024-01-15 10:23:45.150 DEBUG [req-abc123] 开始创建订单\n2024-01-15 10:23:45.200 DEBUG [req-abc123] 数据库连接获取成功\n2024-01-15 10:23:45.250 ERROR [req-abc123] 订单创建失败 error=\"deadlock detected\"\n2024-01-15 10:23:45.251 WARN  [req-abc123] 事务回滚\n2024-01-15 10:23:45.255 INFO  [req-abc123] 响应 500 耗时 132ms\n`;\n\n// AI 分析结果会包括：\n// 1. 问题定位：数据库死锁\n// 2. 可能原因：并发订单创建导致锁竞争\n// 3. 排查建议：检查事务隔离级别、锁顺序\n",[2704],[2749],{"type":26,"tag":162,"props":2750,"children":2751},{"__ignoreMap":7},[2752],{"type":31,"value":2746},{"type":26,"tag":735,"props":2754,"children":2756},{"id":2755},"_32-创建调试日志",[2757],{"type":31,"value":2758},"3.2 创建调试日志",{"type":26,"tag":27,"props":2760,"children":2761},{},[2762],{"type":31,"value":2763},"让 AI 帮你生成调试用的日志代码：",{"type":26,"tag":2526,"props":2765,"children":2768},{"code":2766,"language":2677,"meta":7,"className":2767},"// 请求：\n// \"为这个函数添加详细的调试日志，包括入参、关键步骤、耗时和结果\"\n\n// 原代码：\nasync function processOrder(order: Order): Promise\u003COrderResult> {\n  const inventory = await checkInventory(order.items);\n  const payment = await processPayment(order.userId, order.total);\n  const result = await createOrder(order, payment.transactionId);\n  return result;\n}\n\n// AI 生成的带日志版本：\nasync function processOrder(order: Order): Promise\u003COrderResult> {\n  const requestId = generateRequestId();\n  const startTime = performance.now();\n  \n  logger.info({\n    requestId,\n    event: 'order_processing_start',\n    orderId: order.id,\n    userId: order.userId,\n    itemCount: order.items.length,\n    total: order.total\n  });\n  \n  try {\n    // 库存检查\n    const inventoryStart = performance.now();\n    const inventory = await checkInventory(order.items);\n    logger.debug({\n      requestId,\n      event: 'inventory_check_complete',\n      duration: performance.now() - inventoryStart,\n      available: inventory.allAvailable\n    });\n    \n    // 支付处理\n    const paymentStart = performance.now();\n    const payment = await processPayment(order.userId, order.total);\n    logger.debug({\n      requestId,\n      event: 'payment_complete',\n      duration: performance.now() - paymentStart,\n      transactionId: payment.transactionId\n    });\n    \n    // 创建订单\n    const createStart = performance.now();\n    const result = await createOrder(order, payment.transactionId);\n    logger.debug({\n      requestId,\n      event: 'order_created',\n      duration: performance.now() - createStart,\n      resultOrderId: result.orderId\n    });\n    \n    logger.info({\n      requestId,\n      event: 'order_processing_complete',\n      duration: performance.now() - startTime,\n      success: true\n    });\n    \n    return result;\n  } catch (error) {\n    logger.error({\n      requestId,\n      event: 'order_processing_failed',\n      duration: performance.now() - startTime,\n      error: error.message,\n      stack: error.stack\n    });\n    throw error;\n  }\n}\n",[2679],[2769],{"type":26,"tag":162,"props":2770,"children":2771},{"__ignoreMap":7},[2772],{"type":31,"value":2766},{"type":26,"tag":34,"props":2774,"children":2776},{"id":2775},"第四部分性能问题排查",[2777],{"type":31,"value":2778},"第四部分：性能问题排查",{"type":26,"tag":735,"props":2780,"children":2782},{"id":2781},"_41-前端性能分析",[2783],{"type":31,"value":2784},"4.1 前端性能分析",{"type":26,"tag":2526,"props":2786,"children":2789},{"code":2787,"language":2677,"meta":7,"className":2788},"// 场景：页面加载慢，需要分析原因\n\n// 提问方式：\n/**\n * 页面首屏加载需要 5 秒，以下是 Performance API 数据，\n * 请分析性能瓶颈：\n */\nconst performanceData = {\n  // Navigation Timing\n  dns: 50,           // DNS 查询\n  tcp: 100,          // TCP 连接\n  ttfb: 800,         // 首字节时间\n  download: 200,     // 文档下载\n  domParsing: 300,   // DOM 解析\n  domContentLoaded: 1500,\n  load: 5000,\n  \n  // Resource Timing (主要资源)\n  resources: [\n    { name: 'main.js', size: '2.5MB', duration: 1200 },\n    { name: 'vendor.js', size: '1.8MB', duration: 900 },\n    { name: 'styles.css', size: '500KB', duration: 300 },\n    { name: 'hero-image.jpg', size: '3MB', duration: 1500 },\n  ],\n  \n  // Long Tasks\n  longTasks: [\n    { startTime: 1600, duration: 800, name: 'script-evaluation' },\n    { startTime: 2500, duration: 400, name: 'layout' }\n  ]\n};\n\n// AI 会分析出：\n// 1. JS bundle 过大（4.3MB），需要代码分割\n// 2. 图片未优化（3MB 的 hero 图片）\n// 3. 存在长任务阻塞主线程\n// 并给出具体优化建议\n",[2679],[2790],{"type":26,"tag":162,"props":2791,"children":2792},{"__ignoreMap":7},[2793],{"type":31,"value":2787},{"type":26,"tag":735,"props":2795,"children":2797},{"id":2796},"_42-内存泄漏排查",[2798],{"type":31,"value":2799},"4.2 内存泄漏排查",{"type":26,"tag":2526,"props":2801,"children":2804},{"code":2802,"language":2677,"meta":7,"className":2803},"// 场景：应用运行一段时间后变卡\n\n// 提问方式：\n/**\n * React 应用运行一段时间后内存持续增长，以下是 Heap Snapshot 对比：\n * \n * 初始状态：50MB\n * 运行 1 小时后：150MB\n * 运行 2 小时后：280MB\n * \n * Retained objects 增长最快的：\n * - (closure) - 增长 50MB\n * - HTMLDivElement - 增长 30MB\n * - Array - 增长 20MB\n * \n * 可疑代码：\n */\nfunction DataDashboard() {\n  const [data, setData] = useState([]);\n  const chartRef = useRef(null);\n  \n  useEffect(() => {\n    // 每秒刷新数据\n    const interval = setInterval(async () => {\n      const newData = await fetchLatestData();\n      setData(prev => [...prev, ...newData]);  // 数据不断累积\n    }, 1000);\n    \n    // 初始化图表\n    const chart = new Chart(chartRef.current, {\n      // 配置...\n    });\n    \n    // 没有 cleanup！\n  }, []);\n  \n  return \u003Ccanvas ref={chartRef} />;\n}\n\n// AI 会指出：\n// 1. interval 没有清理\n// 2. Chart 实例没有销毁\n// 3. data 无限增长\n// 并提供修复代码\n",[2679],[2805],{"type":26,"tag":162,"props":2806,"children":2807},{"__ignoreMap":7},[2808],{"type":31,"value":2802},{"type":26,"tag":735,"props":2810,"children":2812},{"id":2811},"_43-数据库查询优化",[2813],{"type":31,"value":2814},"4.3 数据库查询优化",{"type":26,"tag":2526,"props":2816,"children":2821},{"code":2817,"language":2818,"meta":7,"className":2819},"-- 场景：查询很慢，让 AI 分析执行计划\n\n-- 提问方式：\n-- 以下查询在数据量大时很慢（orders 表 1000 万行），\n-- 执行计划如下，请分析并优化：\n\nEXPLAIN ANALYZE\nSELECT o.*, u.name, u.email\nFROM orders o\nJOIN users u ON o.user_id = u.id\nWHERE o.status = 'pending'\n  AND o.created_at > '2024-01-01'\nORDER BY o.created_at DESC\nLIMIT 20;\n\n-- 执行计划：\n/*\nSort  (cost=156847.23..157847.23 rows=400000 width=250)\n  Sort Key: o.created_at DESC\n  ->  Hash Join  (cost=1500.00..89847.23 rows=400000 width=250)\n        Hash Cond: (o.user_id = u.id)\n        ->  Seq Scan on orders o  (cost=0.00..85000.00 rows=400000)\n              Filter: ((status = 'pending') AND (created_at > '2024-01-01'))\n        ->  Hash  (cost=1000.00..1000.00 rows=50000 width=100)\n              ->  Seq Scan on users u  (cost=0.00..1000.00 rows=50000)\nPlanning Time: 0.5 ms\nExecution Time: 3500 ms\n*/\n\n-- AI 会分析出问题并建议：\n-- 1. orders 表全表扫描 - 需要复合索引\n-- 2. 建议创建索引：\nCREATE INDEX idx_orders_status_created ON orders(status, created_at DESC);\n\n-- 3. 如果 status 选择性不高，考虑部分索引：\nCREATE INDEX idx_orders_pending ON orders(created_at DESC) \nWHERE status = 'pending';\n","sql",[2820],"language-sql",[2822],{"type":26,"tag":162,"props":2823,"children":2824},{"__ignoreMap":7},[2825],{"type":31,"value":2817},{"type":26,"tag":34,"props":2827,"children":2829},{"id":2828},"第五部分复杂-bug-排查",[2830],{"type":31,"value":2831},"第五部分：复杂 Bug 排查",{"type":26,"tag":735,"props":2833,"children":2835},{"id":2834},"_51-竞态条件",[2836],{"type":31,"value":2837},"5.1 竞态条件",{"type":26,"tag":2526,"props":2839,"children":2842},{"code":2840,"language":2677,"meta":7,"className":2841},"// 场景：偶发的数据不一致问题\n\n// 提问方式：\n/**\n * 用户反馈偶尔看到错误的账户余额，但刷新后正常。\n * 怀疑是竞态条件，以下是相关代码：\n */\nasync function updateBalance(userId: string, amount: number) {\n  // 读取当前余额\n  const user = await db.users.findOne({ id: userId });\n  const newBalance = user.balance + amount;\n  \n  // 更新余额\n  await db.users.update({ id: userId }, { balance: newBalance });\n  \n  // 记录交易\n  await db.transactions.create({\n    userId,\n    amount,\n    balanceAfter: newBalance,\n    createdAt: new Date()\n  });\n  \n  return newBalance;\n}\n\n// 并发调用场景：\n// 用户同时发起两笔交易：+100 和 -50\n// 期望结果：原余额 1000 → 1050\n// 实际可能：原余额 1000 → 1100 或 950\n\n// AI 会分析竞态条件并提供解决方案：\nasync function updateBalanceAtomic(userId: string, amount: number) {\n  // 方案 1：使用数据库原子操作\n  const result = await db.users.findOneAndUpdate(\n    { id: userId },\n    { $inc: { balance: amount } },\n    { returnDocument: 'after' }\n  );\n  \n  await db.transactions.create({\n    userId,\n    amount,\n    balanceAfter: result.balance,\n    createdAt: new Date()\n  });\n  \n  return result.balance;\n}\n\n// 方案 2：使用乐观锁\nasync function updateBalanceOptimistic(userId: string, amount: number) {\n  const maxRetries = 3;\n  \n  for (let i = 0; i \u003C maxRetries; i++) {\n    const user = await db.users.findOne({ id: userId });\n    const newBalance = user.balance + amount;\n    \n    const updated = await db.users.updateOne(\n      { id: userId, version: user.version },\n      { balance: newBalance, version: user.version + 1 }\n    );\n    \n    if (updated.modifiedCount === 1) {\n      await db.transactions.create({...});\n      return newBalance;\n    }\n    \n    // 版本冲突，重试\n    await sleep(10 * (i + 1));\n  }\n  \n  throw new Error('Update failed after retries');\n}\n",[2679],[2843],{"type":26,"tag":162,"props":2844,"children":2845},{"__ignoreMap":7},[2846],{"type":31,"value":2840},{"type":26,"tag":735,"props":2848,"children":2850},{"id":2849},"_52-分布式系统问题",[2851],{"type":31,"value":2852},"5.2 分布式系统问题",{"type":26,"tag":2526,"props":2854,"children":2857},{"code":2855,"language":2677,"meta":7,"className":2856},"// 场景：微服务间的数据不一致\n\n// 提问方式：\n/**\n * 订单服务和库存服务偶尔出现数据不一致：\n * - 订单显示已创建\n * - 库存未扣减\n * \n * 当前流程：\n */\n// Order Service\nasync function createOrder(orderData) {\n  // 1. 调用库存服务扣减库存\n  await inventoryService.deduct(orderData.items);\n  \n  // 2. 创建订单\n  const order = await orderRepository.create(orderData);\n  \n  // 3. 发送订单创建事件\n  await eventBus.publish('order.created', order);\n  \n  return order;\n}\n\n// 问题分析：如果步骤 2 或 3 失败，库存已经扣减但订单未创建\n\n// AI 会建议使用 Saga 模式或事务发件箱模式\n",[2679],[2858],{"type":26,"tag":162,"props":2859,"children":2860},{"__ignoreMap":7},[2861],{"type":31,"value":2855},{"type":26,"tag":34,"props":2863,"children":2865},{"id":2864},"第六部分ai-调试工作流",[2866],{"type":31,"value":2867},"第六部分：AI 调试工作流",{"type":26,"tag":735,"props":2869,"children":2871},{"id":2870},"_61-我的调试流程",[2872],{"type":31,"value":2873},"6.1 我的调试流程",{"type":26,"tag":2526,"props":2875,"children":2877},{"code":2876},"┌────────────────────────────────────────────────────────────┐\n│                    AI 辅助调试工作流                         │\n├────────────────────────────────────────────────────────────┤\n│                                                            │\n│  Step 1: 问题收集                                          │\n│  ├── 复制完整错误信息                                       │\n│  ├── 截图相关日志                                          │\n│  └── 记录复现步骤                                          │\n│                                                            │\n│  Step 2: 快速分析                                          │\n│  ├── 将错误信息发给 AI                                      │\n│  ├── 获取可能原因列表                                       │\n│  └── 评估哪些最可能                                         │\n│                                                            │\n│  Step 3: 深入调查                                          │\n│  ├── 根据 AI 建议添加日志/断点                              │\n│  ├── 收集更多信息                                          │\n│  └── 再次询问 AI（带新信息）                                │\n│                                                            │\n│  Step 4: 验证修复                                          │\n│  ├── AI 生成修复代码                                        │\n│  ├── 人工审查确认                                          │\n│  └── 测试验证                                               │\n│                                                            │\n│  Step 5: 预防措施                                          │\n│  ├── AI 建议类似问题的预防方法                              │\n│  ├── 添加相关测试用例                                       │\n│  └── 更新文档/知识库                                        │\n│                                                            │\n└────────────────────────────────────────────────────────────┘\n",[2878],{"type":26,"tag":162,"props":2879,"children":2880},{"__ignoreMap":7},[2881],{"type":31,"value":2876},{"type":26,"tag":735,"props":2883,"children":2885},{"id":2884},"_62-调试对话模板",[2886],{"type":31,"value":2887},"6.2 调试对话模板",{"type":26,"tag":2526,"props":2889,"children":2892},{"code":2890,"language":285,"meta":7,"className":2891},"## 第一轮：问题描述\n\n我遇到了一个问题：[简述问题]\n\n错误信息：\n",[2530],[2893],{"type":26,"tag":162,"props":2894,"children":2895},{"__ignoreMap":7},[2896],{"type":31,"value":2890},{"type":26,"tag":27,"props":2898,"children":2899},{},[2900],{"type":26,"tag":2540,"props":2901,"children":2902},{},[2903],{"type":31,"value":2904},"粘贴完整错误",{"type":26,"tag":2526,"props":2906,"children":2908},{"code":2907},"\n相关代码：\n```javascript\n[粘贴代码]\n",[2909],{"type":26,"tag":162,"props":2910,"children":2911},{"__ignoreMap":7},[2912],{"type":31,"value":2907},{"type":26,"tag":409,"props":2914,"children":2915},{},[],{"type":26,"tag":34,"props":2917,"children":2919},{"id":2918},"第二轮补充信息",[2920],{"type":31,"value":2921},"第二轮：补充信息",{"type":26,"tag":27,"props":2923,"children":2924},{},[2925],{"type":31,"value":2926},"根据你的建议，我添加了日志，发现：",{"type":26,"tag":40,"props":2928,"children":2929},{},[2930,2938],{"type":26,"tag":44,"props":2931,"children":2932},{},[2933],{"type":26,"tag":2540,"props":2934,"children":2935},{},[2936],{"type":31,"value":2937},"发现 1",{"type":26,"tag":44,"props":2939,"children":2940},{},[2941],{"type":26,"tag":2540,"props":2942,"children":2943},{},[2944],{"type":31,"value":2945},"发现 2",{"type":26,"tag":27,"props":2947,"children":2948},{},[2949,2951,2956],{"type":31,"value":2950},"这是否说明问题出在 ",{"type":26,"tag":2540,"props":2952,"children":2953},{},[2954],{"type":31,"value":2955},"你的猜测",{"type":31,"value":2957},"？",{"type":26,"tag":409,"props":2959,"children":2960},{},[],{"type":26,"tag":34,"props":2962,"children":2964},{"id":2963},"第三轮确认修复",[2965],{"type":31,"value":2966},"第三轮：确认修复",{"type":26,"tag":27,"props":2968,"children":2969},{},[2970],{"type":31,"value":2971},"我按照你的建议修改了代码：",{"type":26,"tag":2526,"props":2973,"children":2976},{"code":2974,"language":2702,"meta":7,"className":2975},"[粘贴修改后的代码]\n",[2704],[2977],{"type":26,"tag":162,"props":2978,"children":2979},{"__ignoreMap":7},[2980],{"type":31,"value":2974},{"type":26,"tag":27,"props":2982,"children":2983},{},[2984],{"type":31,"value":2985},"请确认这个修复是否正确，以及是否有其他潜在问题。",{"type":26,"tag":409,"props":2987,"children":2988},{},[],{"type":26,"tag":34,"props":2990,"children":2992},{"id":2991},"第四轮预防",[2993],{"type":31,"value":2994},"第四轮：预防",{"type":26,"tag":27,"props":2996,"children":2997},{},[2998],{"type":31,"value":2999},"这个问题已解决。请建议：",{"type":26,"tag":339,"props":3001,"children":3002},{},[3003,3008,3013],{"type":26,"tag":44,"props":3004,"children":3005},{},[3006],{"type":31,"value":3007},"如何防止类似问题再次发生？",{"type":26,"tag":44,"props":3009,"children":3010},{},[3011],{"type":31,"value":3012},"应该添加什么测试用例？",{"type":26,"tag":44,"props":3014,"children":3015},{},[3016],{"type":31,"value":3017},"有什么最佳实践可以参考？",{"type":26,"tag":2526,"props":3019,"children":3021},{"code":3020},"\n## 结语：AI 是放大器，不是替代品\n\nAI 调试工具能够显著加速问题排查过程，但它不能替代你的思考。最有价值的能力组合是：\n\n- **你的领域知识** + **AI 的广博见识**\n- **你对项目的理解** + **AI 的分析能力**\n- **你的判断力** + **AI 的执行速度**\n\n调试的本质是假设-验证的循环。AI 帮你更快地生成假设、更高效地验证假设，但做出最终判断的还是你。\n\n学会与 AI 高效协作调试，不是依赖 AI 给你答案，而是让 AI 帮你更快地找到自己的答案。\n\n---\n\n## 参考资源\n\n- [Chrome DevTools 官方文档](https://developer.chrome.com/docs/devtools)\n- [Node.js 调试指南](https://nodejs.org/en/docs/guides/debugging-getting-started)\n- [React DevTools 使用指南](https://react.dev/learn/react-developer-tools)\n",[3022],{"type":26,"tag":162,"props":3023,"children":3024},{"__ignoreMap":7},[3025],{"type":31,"value":3020},{"title":7,"searchDepth":278,"depth":278,"links":3027},[3028,3029,3030,3035,3039,3044,3048,3052,3053,3054],{"id":2410,"depth":281,"text":2413},{"id":2416,"depth":281,"text":2419},{"id":2437,"depth":281,"text":2440,"children":3031},[3032,3033,3034],{"id":2443,"depth":278,"text":2446},{"id":2521,"depth":278,"text":2524},{"id":2687,"depth":278,"text":2690},{"id":2729,"depth":281,"text":2732,"children":3036},[3037,3038],{"id":2735,"depth":278,"text":2738},{"id":2755,"depth":278,"text":2758},{"id":2775,"depth":281,"text":2778,"children":3040},[3041,3042,3043],{"id":2781,"depth":278,"text":2784},{"id":2796,"depth":278,"text":2799},{"id":2811,"depth":278,"text":2814},{"id":2828,"depth":281,"text":2831,"children":3045},[3046,3047],{"id":2834,"depth":278,"text":2837},{"id":2849,"depth":278,"text":2852},{"id":2864,"depth":281,"text":2867,"children":3049},[3050,3051],{"id":2870,"depth":278,"text":2873},{"id":2884,"depth":278,"text":2887},{"id":2918,"depth":281,"text":2921},{"id":2963,"depth":281,"text":2966},{"id":2991,"depth":281,"text":2994},"content:topics:ai:ai-debugging-troubleshooting-guide.md","topics/ai/ai-debugging-troubleshooting-guide.md","topics/ai/ai-debugging-troubleshooting-guide",{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"topic":5,"author":11,"tags":3059,"image":17,"imageQuery":18,"pexelsPhotoId":19,"pexelsUrl":20,"featured":6,"readingTime":21,"body":3060,"_type":285,"_id":286,"_source":287,"_file":288,"_stem":289,"_extension":290},[13,14,15,16],{"type":23,"children":3061,"toc":3256},[3062,3066,3070,3085,3089,3093,3162,3172,3176,3180,3184,3228,3232],{"type":26,"tag":27,"props":3063,"children":3064},{},[3065],{"type":31,"value":32},{"type":26,"tag":34,"props":3067,"children":3068},{"id":36},[3069],{"type":31,"value":36},{"type":26,"tag":40,"props":3071,"children":3072},{},[3073,3077,3081],{"type":26,"tag":44,"props":3074,"children":3075},{},[3076],{"type":31,"value":48},{"type":26,"tag":44,"props":3078,"children":3079},{},[3080],{"type":31,"value":53},{"type":26,"tag":44,"props":3082,"children":3083},{},[3084],{"type":31,"value":58},{"type":26,"tag":27,"props":3086,"children":3087},{},[3088],{"type":31,"value":63},{"type":26,"tag":34,"props":3090,"children":3091},{"id":66},[3092],{"type":31,"value":66},{"type":26,"tag":70,"props":3094,"children":3095},{},[3096,3114],{"type":26,"tag":74,"props":3097,"children":3098},{},[3099],{"type":26,"tag":78,"props":3100,"children":3101},{},[3102,3106,3110],{"type":26,"tag":82,"props":3103,"children":3104},{},[3105],{"type":31,"value":86},{"type":26,"tag":82,"props":3107,"children":3108},{},[3109],{"type":31,"value":91},{"type":26,"tag":82,"props":3111,"children":3112},{},[3113],{"type":31,"value":96},{"type":26,"tag":98,"props":3115,"children":3116},{},[3117,3132,3147],{"type":26,"tag":78,"props":3118,"children":3119},{},[3120,3124,3128],{"type":26,"tag":105,"props":3121,"children":3122},{},[3123],{"type":31,"value":109},{"type":26,"tag":105,"props":3125,"children":3126},{},[3127],{"type":31,"value":114},{"type":26,"tag":105,"props":3129,"children":3130},{},[3131],{"type":31,"value":119},{"type":26,"tag":78,"props":3133,"children":3134},{},[3135,3139,3143],{"type":26,"tag":105,"props":3136,"children":3137},{},[3138],{"type":31,"value":127},{"type":26,"tag":105,"props":3140,"children":3141},{},[3142],{"type":31,"value":132},{"type":26,"tag":105,"props":3144,"children":3145},{},[3146],{"type":31,"value":137},{"type":26,"tag":78,"props":3148,"children":3149},{},[3150,3154,3158],{"type":26,"tag":105,"props":3151,"children":3152},{},[3153],{"type":31,"value":145},{"type":26,"tag":105,"props":3155,"children":3156},{},[3157],{"type":31,"value":150},{"type":26,"tag":105,"props":3159,"children":3160},{},[3161],{"type":31,"value":155},{"type":26,"tag":27,"props":3163,"children":3164},{},[3165,3166,3171],{"type":31,"value":160},{"type":26,"tag":162,"props":3167,"children":3169},{"className":3168},[],[3170],{"type":31,"value":167},{"type":31,"value":169},{"type":26,"tag":34,"props":3173,"children":3174},{"id":172},[3175],{"type":31,"value":175},{"type":26,"tag":27,"props":3177,"children":3178},{},[3179],{"type":31,"value":180},{"type":26,"tag":34,"props":3181,"children":3182},{"id":183},[3183],{"type":31,"value":186},{"type":26,"tag":40,"props":3185,"children":3187},{"className":3186},[190],[3188,3196,3204,3212,3220],{"type":26,"tag":44,"props":3189,"children":3191},{"className":3190},[195],[3192,3195],{"type":26,"tag":198,"props":3193,"children":3194},{"disabled":200,"type":201},[],{"type":31,"value":204},{"type":26,"tag":44,"props":3197,"children":3199},{"className":3198},[195],[3200,3203],{"type":26,"tag":198,"props":3201,"children":3202},{"disabled":200,"type":201},[],{"type":31,"value":213},{"type":26,"tag":44,"props":3205,"children":3207},{"className":3206},[195],[3208,3211],{"type":26,"tag":198,"props":3209,"children":3210},{"disabled":200,"type":201},[],{"type":31,"value":222},{"type":26,"tag":44,"props":3213,"children":3215},{"className":3214},[195],[3216,3219],{"type":26,"tag":198,"props":3217,"children":3218},{"disabled":200,"type":201},[],{"type":31,"value":231},{"type":26,"tag":44,"props":3221,"children":3223},{"className":3222},[195],[3224,3227],{"type":26,"tag":198,"props":3225,"children":3226},{"disabled":200,"type":201},[],{"type":31,"value":240},{"type":26,"tag":27,"props":3229,"children":3230},{},[3231],{"type":31,"value":245},{"type":26,"tag":40,"props":3233,"children":3234},{},[3235,3242,3249],{"type":26,"tag":44,"props":3236,"children":3237},{},[3238],{"type":26,"tag":253,"props":3239,"children":3240},{"href":255},[3241],{"type":31,"value":258},{"type":26,"tag":44,"props":3243,"children":3244},{},[3245],{"type":26,"tag":253,"props":3246,"children":3247},{"href":264},[3248],{"type":31,"value":267},{"type":26,"tag":44,"props":3250,"children":3251},{},[3252],{"type":26,"tag":253,"props":3253,"children":3254},{"href":273},[3255],{"type":31,"value":276},{"title":7,"searchDepth":278,"depth":278,"links":3257},[3258,3259,3260,3261],{"id":36,"depth":281,"text":36},{"id":66,"depth":281,"text":66},{"id":172,"depth":281,"text":175},{"id":183,"depth":281,"text":186},1780105148314]