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