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