In the field of AI programming tools, developers have been accustomed to two mainstream interaction modes. The first is the "dialog Q&A mode", where users communicate project requirements and get code snippets through dialog with the AI. Cursor ,Cline The second is the "Agent model", where the user gives an explicit instruction and the AI autonomously disassembles and executes a series of sub-tasks, requiring constant confirmation from the user. The second is the "Agent model", in which the user gives an explicit instruction and the AI disassembles and executes a series of subtasks, requiring constant confirmation from the user. While this model is powerful, the uncontrollable nature of the process can sometimes be risky.
Recently, an AI programming IDE called Kiro introduced a program called Spec
The new model, which centers on the concept of "plan before you build". Prior to formal coding, theKiro
mandates that detailed requirements and design documents are first created with the user. This methodology attempts to get to the root of the problem of poor code quality in AI programming due to ambiguous requirements.
Engineering Processes for the Kiro Spec Model
The following is a step-by-step demonstration through an actual project Kiro
Spec
Patterns for specific processes and ideas in software development.
Step 1: Build the requirements document (requirements.md)
When a developer sends a request to the Kiro
It doesn't start writing code immediately after an initial requirement is made.Kiro
It will first create a file in the project's home directory named ~/.kiro/specs/项目名称
folder. It then analyzes the structure and functionality of the current project and thinks about and extends it based on the initial requirements, structuring the results of these reflections into a document named requirements.md
of the requirements document.
This documentation is stored in the above path for review, modification and validation by the developer. The content of the document usually contains Kiro
The original requirements are understood, split and refined to form multiple clear requirement points. This step ensures that the developer and AI agree on the scope and goals of the project, avoiding rework at a later stage due to inconsistent understanding.
Step 2: Build the design document (design.md)
After the requirements document is validated, the process moves to the second step.Kiro
will be based on requirements.md
automatically generates a technical level design document for the content in the design.md
The
This design document is equivalent to a preliminary technical development program. It maps out the project's module divisions, key function definitions, data structures, API interface design, and so on. Through this document, developers can evaluate whether the technical solutions proposed by AI are feasible and efficient, and have the opportunity to make adjustments before coding begins. This front-end design session helps ensure the rationality of the project architecture.
Step 3: Build the task list (task.md)
After the design documentation is confirmed, theKiro
It will be translated into a specific implementation plan that is task.md
Documentation.
This file is essentially a Todo List, detailing the Kiro
Each specific action to be performed next, e.g., "Create a main.py
Documentation", "Realization calculate_sum
Functions", "Add error handling logic", and so on. The transparency of the task list allows developers to clearly anticipate each step of the AI's operation, thus building a sense of control and trust in the entire coding process.
Step 4: Task implementation and feedback
In the developer's view of the task.md
After final confirmation of the plan in theKiro
The coding process will then begin to be executed strictly according to this list.
In the course of implementation.Kiro
Real-time feedback is given to the user on the progress of tasks, such as which task has been completed and which one is currently being executed. This deterministic workflow, in contrast to traditional Agent
Contrasting with the "black box" status of the model's possible implementation.Spec
Every code generation under the model is based on pre-confirmed, clear documentation and plans, which greatly improves the accuracy and reliability of the final delivered code.