AWS re:Invent Recap
Spec-Driven Development with Kiro (DEV314)
Recap Series
Session Notes
Introduction to Kiro and Spect Driven Development
Overview
- Kiro is a new agentic IDE released recently, emphasizing Spect Driven Development.
- It aims to improve code quality and review processes through structured workflows.
- IDEs became popular for integrated tools like compilers and debugging.
- AI editors emerged, starting with code completions and evolving to agentic experiences.
- Developers now steer AI agents for code authoring and review, maintaining control.
- Vibe Coding vs. Spect Driven Development:
- Vibe coding involves rapid prototyping but lacks the traditional SDLC lifecycle.
- Spect Driven Development introduces a structured workflow from requirements to output, focusing on upfront planning to improve model focus and output quality.
- Spect Driven Development Workflow:
- Starts with requirements, followed by design, task list, and implementation.
- Allows iterative refinement until the desired output is achieved.
- Includes hooks for validating changes, such as spell checking and enforcing coding principles.
AI Editors and the Evolution of Software Development
AI Editors
- Evolution to more agentic experiences where developers input natural language, and AI edits multiple files.
- Fundamental shift: Developers steer AI agents to author and review code, maintaining control over the workflow.
- Vibe Coding:
- Popular workflow where developers write prompts, AI generates code, and the cycle repeats.
- Effective for rapid prototyping but lacks traditional SDLC lifecycle, leading to challenges in context and decision-making.
- Spec Driven Development:
- Introduced to address the challenges of vibe coding by emphasizing upfront planning.
- Structured workflow from requirements to output, focusing on better model focus and output quality.
- Workflow includes requirements, design, task list, and implementation, allowing iterative refinement.
- Addresses the issue of "AI" by incorporating hooks for validating changes, ensuring code quality.
Spect Driven Development
Hooks for Validating Changes
- Kiro incorporates hooks to validate changes during the development process.
- Examples include spell checkers for documentation, tone and style checks, and enforcing coding principles like the single responsibility principle for UI components.
- Job Seeker's App Concept:
- Core idea: Address the broader aspects of job seeking beyond interview preparation, including style, tone, and actual interview performance.
- Elevator pitch: Users log in, set up a profile, and engage in interview prep with a question-answer flow, receiving both qualitative feedback and a quantitative score at the end.
Kiro Interface and Features Overview
Kiro Interface
- Overview of a brand new app with Tailwind CSS installed.
- Kiro Menu:
- Agent hooks: Background processes triggered by events like file save or delete, useful for updating documentation or localization.
- Agent steering: Rules files for coding and design standards, automatically generated based on the application's current state.
- Specs: Structured workflow from requirements to output, ensuring a clear path from idea to implementation.
- MCP: My Code Partner servers, allowing integration with various AWS services and products, with recent enhancements for easier installation.
- Agent Hooks:
- Pre-built hooks available for common scenarios, with flexibility to specify certain file types.
- Agent Steering:
- Automatically generated steering files based on the application's current state.
- Example: Product and tech files created for a Vite web application with TypeScript and Vite.
- MCP Servers:
- Continuously expanding list of MCP servers for different services and products.
- Recent addition: One-click installation for MCP servers via kiro.dev.
Spect Driven Development in Kiro
Overview
- Spect Driven Development is the core focus of the talk, emphasizing a structured workflow from requirements to output.
- Kiro supports various AI models (Sonnet 4.5, 4.4, Opus, Haiku) with an auto-selection feature to choose the best model.
- Creating a Job Seeker's App:
- Using a diagram as a design input, Kiro is prompted to create a job seeker's app.
- The process starts with generating a requirements document based on the provided design.
- Requirements Document:
- Kiro unpacks the initial prompt into a set of requirements defined as user stories with acceptance criteria.
- User stories provide a human-readable format for feature definitions, while acceptance criteria detail the specifics needed for implementation.
- User Stories and Acceptance Criteria:
- Example user stories include log in, profile management, and interview prep session.
- The process involves reviewing user stories to ensure they align with the desired features before delving into the acceptance criteria for detailed implementation.
Refining Requirements and Moving to Design Phase
Reviewing and Refining Requirements
- Kiro allows for iterative refinement of requirements. In the example, certain requirements (1, 2, state persistence) were removed, and others (3, 4, 5, 6, 7, 8) were retained for the MVP scope.
- Emphasis on the importance of going back and forth in the process to ensure the requirements align with the desired outcome.
- Workflow Flexibility:
- Kiro supports different workflows, including vibe coding for quick prototyping and Spect Driven Development for structured planning.
- Developers may prefer vibe coding for initial interface and feature considerations before transitioning to a more structured approach.
- Design Phase:
- Once requirements are finalized, Kiro generates a design document based on the existing codebase.
- The design phase includes creating architecture diagrams and property tests to ensure the system meets the specified requirements.
- Iterative Process:
- The process is iterative, allowing developers to refine requirements and design documents until they are satisfied with the outcome.
- The generated documentation serves as a valuable reference for future development and maintenance.
Reviewing and Enhancing the Design Document
Design Document Overview
- Kiro generates a design document based on the refined requirements, including a high-level architecture and component overview.
- The design document uses mermaid diagrams and markdown for clear visualization and documentation.
- High-Level Architecture:
- The architecture includes a start screen, question screen, results screen, local storage for data persistence, and the web audio API for recording audio responses.
- Component Breakdown:
- Key components identified: start screen view, question screen view, session state capture (questions and responses), question bank (MVP), and storage session.
- Identifying Gaps:
- Missing features identified: transcription of audio from user responses and detailed analysis of results.
- The design document lacks specifics on how audio will be transcribed and how results will be generated and presented.
- Enhancing the Design:
- Additional requirements added: transcription of text as the user speaks and additional analysis for results.
- The ease of adding new requirements using natural language prompts is highlighted, emphasizing the convenience of AI-assisted documentation.
Enhancing the Design and Moving to Task List
Updating the Design Document
- Additional features were added to the design document, including transcription of audio using the Cloud SDK and detailed analysis of results.
- Checkpoint and restore functionality was introduced to allow easy reverting to previous states without relying on version control systems.
- System Diagram Updates:
- The system diagram was updated to include the transcription service (speech-to-text using Cloud SDK).
- Task List Generation:
- The workflow moves to generating a task list based on the updated design document.
- Tasks include creating data models, implementing audio recording service, response validation storage, and AI integration.
- Flexibility and Refinement:
- The workflow allows for manual edits and refinements to be integrated into the design document.
- Tasks can be reordered or prioritized to focus on achieving an MVP scope quickly.
- Optional Tasks:
- Property-based testing tasks are set as optional by default, allowing developers to focus on core features before addressing additional tests.
- The task list can be refined to prioritize specific tasks for quicker MVP development.
Task List Prioritization and Implementation
Task List Flexibility
- The task list can be refined and reordered to focus on achieving an MVP scope quickly.
- Tasks can be grouped to reduce the number of tasks, making the workflow more manageable.
- Test-First Development:
- Developers can choose to write tests first if they prefer a test-driven development approach.
- The workflow supports different development styles, allowing for customization based on team preferences.
- Core MVP Tasks:
- A core MVP was identified with five tasks: set up dependencies, create core data types, implement application state management, implement audio recording, and speech tests.
- Additional tasks include implementing response validation storage and creating the start screen component.
- UI Inclusion:
- The initial phase may not include UI components, but it can be adjusted to include UI for visual testing and interaction.
- Task Implementation:
- Tasks can be started via UI clicks or through chat commands.
- Kiro executes tasks in order, running terminal commands to install dependencies and create necessary files.
- The process is iterative, allowing for quick adjustments and refinements based on the evolving requirements and design.
Property-Based Testing Overview
Structured Requirements
- Requirements are defined in a user story acceptance criteria format.
- Allows for logical equivalence and formal reasoning on the requirements.
- Properties and Formal Reasoning:
- Properties are characteristics or behaviors that should hold true across all executions of a system.
- Kiro extracts properties from the Gherkin format requirements and uses a framework called Fast Check for property-based testing.
- Gherkin
- Is a plain-text language used in Behavior-Driven Development (BDD) to write software behavior scenarios in a structured, human-readable format, primarily using the Given-When-Then structure.
- Feature: Describes the functionality being tested.
- Scenario: A specific example of the feature in action.
- Given: Sets up the initial context or state before the action takes place.
- When: Describes the action that the user or system performs.
- Then: Defines the expected outcome or result of the action.
- And/But: Used to add more steps to the same keyword (Given, When, or Then) without repeating it.
- Fast Check Framework:
- Fast Check allows for fuzz testing by generating a range of values to test against the properties.
- Unlike unit testing with limited inputs, property-based testing provides more evidence that the generated output maps to the requirement.
- Example of Property-Based Testing:
- A chess app was created using Kiro, and property-based tests were used to ensure the app worked as expected.
- Tests included checking that any move generated by the AI was valid against the movement registry.
- Fast Check runs the tests multiple times with random changes to ensure robustness and reduce bugs.
- Property-based testing enhances the quality of the code and reduces the likelihood of bugs.
Diagnostics Tool
- Kiro's diagnostics tool helps identify and resolve issues during task execution.
- It reads linting issues from the editor and provides feedback to improve the development process.
- The tool has reduced the number of issues encountered during task completion.
- Task Execution:
- The app includes behavioral, technical, and leadership questions for interview preparation.
- The app is connected to a Sonnet 3.7 model for generating responses.
- Optimized Demo:
- The final app demonstrates the interview prep practice with questions and responses.
- The app allows users to practice answering technical questions and receive feedback.
- The demo highlights the functionality of the app, including the ability to record and transcribe responses.