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