Using Spec-Driven Development for Production Workflows - Erik Hanchett, AWS
AI Engineer · 17 min · 199 sentences · from YouTube's caption track
Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.
- 00:00Hey everyone, my name is Eric Hanchett, and today I want to tell you guys all about spec-driven development and how you might use it in your workflows today.
- 00:09So, there's a couple of things we want to talk about.
- 00:11First, what is spec-driven development?
- 00:14And then, how can it make you a better and faster coder?
- 00:18So, we just don't want you to code faster, but we want you to actually create higher-quality code from it.
- 00:25And I think really spec-driven development helps you with this, and I'm going to explain why and how.
- 00:31It's a structured specifications are created before any code is written.
- 00:35That's the definition of really the specs or the requirements of this spec-driven development, and it goes to the heart of what it is.
- 00:43So, what we're doing is we are writing these markdown files, we're writing the specifications and the design document before any of the code is written.
- 00:54And this actually works really, really well with large language models and our coding assistants that we use.
- 00:59And I'm going to show you exactly how that works.
- 01:02Now, a question I sometimes get is why?
- 01:05Like, why should we use this spec-driven development workflow and then how can we do it?
- 01:11So, to answer that why question, I kind of like to think about our coding assistants, our large language models that we're using every day as sort of like AI interns.
- 01:22You need to really prompt them, you really need to push them the right way, no pun intended with the prompting.
- 01:28So, you really need to guide them.
- 01:31Because if you give them just a little bit of of leeway, they will go off the rails.
- 01:37And really the spec-driven development helps guide them in the right direction.
- 01:41I remember when I was an intern in one of my first jobs, we had a VP that would walk around and he would just come up with random ideas
- 01:49off the top of his head.
- 01:50And when he told me it, I would drop everything and work on it.
- 01:54And then later my boss would be like, "Hey Eric, why did you drop everything?"
- 01:58Well, the the VP said something.
- 02:00And then I learned about, well, you got to take his information that he gives you, write it down, put it in your schedule, talk to me talk to my manager about it.
- 02:09So, I was a little too eager.
- 02:10And this is what AI interns or basically these large language models do nowadays.
- 02:14And we got to be careful about it.
- 02:18I didn't really give you too much of introduction, so I'll give it to you now.
- 02:22My name is Eric Hanchett.
- 02:23I'm a senior developer advocate at AWS.
- 02:26I have over 15-plus years of software development experience.
- 02:31And if you want to connect with me, you can check out LinkedIn.
- 02:34That's probably the best place to go.
- 02:37I just look for Eric Hanchett and yeah, talk to me, follow me.
- 02:41I'd love to talk to you more about it.
- 02:44Another question when I that people often ask me about spec-driven development is, "Can't the latest frontier models just do everything for us already?
- 02:53Why do we need this?"
- 02:55And while I do say that the models are getting better and better every year and and every release, sometimes incrementally, sometimes by leaps and bounds, it's still not perfect.
- 03:04And giving the large language model these models more context is actually really important because it does help guide it in the right direction.
- 03:13And with our software always changing and with the requirements always changing, and with new paradigms and shifts, you always need to kind of guide it where it needs to go.
- 03:23Some large language models, some harnesses are starting to think more about this and adding in a little bit more of a thinking or planning mode before it jumps into when it writes code.
- 03:34But there's nothing better than actually having those documents created and having you be in the middle before it jumps into the net that next part with it creating code.
- 03:46So, let's keep a few things in mind before we get too far.
- 03:49There is quite a lot of information out there.
- 03:53I have some opinions.
- 03:54These are my opinions.
- 03:56Uh let me know.
- 03:57Connect with me on LinkedIn if you agree or disagree, but I think you need to keep these in mind before using spec-driven development or vibe coding or anything in between.
- 04:06We have to You have to be careful with context.
- 04:09Now, I told you before that spec-driven development gives you a lot of context that gets fed into that large language model, but sometimes you have too much of a good thing.
- 04:17Uh what you need to do is when you are working with these large language models, usually you create like an agents.md or claw.md at the beginning with some information in it.
- 04:27I would be very careful not to put too much information or too little information in that.
- 04:32Kind of like that Goldilocks zone of information is what you need.
- 04:35So, you just need to give it enough rules and guidelines that it knows what to do.
- 04:41Uh we call it steering docs in Cara, which I'll mention about in a minute, but you just got to be very careful what you put in those documents.
- 04:49I also highly recommend when you're using spec-driven development to use skills.
- 04:54Skills are like instruction files that you can give to your coding agents that are ran on demand.
- 05:01So, usually they have keywords in them, and when the coding assistant sees those keywords, they'll activate the skill or you can do {slash} and the skill name and then run it.
- 05:10But, this actually really helps when you're doing the spec-driven development process.
- 05:13You can actually add skills um when it creates your design documents or whatever else.
- 05:18You can use those in parallel or with the spec-driven development or when you actually implement the tasks.
- 05:26And just be careful about giving too much trust.
- 05:29Uh remember everything in the spec-driven development flow is you, meaning that you are the human in the loop, so to speak.
- 05:38You need to be the code reviewer of all the code that's generated through this process.
- 05:43You need to be interactively looking at the design documents and the requirements documents that are created because at the end of the day, if something goes wrong, you are the person that are going to be blamed for it, not the agent.
- 05:58And uh that's not to say that we don't use tools to help do code reviews.
- 06:03Someone once told me like, are you saying you're the human in the loop, you do the code review, no one else?
- 06:07Of course, we might have multiple be doing people doing code reviews and definitely use your normal AI coding assistants and and review tools to help you review any pull request that you create.
- 06:20Or CRs.
- 06:25So, let me give you a little bit of a history lesson of where we have been, especially at AWS.
- 06:32We uh saw this need, especially from our teams and our customers, that they were vibe coding, they were using this coding assistance, but they weren't getting the outputs that they wanted.
- 06:42And what we saw is this these customers were using this bespoke pattern of having the agents, the coding assistants, create uh these full down requirements documents and these design documents and we decided to create
- 06:57a application to kind of do this all for them.
- 07:02So, we released Qiro uh early late last year in a general availability.
- 07:08It's our new AI IDE coding assistant.
- 07:11We also have a command line interface or CLI version, which is just as popular.
- 07:16I think right now it's switching.
- 07:18Most people are starting to use CLIs more often than IDEs.
- 07:21So, if you like to do that, you can use the CLI.
- 07:25But, what we really focused in on with Qiro is, you can see in these screenshots, is this vibe and spec mode.
- 07:32So, we're going to jump into spec mode in a little bit, but we really thought this really encompass what we were hearing from our customers, what people wanted more
- 07:40ways to work with larger features and more complex projects and they really needed the coding system to know exactly what their project was doing.
- 07:52We also released the website at kiro.dev.
- 07:55Feel free to after this presentation to go check it out.
- 07:57You can download our CLI, our IDE, and give it a whirl cuz you know, we're really proud of it.
- 08:04It's fun.
- 08:04When we released this, it actually went a little bit viral.
- 08:07We got tens of thousands of downloads.
- 08:08A lot of people were asking us asking us about Kiro so we were really happy to to release this and we actually when we set it up in preview, we had so many downloads we had to put a gate in front of it and then people found a around the gate, but now it is publicly available for
- 08:23everyone to try and and and give it a shot.
- 08:28But I don't want this to be a half-hour pitch for Kiro.
- 08:32You can do this process spec-driven development without Kiro and there's a few few ways.
- 08:37One is that you basically have to just you can do this manually with anything.
- 08:42You could tell the your assistant, your large language model to include the following.
- 08:47First is the user requirements.
- 08:49You would tell them please based on XYZ create a whole set of user requirements.
- 08:54Now, you can feed it your own user requirements beforehand and say, okay, use this as a basis or you can have the editor or the AI IDE go ahead and create it for you.
- 09:07Then you look back and forth and make sure it's okay.
- 09:09Then you tell the assistant to create the design document.
- 09:14Then you look back at that and then you have it create the implementation details.
- 09:18These are the the tasks list, the tasks one by one to actually implement it based on the requirements and the design document you created.
- 09:25So you could do this kind of a manual way if you like.
- 09:30I'll give a shout-out to Spec It.
- 09:32This is GitHub's open source way of doing this process.
- 09:36You can install it in a variety of different coding assistants.
- 09:41Now, in Kiro, you have this lab This is the IDE version.
- 09:45We have plan mode inside the CLI if you prefer the CLI, but in the IDE you would choose spec.
- 09:51And then you would go ahead and give it a prompt.
- 09:54So, in this case I could say like build a movie MCP server to keep track of movies I've watched or build an a movie website, whatever you want.
- 10:01Now, you're probably thinking is this spec only good for greenfield brand new projects?
- 10:07And I would say absolutely not.
- 10:09I've seen existing apps that are years old have dozens and dozens of these different spec files in them.
- 10:16And this example, it's kind of more of a greenfield, but you can definitely use it for existing legacy projects as well.
- 10:22It thinks it works very well.
- 10:24And I would just say that these are really good for when you're doing in-depth features, when you need your project needs a little more upfront planning, uh and you just want to build things in a structured way.
- 10:35For definitely works really well with complex projects.
- 10:38We actually added a spec mode for bug fixes, too.
- 10:41So, you can use it for smaller things, though you may want to just kind of vibe code those things instead.
- 10:49Here's what our requirements document looks like.
- 10:52So, in the first part it creates this uh requirements phase where it's in this ears format and it gives you the introduction, like the requirements, the user stories.
- 11:01Uh we also have a process where it asks you questions beforehand.
- 11:05And so, we added in some extra question and answer.
- 11:08So, as you put your prompt in, it'll ask you some clarifying questions before it creates this requirements phase.
- 11:14You can also do this quick plan mode we just added, which uh will go ahead and just generate all these documents quickly for you based on the questions and answers you give.
- 11:23So, there's a lot of different ways you can do this.
- 11:26Then you'll create a design document, which is a higher-level design document.
- 11:29You can also start with the design document first.
- 11:31Some people kind of take this design and requirements, combine them.
- 11:35But typically with with our spec-driven development flow, you can either start one or the other.
- 11:40And then you might have mermaid diagrams here, ASCII art with all the information.
- 11:44Now, this is at the point I would highly recommend, if you're trying this at home, to stop and go in and update it with your knowledge and expertise and taste
- 11:54to exactly what you're looking for.
- 11:56Because it's only as good as what you put in.
- 11:59But you'll find out that it even with a smaller prompt it and with the clarifying questions, it does a pretty good job.
- 12:07And course you always want to review it for markdown the markdown files for inconsistencies, hallucinations, and errors.
- 12:13And then finally you get to the implementation phase.
- 12:15This will be a list of tasks.
- 12:18Uh it also has something called property-based tests in them, which are tests that are against the requirements document and design document.
- 12:26You can additionally have those created and ran.
- 12:29I would highly recommend it, so that way it makes sure that the the tasks actually are implemented correctly.
- 12:35I usually also, uh quick tip here, once it creates this task list, I tell it, "Please take the top four tasks, put them at the top, and create an MVP for me first."
- 12:46So that way I can actually see it working.
- 12:48And then I'll implement them I'll implement the MVP version first.
- 12:55Now, I love model context protocol.
- 12:57I'm not going to go into exactly all the details of it, but it's a way essentially for your model providers to connect to different data sources.
- 13:05So, in this case, I'm using Kiro, and maybe I'm using like OpenAI or Anthropic, and we want to connect to different data sources.
- 13:14So, we have this MCP protocol in the middle, and it connects everything together for us, which is awesome.
- 13:23Now, I get this question, "Isn't MCP 6 months old and it's dead now?"
- 13:27Now, a lot of people on the internet have opinions that change every other day, and some people were saying that, well, you can do a lot of stuff with MCP just with command line tools.
- 13:38I really think MCP is still maturing.
- 13:39There's a lot uh a long road ahead for it, especially with some of the security stuff it's doing.
- 13:46I would keep an eye out for MCP, but one of the main reasons I like it, especially for the Spec Driven Development Flow, is you can have something like in Jira or Asana,
- 13:56all your tickets, all your uh large requirements docs, and then you can have it being pulled into your Spec Driven Development Flow when it creates your specs, which makes it much easier to work with.
- 14:08So, if you have a product manager that has actually written a requirements document, you can pull that in.
- 14:16And uh it just makes a little bit easier.
- 14:17And I'm I'm talking about any any kind of project management service.
- 14:21And grab technical details for it.
- 14:25You can also put additional rules in your steering or your agents.md files that tells it, so if you're using Spec Driven Development Flow, make sure you grab the information out of this MCP server.
- 14:35And that way it knows where to look.
- 14:37Or you can just specify it in the first step, like, "Hey, look at this MCP server when you create the requirements."
- 14:45So, let me show you a quick demo.
- 14:47This is the latest version of Kiro, the IDE version.
- 14:53And let me give you a a quick show of it.
- 14:56Now, just for the sake of time, I don't have time to actually go in and create a brand new project from scratch, but I used this one.
- 15:03It's a movie database.
- 15:05So, this is more of a green field, brand new project, but I think you'll still get the idea.
- 15:09I was in the spec mode here.
- 15:10I said, "Please create me a movie website."
- 15:14So, what it did is it started with this design document.
- 15:17And this case In this case, I actually told it to start with design instead of requirements.
- 15:21And then this shows the actual preview of the markdown file.
- 15:27So you can see it created a bunch of different mermaid diagrams that show the architecture of it.
- 15:32Gives you sequence diagrams.
- 15:33And so I went back and forth with this and updated and edited and it created this all for me.
- 15:39If I scroll down to the bottom of this document it created, you can see here it created a bunch of property test tests.
- 15:47And these are really special tests.
- 15:48It uses fast check in this TypeScript in the node world to do these tests which actually run dozens if not hundreds of times with different values to make sure that
- 15:58it's uh these requirements are satisfied correctly, which is really nice.
- 16:04And then it created this requirements document in once again this EARS format, so it's really uh very simple with these user stories, requirements.
- 16:12Uh let me see if I can open it up again.
- 16:14Here's it in preview.
- 16:16Uh so here's the requirements document.
- 16:18Requirements one, movie data loading.
- 16:20When the application initialize, the filter engine shall load.
- 16:23So it kind of gives you step-by-step exactly what's uh what it's doing here.
- 16:29And then when I went back and forth with this, I got to the task list and I asked it, "Hey, in the task list, can we create like an MVP?"
- 16:35So it went ahead and updated the task list and even says right here, "Task one through four deliver a working MVP, browsable movie grid with search, genre filtering, sorting,
- 16:45and the full 80s synthwave theme."
- 16:47So it actually redid all the requirements and to get this uh basically MVP up and running out of the door, which I really enjoyed.
- 16:56I went ahead and just implemented all of them after that, but you could see how it works.
- 17:01You can also see it created this property paste based tests, which are nice which I can go back in and take a look at the execution.
- 17:08You can also, let me see if I scroll to the bottom here.
- 17:11Here it is.
- 17:12So if I just kind of hover, it shows like a little bit of information about the property-based test.
- 17:18Like with property test test for genre filtering for any movie data set and if the extracted genre list must contain exactly a sorted set of unique genre.
- 17:26So, it tells me exactly what it did at this point.
- 17:28So, if you want to learn more, you can go to kiro.dev or you can join our Discord at discord.gg/kiro.dev.
- 17:34I highly recommend everyone watching check it out and make sure you connect with me on LinkedIn at Eric Hanchett.
- 17:40Love to just connect with as many people as I can and also on Blue Sky at Eric C H or X. Thanks.