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