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