Design a Screen, Ship a Clean Architecture Feature: Spec-Driven Development for Stable AI-Generated KMP Code
A living spec, a few guardrails, and an architecture the model isn't allowed to break.
重點摘要
AI-generated features drift when prompts are isolated and architecture is not enforced.
KMPilot combines design tokens, a living spec.md, and strict Clean Architecture guardrails.
Features are built, modified, tested, and reviewed through staged skills and agents.
The article explains why AI-generated Kotlin Multiplatform code tends to drift when features are built one prompt at a time: patterns change, layers leak, tests disappear, and screens stop matching design. To prevent that, Ali Sadeghi built KMPilot, a spec-driven workflow that treats Clean Architecture as a constraint, uses approved mockups as input, and keeps a versioned spec.md as the feature’s memory. A feature is built in stages: design is captured from Stitch, then the build proceeds through specialized skills and agents for data, UI, integration, and platform code. The same contract also governs later changes, while verification, testing, and review steps keep code and spec aligned.
设计一个界面,交付一个符合 Clean Architecture 的功能:用规格驱动让 AI 生成的 KMP 代码不再漂移
一份活的规格、几道护栏,以及一个模型不能打破的架构。
重點摘要
AI 逐步生成功能时,若缺少架构约束,代码很容易漂移。
KMPilot 通过设计稿、spec.md 和 Clean Architecture,把规则固定下来。
功能由设计、构建、测试与审查的分阶段技能和代理协作完成。
文章说明,当 Kotlin Multiplatform 功能按提示词逐步生成时,AI 代码常会出现模式漂移、层之间互相渗透、测试流失以及界面与设计稿不一致等问题。为解决这些情况,作者构建了 KMPilot,把 Clean Architecture 设为不可突破的约束,并用已批准的 mockup 作为输入,再以版本化的 spec.md 记录每个功能的契约与决策。实际开发中,设计先由 Stitch 转化为蓝图,随后由不同技能与代理分别处理数据层、UI、集成与平台代码;后续修改、验证与测试也都依照同一规格执行,从而避免代码与规格脱节。
畫出一個畫面,交付一個符合 Clean Architecture 的功能:以規格驅動穩定的 AI 生成 KMP 程式碼
一份活的規格、幾道護欄,以及一個模型不能打破的架構。
重點摘要
AI 逐步生成功能時,若沒有架構約束,程式碼很容易漂移。
KMPilot 透過設計稿、spec.md 與 Clean Architecture,把規則固定下來。
功能會經由設計、建置、測試與審查的分段技能與代理完成。
本文指出,當 Kotlin Multiplatform 功能一次只靠一個提示詞生成時,AI 程式碼很容易出現模式不一致、層級互相滲透、測試流失與畫面偏離設計等問題。作者因此打造 KMPilot,以規格驅動流程把 Clean Architecture 當成硬性約束,並以核准的 mockup 作為輸入,再用版本化的 spec.md 保存每個功能的契約與決策。實作時,設計先由 Stitch 擷取成藍圖,接著再交給不同技能與代理分工處理資料層、UI、整合與平台程式碼;後續修改、驗證與測試也都依同一份規格進行,避免程式與規格分離。