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