[{"data":1,"prerenderedAt":1327},["ShallowReactive",2],{"content-query-XOlIdqYAct":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"lastUpdated":10,"body":11,"_type":884,"_id":1322,"_source":1323,"_file":1324,"_stem":1325,"_extension":1326},"\u002Fparadigms\u002Fspec-coding","paradigms",false,"","Spec Coding 规格编程","规格先行的契约式AI编程范式","2026-04-23",{"type":12,"children":13,"toc":1296},"root",[14,23,29,48,53,62,66,71,78,83,89,94,100,105,243,246,252,258,263,298,304,322,325,331,337,342,365,371,376,394,400,405,428,434,439,457,463,468,486,489,494,517,520,526,531,660,663,668,696,699,704,747,750,755,854,857,863,871,879,1211,1219,1224,1247,1257,1260,1265,1290],{"type":15,"tag":16,"props":17,"children":19},"element","h1",{"id":18},"spec-coding规格编程",[20],{"type":21,"value":22},"text","Spec Coding（规格编程）",{"type":15,"tag":24,"props":25,"children":27},"h2",{"id":26},"定义",[28],{"type":21,"value":26},{"type":15,"tag":30,"props":31,"children":32},"p",{},[33,39,41,46],{"type":15,"tag":34,"props":35,"children":36},"strong",{},[37],{"type":21,"value":38},"Spec Coding",{"type":21,"value":40},"（规格编程）的核心是",{"type":15,"tag":34,"props":42,"children":43},{},[44],{"type":21,"value":45},"规格先行",{"type":21,"value":47},"——先用结构化文档定义\"做什么\"和\"验收标准\"，再让AI严格按照规格生成实现。",{"type":15,"tag":30,"props":49,"children":50},{},[51],{"type":21,"value":52},"如果说Vibe Coding是\"随意生成\"，那Spec Coding就是\"约束生成\"：规格是不可篡改的合同，代码必须服从规格。",{"type":15,"tag":54,"props":55,"children":56},"blockquote",{},[57],{"type":15,"tag":30,"props":58,"children":59},{},[60],{"type":21,"value":61},"\"需求越模糊，AI写得越快，返工越多。Spec Coding解决的就是这个问题。\"",{"type":15,"tag":63,"props":64,"children":65},"hr",{},[],{"type":15,"tag":24,"props":67,"children":69},{"id":68},"核心理念",[70],{"type":21,"value":68},{"type":15,"tag":72,"props":73,"children":75},"h3",{"id":74},"_1-spec-as-source-of-truth",[76],{"type":21,"value":77},"1. Spec as Source of Truth",{"type":15,"tag":30,"props":79,"children":80},{},[81],{"type":21,"value":82},"规格文档取代代码，成为开发流程的首要产物。代码是规格的实现，而不是反过来。",{"type":15,"tag":72,"props":84,"children":86},{"id":85},"_2-可执行规格",[87],{"type":21,"value":88},"2. 可执行规格",{"type":15,"tag":30,"props":90,"children":91},{},[92],{"type":21,"value":93},"规格不只描述需求，还能直接驱动AI生成实现。规格中的每一条需求都可以被验证——有就是有，没有就是没有。",{"type":15,"tag":72,"props":95,"children":97},{"id":96},"_3-结构化流程",[98],{"type":21,"value":99},"3. 结构化流程",{"type":15,"tag":30,"props":101,"children":102},{},[103],{"type":21,"value":104},"从需求到实现，每一步都有明确的产出物和验收标准：",{"type":15,"tag":106,"props":107,"children":108},"table",{},[109,133],{"type":15,"tag":110,"props":111,"children":112},"thead",{},[113],{"type":15,"tag":114,"props":115,"children":116},"tr",{},[117,123,128],{"type":15,"tag":118,"props":119,"children":120},"th",{},[121],{"type":21,"value":122},"阶段",{"type":15,"tag":118,"props":124,"children":125},{},[126],{"type":21,"value":127},"产出",{"type":15,"tag":118,"props":129,"children":130},{},[131],{"type":21,"value":132},"说明",{"type":15,"tag":134,"props":135,"children":136},"tbody",{},[137,159,180,201,222],{"type":15,"tag":114,"props":138,"children":139},{},[140,149,154],{"type":15,"tag":141,"props":142,"children":143},"td",{},[144],{"type":15,"tag":34,"props":145,"children":146},{},[147],{"type":21,"value":148},"Constitution",{"type":15,"tag":141,"props":150,"children":151},{},[152],{"type":21,"value":153},"项目治理原则",{"type":15,"tag":141,"props":155,"children":156},{},[157],{"type":21,"value":158},"代码质量标准、测试要求、性能基线",{"type":15,"tag":114,"props":160,"children":161},{},[162,170,175],{"type":15,"tag":141,"props":163,"children":164},{},[165],{"type":15,"tag":34,"props":166,"children":167},{},[168],{"type":21,"value":169},"Specify",{"type":15,"tag":141,"props":171,"children":172},{},[173],{"type":21,"value":174},"功能规格",{"type":15,"tag":141,"props":176,"children":177},{},[178],{"type":21,"value":179},"用户故事、功能描述、验收标准",{"type":15,"tag":114,"props":181,"children":182},{},[183,191,196],{"type":15,"tag":141,"props":184,"children":185},{},[186],{"type":15,"tag":34,"props":187,"children":188},{},[189],{"type":21,"value":190},"Plan",{"type":15,"tag":141,"props":192,"children":193},{},[194],{"type":21,"value":195},"技术方案",{"type":15,"tag":141,"props":197,"children":198},{},[199],{"type":21,"value":200},"技术栈选型、架构设计、数据模型",{"type":15,"tag":114,"props":202,"children":203},{},[204,212,217],{"type":15,"tag":141,"props":205,"children":206},{},[207],{"type":15,"tag":34,"props":208,"children":209},{},[210],{"type":21,"value":211},"Tasks",{"type":15,"tag":141,"props":213,"children":214},{},[215],{"type":21,"value":216},"任务清单",{"type":15,"tag":141,"props":218,"children":219},{},[220],{"type":21,"value":221},"可执行的实现步骤，按依赖排序",{"type":15,"tag":114,"props":223,"children":224},{},[225,233,238],{"type":15,"tag":141,"props":226,"children":227},{},[228],{"type":15,"tag":34,"props":229,"children":230},{},[231],{"type":21,"value":232},"Implement",{"type":15,"tag":141,"props":234,"children":235},{},[236],{"type":21,"value":237},"代码实现",{"type":15,"tag":141,"props":239,"children":240},{},[241],{"type":21,"value":242},"AI按规格和计划逐步执行",{"type":15,"tag":63,"props":244,"children":245},{},[],{"type":15,"tag":24,"props":247,"children":249},{"id":248},"为什么需要spec-coding",[250],{"type":21,"value":251},"为什么需要Spec Coding",{"type":15,"tag":72,"props":253,"children":255},{"id":254},"vibe-coding的困境",[256],{"type":21,"value":257},"Vibe Coding的困境",{"type":15,"tag":30,"props":259,"children":260},{},[261],{"type":21,"value":262},"Vibe Coding适合快速原型，但在以下场景会碰壁：",{"type":15,"tag":264,"props":265,"children":266},"ul",{},[267,278,288],{"type":15,"tag":268,"props":269,"children":270},"li",{},[271,276],{"type":15,"tag":34,"props":272,"children":273},{},[274],{"type":21,"value":275},"团队协作",{"type":21,"value":277},"：没有规格，不同人用AI生成的代码风格和架构不一致",{"type":15,"tag":268,"props":279,"children":280},{},[281,286],{"type":15,"tag":34,"props":282,"children":283},{},[284],{"type":21,"value":285},"复杂业务逻辑",{"type":21,"value":287},"：模糊的自然语言描述无法覆盖所有边界情况",{"type":15,"tag":268,"props":289,"children":290},{},[291,296],{"type":15,"tag":34,"props":292,"children":293},{},[294],{"type":21,"value":295},"质量要求",{"type":21,"value":297},"：需要可追溯的需求-实现映射，而非\"生成了就行\"",{"type":15,"tag":72,"props":299,"children":301},{"id":300},"spec-coding的解决思路",[302],{"type":21,"value":303},"Spec Coding的解决思路",{"type":15,"tag":264,"props":305,"children":306},{},[307,312,317],{"type":15,"tag":268,"props":308,"children":309},{},[310],{"type":21,"value":311},"用规格消除歧义，让AI的每次生成都有明确的验收标准",{"type":15,"tag":268,"props":313,"children":314},{},[315],{"type":21,"value":316},"用结构化流程替代\"一次性生成\"，支持多轮迭代和增量开发",{"type":15,"tag":268,"props":318,"children":319},{},[320],{"type":21,"value":321},"用任务清单实现可追溯：每个实现都能对应到具体的需求条目",{"type":15,"tag":63,"props":323,"children":324},{},[],{"type":15,"tag":24,"props":326,"children":328},{"id":327},"spec-driven-development-流程详解",[329],{"type":21,"value":330},"Spec-Driven Development 流程详解",{"type":15,"tag":72,"props":332,"children":334},{"id":333},"阶段一constitution治理原则",[335],{"type":21,"value":336},"阶段一：Constitution（治理原则）",{"type":15,"tag":30,"props":338,"children":339},{},[340],{"type":21,"value":341},"在项目启动时定义全局约束：",{"type":15,"tag":264,"props":343,"children":344},{},[345,350,355,360],{"type":15,"tag":268,"props":346,"children":347},{},[348],{"type":21,"value":349},"代码风格和质量标准",{"type":15,"tag":268,"props":351,"children":352},{},[353],{"type":21,"value":354},"测试覆盖率要求",{"type":15,"tag":268,"props":356,"children":357},{},[358],{"type":21,"value":359},"性能和安全基线",{"type":15,"tag":268,"props":361,"children":362},{},[363],{"type":21,"value":364},"技术栈约束",{"type":15,"tag":72,"props":366,"children":368},{"id":367},"阶段二specify功能规格",[369],{"type":21,"value":370},"阶段二：Specify（功能规格）",{"type":15,"tag":30,"props":372,"children":373},{},[374],{"type":21,"value":375},"描述\"做什么\"，不涉及技术实现：",{"type":15,"tag":264,"props":377,"children":378},{},[379,384,389],{"type":15,"tag":268,"props":380,"children":381},{},[382],{"type":21,"value":383},"用户故事和使用场景",{"type":15,"tag":268,"props":385,"children":386},{},[387],{"type":21,"value":388},"功能边界和约束条件",{"type":15,"tag":268,"props":390,"children":391},{},[392],{"type":21,"value":393},"验收标准（可测试、可验证）",{"type":15,"tag":72,"props":395,"children":397},{"id":396},"阶段三plan技术方案",[398],{"type":21,"value":399},"阶段三：Plan（技术方案）",{"type":15,"tag":30,"props":401,"children":402},{},[403],{"type":21,"value":404},"确定\"怎么做\"：",{"type":15,"tag":264,"props":406,"children":407},{},[408,413,418,423],{"type":15,"tag":268,"props":409,"children":410},{},[411],{"type":21,"value":412},"技术栈选型及理由",{"type":15,"tag":268,"props":414,"children":415},{},[416],{"type":21,"value":417},"系统架构和模块划分",{"type":15,"tag":268,"props":419,"children":420},{},[421],{"type":21,"value":422},"数据模型和API设计",{"type":15,"tag":268,"props":424,"children":425},{},[426],{"type":21,"value":427},"关键技术决策记录",{"type":15,"tag":72,"props":429,"children":431},{"id":430},"阶段四tasks任务分解",[432],{"type":21,"value":433},"阶段四：Tasks（任务分解）",{"type":15,"tag":30,"props":435,"children":436},{},[437],{"type":21,"value":438},"将方案拆解为可执行步骤：",{"type":15,"tag":264,"props":440,"children":441},{},[442,447,452],{"type":15,"tag":268,"props":443,"children":444},{},[445],{"type":21,"value":446},"按依赖关系排序",{"type":15,"tag":268,"props":448,"children":449},{},[450],{"type":21,"value":451},"每个任务有明确的输入输出",{"type":15,"tag":268,"props":453,"children":454},{},[455],{"type":21,"value":456},"支持并行执行",{"type":15,"tag":72,"props":458,"children":460},{"id":459},"阶段五implement实现",[461],{"type":21,"value":462},"阶段五：Implement（实现）",{"type":15,"tag":30,"props":464,"children":465},{},[466],{"type":21,"value":467},"AI按任务清单逐项执行：",{"type":15,"tag":264,"props":469,"children":470},{},[471,476,481],{"type":15,"tag":268,"props":472,"children":473},{},[474],{"type":21,"value":475},"每完成一个任务，对照规格验证",{"type":15,"tag":268,"props":477,"children":478},{},[479],{"type":21,"value":480},"发现规格遗漏时，回溯更新规格",{"type":15,"tag":268,"props":482,"children":483},{},[484],{"type":21,"value":485},"最终输出：代码 + 测试 + 文档",{"type":15,"tag":63,"props":487,"children":488},{},[],{"type":15,"tag":24,"props":490,"children":492},{"id":491},"代表工具",[493],{"type":21,"value":491},{"type":15,"tag":264,"props":495,"children":496},{},[497,507],{"type":15,"tag":268,"props":498,"children":499},{},[500,505],{"type":15,"tag":34,"props":501,"children":502},{},[503],{"type":21,"value":504},"SpecKit",{"type":21,"value":506}," — GitHub官方推出，支持30+ AI编程代理（Claude Code、Copilot、Cursor、Gemini CLI等），拥有60+社区扩展，是当前Spec-Driven Development的事实标准",{"type":15,"tag":268,"props":508,"children":509},{},[510,515],{"type":15,"tag":34,"props":511,"children":512},{},[513],{"type":21,"value":514},"OpenSpec",{"type":21,"value":516}," — 轻量级规格驱动工具",{"type":15,"tag":63,"props":518,"children":519},{},[],{"type":15,"tag":24,"props":521,"children":523},{"id":522},"与vibe-coding的关系",[524],{"type":21,"value":525},"与Vibe Coding的关系",{"type":15,"tag":30,"props":527,"children":528},{},[529],{"type":21,"value":530},"Spec Coding 不是替代 Vibe Coding，而是解决不同的问题：",{"type":15,"tag":106,"props":532,"children":533},{},[534,554],{"type":15,"tag":110,"props":535,"children":536},{},[537],{"type":15,"tag":114,"props":538,"children":539},{},[540,545,550],{"type":15,"tag":118,"props":541,"children":542},{},[543],{"type":21,"value":544},"维度",{"type":15,"tag":118,"props":546,"children":547},{},[548],{"type":21,"value":549},"Vibe Coding",{"type":15,"tag":118,"props":551,"children":552},{},[553],{"type":21,"value":38},{"type":15,"tag":134,"props":555,"children":556},{},[557,578,599,620,641],{"type":15,"tag":114,"props":558,"children":559},{},[560,568,573],{"type":15,"tag":141,"props":561,"children":562},{},[563],{"type":15,"tag":34,"props":564,"children":565},{},[566],{"type":21,"value":567},"核心思路",{"type":15,"tag":141,"props":569,"children":570},{},[571],{"type":21,"value":572},"随意生成，快速迭代",{"type":15,"tag":141,"props":574,"children":575},{},[576],{"type":21,"value":577},"规格先行，约束生成",{"type":15,"tag":114,"props":579,"children":580},{},[581,589,594],{"type":15,"tag":141,"props":582,"children":583},{},[584],{"type":15,"tag":34,"props":585,"children":586},{},[587],{"type":21,"value":588},"适用阶段",{"type":15,"tag":141,"props":590,"children":591},{},[592],{"type":21,"value":593},"原型验证、探索性开发",{"type":15,"tag":141,"props":595,"children":596},{},[597],{"type":21,"value":598},"正式开发、团队协作",{"type":15,"tag":114,"props":600,"children":601},{},[602,610,615],{"type":15,"tag":141,"props":603,"children":604},{},[605],{"type":15,"tag":34,"props":606,"children":607},{},[608],{"type":21,"value":609},"质量保障",{"type":15,"tag":141,"props":611,"children":612},{},[613],{"type":21,"value":614},"人工后续优化",{"type":15,"tag":141,"props":616,"children":617},{},[618],{"type":21,"value":619},"规格驱动的自动化验证",{"type":15,"tag":114,"props":621,"children":622},{},[623,631,636],{"type":15,"tag":141,"props":624,"children":625},{},[626],{"type":15,"tag":34,"props":627,"children":628},{},[629],{"type":21,"value":630},"前期投入",{"type":15,"tag":141,"props":632,"children":633},{},[634],{"type":21,"value":635},"低（直接开始写）",{"type":15,"tag":141,"props":637,"children":638},{},[639],{"type":21,"value":640},"高（需要先写规格）",{"type":15,"tag":114,"props":642,"children":643},{},[644,652,657],{"type":15,"tag":141,"props":645,"children":646},{},[647],{"type":15,"tag":34,"props":648,"children":649},{},[650],{"type":21,"value":651},"典型组合",{"type":15,"tag":141,"props":653,"children":654},{},[655],{"type":21,"value":656},"用Vibe Coding验证想法 → 用Spec Coding落地实现",{"type":15,"tag":141,"props":658,"children":659},{},[],{"type":15,"tag":63,"props":661,"children":662},{},[],{"type":15,"tag":24,"props":664,"children":666},{"id":665},"适用场景",[667],{"type":21,"value":665},{"type":15,"tag":264,"props":669,"children":670},{},[671,676,681,686,691],{"type":15,"tag":268,"props":672,"children":673},{},[674],{"type":21,"value":675},"团队协作项目（多人需要统一的开发标准）",{"type":15,"tag":268,"props":677,"children":678},{},[679],{"type":21,"value":680},"需要可追溯性的企业级开发",{"type":15,"tag":268,"props":682,"children":683},{},[684],{"type":21,"value":685},"复杂业务逻辑的AI辅助实现",{"type":15,"tag":268,"props":687,"children":688},{},[689],{"type":21,"value":690},"遗留系统改造（Brownfield）",{"type":15,"tag":268,"props":692,"children":693},{},[694],{"type":21,"value":695},"合规要求严格的行业（金融、医疗）",{"type":15,"tag":63,"props":697,"children":698},{},[],{"type":15,"tag":24,"props":700,"children":702},{"id":701},"局限性",[703],{"type":21,"value":701},{"type":15,"tag":264,"props":705,"children":706},{},[707,717,727,737],{"type":15,"tag":268,"props":708,"children":709},{},[710,715],{"type":15,"tag":34,"props":711,"children":712},{},[713],{"type":21,"value":714},"前期投入高",{"type":21,"value":716},"：写好规格本身需要时间和专业度",{"type":15,"tag":268,"props":718,"children":719},{},[720,725],{"type":15,"tag":34,"props":721,"children":722},{},[723],{"type":21,"value":724},"灵活性降低",{"type":21,"value":726},"：不适合快速原型阶段和探索性开发",{"type":15,"tag":268,"props":728,"children":729},{},[730,735],{"type":15,"tag":34,"props":731,"children":732},{},[733],{"type":21,"value":734},"学习曲线",{"type":21,"value":736},"：需要理解Spec-Driven Development方法论",{"type":15,"tag":268,"props":738,"children":739},{},[740,745],{"type":15,"tag":34,"props":741,"children":742},{},[743],{"type":21,"value":744},"工具依赖",{"type":21,"value":746},"：流程的顺畅程度依赖工具链的成熟度",{"type":15,"tag":63,"props":748,"children":749},{},[],{"type":15,"tag":24,"props":751,"children":753},{"id":752},"适用场景对照",[754],{"type":21,"value":752},{"type":15,"tag":106,"props":756,"children":757},{},[758,772],{"type":15,"tag":110,"props":759,"children":760},{},[761],{"type":15,"tag":114,"props":762,"children":763},{},[764,768],{"type":15,"tag":118,"props":765,"children":766},{},[767],{"type":21,"value":544},{"type":15,"tag":118,"props":769,"children":770},{},[771],{"type":21,"value":38},{"type":15,"tag":134,"props":773,"children":774},{},[775,791,807,823,838],{"type":15,"tag":114,"props":776,"children":777},{},[778,786],{"type":15,"tag":141,"props":779,"children":780},{},[781],{"type":15,"tag":34,"props":782,"children":783},{},[784],{"type":21,"value":785},"人类角色",{"type":15,"tag":141,"props":787,"children":788},{},[789],{"type":21,"value":790},"架构师——定义规格和验收标准",{"type":15,"tag":114,"props":792,"children":793},{},[794,802],{"type":15,"tag":141,"props":795,"children":796},{},[797],{"type":15,"tag":34,"props":798,"children":799},{},[800],{"type":21,"value":801},"AI角色",{"type":15,"tag":141,"props":803,"children":804},{},[805],{"type":21,"value":806},"严格执行者——按规格生成实现",{"type":15,"tag":114,"props":808,"children":809},{},[810,818],{"type":15,"tag":141,"props":811,"children":812},{},[813],{"type":15,"tag":34,"props":814,"children":815},{},[816],{"type":21,"value":817},"核心优势",{"type":15,"tag":141,"props":819,"children":820},{},[821],{"type":21,"value":822},"可追溯、可验证、团队一致",{"type":15,"tag":114,"props":824,"children":825},{},[826,833],{"type":15,"tag":141,"props":827,"children":828},{},[829],{"type":15,"tag":34,"props":830,"children":831},{},[832],{"type":21,"value":665},{"type":15,"tag":141,"props":834,"children":835},{},[836],{"type":21,"value":837},"团队项目、企业级开发、合规场景",{"type":15,"tag":114,"props":839,"children":840},{},[841,849],{"type":15,"tag":141,"props":842,"children":843},{},[844],{"type":15,"tag":34,"props":845,"children":846},{},[847],{"type":21,"value":848},"代码质量",{"type":15,"tag":141,"props":850,"children":851},{},[852],{"type":21,"value":853},"规格驱动的质量保证",{"type":15,"tag":63,"props":855,"children":856},{},[],{"type":15,"tag":24,"props":858,"children":860},{"id":859},"实战示例同一需求的-spec-coding-写法",[861],{"type":21,"value":862},"实战示例：同一需求的 Spec Coding 写法",{"type":15,"tag":54,"props":864,"children":865},{},[866],{"type":15,"tag":30,"props":867,"children":868},{},[869],{"type":21,"value":870},"需求：构建一个天气查询页面，调用 OpenWeatherMap API 显示当前天气",{"type":15,"tag":30,"props":872,"children":873},{},[874],{"type":15,"tag":34,"props":875,"children":876},{},[877],{"type":21,"value":878},"第一步：编写 Spec 文档",{"type":15,"tag":880,"props":881,"children":885},"pre",{"className":882,"code":883,"language":884,"meta":7,"style":7},"language-markdown shiki shiki-themes github-dark","# Spec: 天气查询页面\n\n## 功能需求\n- 用户输入城市名称，点击按钮查询\n- 调用 OpenWeatherMap Current Weather API\n- 展示：城市名、温度（摄氏度）、湿度、风速、天气图标\n- 支持加载状态、空状态、错误状态\n\n## 数据模型\ninterface WeatherData {\n  name: string\n  main: { temp: number; humidity: number }\n  wind: { speed: number }\n  weather: [{ icon: string; description: string }]\n}\n\n## API 规格\n- Endpoint: GET \u002Fdata\u002F2.5\u002Fweather?q={city}&appid={key}&units=metric\n- 成功: 200 + WeatherData\n- 城市未找到: 404\n- API Key 无效: 401\n\n## 验收标准\n- [ ] 输入中文城市名可正常查询\n- [ ] 温度显示为摄氏度，保留整数\n- [ ] 加载时显示骨架屏动画\n- [ ] 错误时显示可操作的提示文案\n- [ ] 空状态显示引导文字\n- [ ] 组件可单独测试，无外部副作用\n","markdown",[886],{"type":15,"tag":887,"props":888,"children":889},"code",{"__ignoreMap":7},[890,902,912,921,937,950,963,976,984,993,1002,1011,1020,1029,1038,1047,1055,1064,1077,1090,1103,1116,1124,1133,1146,1159,1172,1185,1198],{"type":15,"tag":891,"props":892,"children":895},"span",{"class":893,"line":894},"line",1,[896],{"type":15,"tag":891,"props":897,"children":899},{"style":898},"--shiki-default:#79B8FF;--shiki-default-font-weight:bold",[900],{"type":21,"value":901},"# Spec: 天气查询页面\n",{"type":15,"tag":891,"props":903,"children":905},{"class":893,"line":904},2,[906],{"type":15,"tag":891,"props":907,"children":909},{"emptyLinePlaceholder":908},true,[910],{"type":21,"value":911},"\n",{"type":15,"tag":891,"props":913,"children":915},{"class":893,"line":914},3,[916],{"type":15,"tag":891,"props":917,"children":918},{"style":898},[919],{"type":21,"value":920},"## 功能需求\n",{"type":15,"tag":891,"props":922,"children":924},{"class":893,"line":923},4,[925,931],{"type":15,"tag":891,"props":926,"children":928},{"style":927},"--shiki-default:#FFAB70",[929],{"type":21,"value":930},"-",{"type":15,"tag":891,"props":932,"children":934},{"style":933},"--shiki-default:#E1E4E8",[935],{"type":21,"value":936}," 用户输入城市名称，点击按钮查询\n",{"type":15,"tag":891,"props":938,"children":940},{"class":893,"line":939},5,[941,945],{"type":15,"tag":891,"props":942,"children":943},{"style":927},[944],{"type":21,"value":930},{"type":15,"tag":891,"props":946,"children":947},{"style":933},[948],{"type":21,"value":949}," 调用 OpenWeatherMap Current Weather API\n",{"type":15,"tag":891,"props":951,"children":953},{"class":893,"line":952},6,[954,958],{"type":15,"tag":891,"props":955,"children":956},{"style":927},[957],{"type":21,"value":930},{"type":15,"tag":891,"props":959,"children":960},{"style":933},[961],{"type":21,"value":962}," 展示：城市名、温度（摄氏度）、湿度、风速、天气图标\n",{"type":15,"tag":891,"props":964,"children":966},{"class":893,"line":965},7,[967,971],{"type":15,"tag":891,"props":968,"children":969},{"style":927},[970],{"type":21,"value":930},{"type":15,"tag":891,"props":972,"children":973},{"style":933},[974],{"type":21,"value":975}," 支持加载状态、空状态、错误状态\n",{"type":15,"tag":891,"props":977,"children":979},{"class":893,"line":978},8,[980],{"type":15,"tag":891,"props":981,"children":982},{"emptyLinePlaceholder":908},[983],{"type":21,"value":911},{"type":15,"tag":891,"props":985,"children":987},{"class":893,"line":986},9,[988],{"type":15,"tag":891,"props":989,"children":990},{"style":898},[991],{"type":21,"value":992},"## 数据模型\n",{"type":15,"tag":891,"props":994,"children":996},{"class":893,"line":995},10,[997],{"type":15,"tag":891,"props":998,"children":999},{"style":933},[1000],{"type":21,"value":1001},"interface WeatherData {\n",{"type":15,"tag":891,"props":1003,"children":1005},{"class":893,"line":1004},11,[1006],{"type":15,"tag":891,"props":1007,"children":1008},{"style":933},[1009],{"type":21,"value":1010},"  name: string\n",{"type":15,"tag":891,"props":1012,"children":1014},{"class":893,"line":1013},12,[1015],{"type":15,"tag":891,"props":1016,"children":1017},{"style":933},[1018],{"type":21,"value":1019},"  main: { temp: number; humidity: number }\n",{"type":15,"tag":891,"props":1021,"children":1023},{"class":893,"line":1022},13,[1024],{"type":15,"tag":891,"props":1025,"children":1026},{"style":933},[1027],{"type":21,"value":1028},"  wind: { speed: number }\n",{"type":15,"tag":891,"props":1030,"children":1032},{"class":893,"line":1031},14,[1033],{"type":15,"tag":891,"props":1034,"children":1035},{"style":933},[1036],{"type":21,"value":1037},"  weather: [{ icon: string; description: string }]\n",{"type":15,"tag":891,"props":1039,"children":1041},{"class":893,"line":1040},15,[1042],{"type":15,"tag":891,"props":1043,"children":1044},{"style":933},[1045],{"type":21,"value":1046},"}\n",{"type":15,"tag":891,"props":1048,"children":1050},{"class":893,"line":1049},16,[1051],{"type":15,"tag":891,"props":1052,"children":1053},{"emptyLinePlaceholder":908},[1054],{"type":21,"value":911},{"type":15,"tag":891,"props":1056,"children":1058},{"class":893,"line":1057},17,[1059],{"type":15,"tag":891,"props":1060,"children":1061},{"style":898},[1062],{"type":21,"value":1063},"## API 规格\n",{"type":15,"tag":891,"props":1065,"children":1067},{"class":893,"line":1066},18,[1068,1072],{"type":15,"tag":891,"props":1069,"children":1070},{"style":927},[1071],{"type":21,"value":930},{"type":15,"tag":891,"props":1073,"children":1074},{"style":933},[1075],{"type":21,"value":1076}," Endpoint: GET \u002Fdata\u002F2.5\u002Fweather?q={city}&appid={key}&units=metric\n",{"type":15,"tag":891,"props":1078,"children":1080},{"class":893,"line":1079},19,[1081,1085],{"type":15,"tag":891,"props":1082,"children":1083},{"style":927},[1084],{"type":21,"value":930},{"type":15,"tag":891,"props":1086,"children":1087},{"style":933},[1088],{"type":21,"value":1089}," 成功: 200 + WeatherData\n",{"type":15,"tag":891,"props":1091,"children":1093},{"class":893,"line":1092},20,[1094,1098],{"type":15,"tag":891,"props":1095,"children":1096},{"style":927},[1097],{"type":21,"value":930},{"type":15,"tag":891,"props":1099,"children":1100},{"style":933},[1101],{"type":21,"value":1102}," 城市未找到: 404\n",{"type":15,"tag":891,"props":1104,"children":1106},{"class":893,"line":1105},21,[1107,1111],{"type":15,"tag":891,"props":1108,"children":1109},{"style":927},[1110],{"type":21,"value":930},{"type":15,"tag":891,"props":1112,"children":1113},{"style":933},[1114],{"type":21,"value":1115}," API Key 无效: 401\n",{"type":15,"tag":891,"props":1117,"children":1119},{"class":893,"line":1118},22,[1120],{"type":15,"tag":891,"props":1121,"children":1122},{"emptyLinePlaceholder":908},[1123],{"type":21,"value":911},{"type":15,"tag":891,"props":1125,"children":1127},{"class":893,"line":1126},23,[1128],{"type":15,"tag":891,"props":1129,"children":1130},{"style":898},[1131],{"type":21,"value":1132},"## 验收标准\n",{"type":15,"tag":891,"props":1134,"children":1136},{"class":893,"line":1135},24,[1137,1141],{"type":15,"tag":891,"props":1138,"children":1139},{"style":927},[1140],{"type":21,"value":930},{"type":15,"tag":891,"props":1142,"children":1143},{"style":933},[1144],{"type":21,"value":1145}," [ ] 输入中文城市名可正常查询\n",{"type":15,"tag":891,"props":1147,"children":1149},{"class":893,"line":1148},25,[1150,1154],{"type":15,"tag":891,"props":1151,"children":1152},{"style":927},[1153],{"type":21,"value":930},{"type":15,"tag":891,"props":1155,"children":1156},{"style":933},[1157],{"type":21,"value":1158}," [ ] 温度显示为摄氏度，保留整数\n",{"type":15,"tag":891,"props":1160,"children":1162},{"class":893,"line":1161},26,[1163,1167],{"type":15,"tag":891,"props":1164,"children":1165},{"style":927},[1166],{"type":21,"value":930},{"type":15,"tag":891,"props":1168,"children":1169},{"style":933},[1170],{"type":21,"value":1171}," [ ] 加载时显示骨架屏动画\n",{"type":15,"tag":891,"props":1173,"children":1175},{"class":893,"line":1174},27,[1176,1180],{"type":15,"tag":891,"props":1177,"children":1178},{"style":927},[1179],{"type":21,"value":930},{"type":15,"tag":891,"props":1181,"children":1182},{"style":933},[1183],{"type":21,"value":1184}," [ ] 错误时显示可操作的提示文案\n",{"type":15,"tag":891,"props":1186,"children":1188},{"class":893,"line":1187},28,[1189,1193],{"type":15,"tag":891,"props":1190,"children":1191},{"style":927},[1192],{"type":21,"value":930},{"type":15,"tag":891,"props":1194,"children":1195},{"style":933},[1196],{"type":21,"value":1197}," [ ] 空状态显示引导文字\n",{"type":15,"tag":891,"props":1199,"children":1201},{"class":893,"line":1200},29,[1202,1206],{"type":15,"tag":891,"props":1203,"children":1204},{"style":927},[1205],{"type":21,"value":930},{"type":15,"tag":891,"props":1207,"children":1208},{"style":933},[1209],{"type":21,"value":1210}," [ ] 组件可单独测试，无外部副作用\n",{"type":15,"tag":30,"props":1212,"children":1213},{},[1214],{"type":15,"tag":34,"props":1215,"children":1216},{},[1217],{"type":21,"value":1218},"第二步：将 Spec 输入 AI 工具",{"type":15,"tag":30,"props":1220,"children":1221},{},[1222],{"type":21,"value":1223},"将上述 Spec 文档交给 Claude Code \u002F Cursor，AI 严格按照规格生成：",{"type":15,"tag":264,"props":1225,"children":1226},{},[1227,1232,1237,1242],{"type":15,"tag":268,"props":1228,"children":1229},{},[1230],{"type":21,"value":1231},"React 组件 + TypeScript 类型",{"type":15,"tag":268,"props":1233,"children":1234},{},[1235],{"type":21,"value":1236},"API 封装层 + 错误处理",{"type":15,"tag":268,"props":1238,"children":1239},{},[1240],{"type":21,"value":1241},"单元测试",{"type":15,"tag":268,"props":1243,"children":1244},{},[1245],{"type":21,"value":1246},"对照验收标准逐项通过",{"type":15,"tag":30,"props":1248,"children":1249},{},[1250,1255],{"type":15,"tag":34,"props":1251,"children":1252},{},[1253],{"type":21,"value":1254},"关键特征",{"type":21,"value":1256},"：规格先行，AI 按合同执行。代码质量由 Spec 保障，而非依赖 AI 的\"发挥\"。适合团队协作——Spec 就是沟通语言。",{"type":15,"tag":63,"props":1258,"children":1259},{},[],{"type":15,"tag":24,"props":1261,"children":1263},{"id":1262},"相关资源",[1264],{"type":21,"value":1262},{"type":15,"tag":264,"props":1266,"children":1267},{},[1268,1280],{"type":15,"tag":268,"props":1269,"children":1270},{},[1271],{"type":15,"tag":1272,"props":1273,"children":1277},"a",{"href":1274,"rel":1275},"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fspec-kit",[1276],"nofollow",[1278],{"type":21,"value":1279},"SpecKit GitHub仓库",{"type":15,"tag":268,"props":1281,"children":1282},{},[1283],{"type":15,"tag":1272,"props":1284,"children":1287},{"href":1285,"rel":1286},"https:\u002F\u002Fgithub.github.io\u002Fspec-kit\u002F",[1276],[1288],{"type":21,"value":1289},"Spec-Driven Development方法论",{"type":15,"tag":1291,"props":1292,"children":1293},"style",{},[1294],{"type":21,"value":1295},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":914,"depth":914,"links":1297},[1298,1299,1304,1308,1315,1316,1317,1318,1319,1320,1321],{"id":26,"depth":904,"text":26},{"id":68,"depth":904,"text":68,"children":1300},[1301,1302,1303],{"id":74,"depth":914,"text":77},{"id":85,"depth":914,"text":88},{"id":96,"depth":914,"text":99},{"id":248,"depth":904,"text":251,"children":1305},[1306,1307],{"id":254,"depth":914,"text":257},{"id":300,"depth":914,"text":303},{"id":327,"depth":904,"text":330,"children":1309},[1310,1311,1312,1313,1314],{"id":333,"depth":914,"text":336},{"id":367,"depth":914,"text":370},{"id":396,"depth":914,"text":399},{"id":430,"depth":914,"text":433},{"id":459,"depth":914,"text":462},{"id":491,"depth":904,"text":491},{"id":522,"depth":904,"text":525},{"id":665,"depth":904,"text":665},{"id":701,"depth":904,"text":701},{"id":752,"depth":904,"text":752},{"id":859,"depth":904,"text":862},{"id":1262,"depth":904,"text":1262},"content:paradigms:spec-coding.md","content","paradigms\u002Fspec-coding.md","paradigms\u002Fspec-coding","md",1777287374603]