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