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