Transcription
Hello and welcome back to another episode of Neural Flow, where I'll be taking you through my journey as a re-imagined engineer. My name is Dan. Uh, I spent many years as a software engineer and now I'm really rethinking how can I make AI the center of my new engineering process. And what I'd like to do is share a bit of my journey with you tonight.
So tonight, we're going to focus on a couple of features in GitHub Copilot. One of which is called uh, custom prompt files, which is a way for us to create a templated prompt uh, that can describe a number of actions or tasks that might be performed um, and really rerun that prompt over and over, changing parameters uh, to do repeated tasks. Very, very handy, very, very good way of doing things like repetitive package upgrades. Great at following a set of predefined steps or tasks you define in the prompt.
An example of a prompt file is this here. So, a prompt file is just a markdown file. It can either be in your repository, your workspace, in the GitHub prompts file folder. Uh, it has a file name of um, star.prompt.md and you can see I've got a create specification one right here. So, this particular prompt um, if we look at it, is designed to create a new specification file for a solution optimized for generative AI consumption. Now, I use this particular prompt for looking a piece of my codebase, creating a specification from it, or alternatively, if I'm creating a new feature or function, I describe that uh, function and then get this prompt to create a new specification for it.
Now, specification files are very formal. They are well-structured um, in a way that really resonates with me. You might have your own pre-preferences, but the interesting thing here is I can also give prompt files access to specific tools. So, I can say, these are the tools you're allowed to use. In this case, I've used pretty much all the built-in ones. Uh, if you're not sure which tools you have, you can look down in your chat mode and click the tools button and you'll see a large number of tools here. Um, these will depend on the MCP servers you've got installed and the extensions that you've got installed. Some tools are provided by extensions and they will start with the extension uh, word. Others that are MCP based will start with MCP server. Easy. But in this case um, we can actually configure these tools in our prompt file by clicking the configure tools and turning the ones we want on and off. Uh, but we're not going to worry about this. We're just showing you how it works.
We can also parameterize our um, our prompt files, which means that when the prompt file is run, the agent will attempt to populate these input variables and there are a number of them which we'll we'll show you to the documentation in a moment. There's a number of them which will control how this prompt is executed and provide input into the prompt. Some of these are uh, things you can define. Some are things like the current file open or the current code that's selected. Um, all of that is really is really well documented. But in this case, I've created a prompt to create a specification and it is very specific about what it creates and in fact, it has an example template of the sort of specification I want created. It's given full examples around requirements, structuring of requirements, what I want it to look like, uh, formats, everything. Um, and I can show you an example of what this prompt has created.
So, here is an example of a running this prompt file on one of my existing uh, parts of my codebase, which is a semantic model repository. Uh, you don't need to worry about what that is. But as you can see, it's created a full specification for me, which I can then use to evaluate uh, against my own codebase to say, am I missing anything? It's also a good way of documenting what's in the codebase. I can also use this to create um, diagrams or uh, even change this specification and then use that to build get copilot to build new code or other developers to build new code to meet that specification. It is my preferred mechanism of development, always starting with a specification. But that's not what we're here to talk about. What we're here to talk about is these these prompt files.
So, let's run a prompt file. Really quickly. So, how do we run them? So, first thing we're going to do is we're going to press Control Shift I to bring up our chat panel, which I'd already bought up our a um, Copilot chat. Um, pressing Control Shift I or Command Shift I will automatically jump you to agent mode. And to activate one of these prompt files, we just press slash. Now, you can see I've got a few available. And we're going to talk about some of these suggest ones in a moment, but let's just do a create specification and we'll talk about um, we would like I'd really like to create a specification on the data um, on, let me see, I'd like to create a specification on the connection manager, on the connection manager uh, class. The reason why I'm doing that is I know I've got a few not a few bugs, but I know I've got a few areas of my codebase in the connection manager which I really would like to improve. Now, I could go straight in there and start coding, of course, I could um, but I like to have a specification just to help me understand what does this currently look like and then I can start having a bit of conversation with Copilot around what might I improve with this? Is there any gaps or any problems?
So, this might take a few seconds, but it is going to produce a specification in the specs f folder or spec folder down here. That is because in my prompt file, I was very clear about how do I want to name this? Where is it going to be put? Um, and how is it going to be structured. This saves me a lot of time. I could have tried or written that by hand, but of course, I'm going to forget it. I could have of course stored it as a text file or markdown somewhere and copied and pasted it in here, but that's a very inelegant way of doing this. But while this is working, I'm also going to mention how do you get these large prompt files? Well, that is actually the second part of the discussion of today that I'm going to show you. It's a bit it's a bit inception here. We're going to show you how to use a prompt file to download, find, and download prompt files from open repositories.
Now, there are a couple of repositories out there. Uh, there is one created by GitHub just in the last couple of weeks called Awesome Copilot, and I'll show you to that one. I actually have my own as well, which uh, was created around the same time. And I am contributing all my prompts into the Awesome Copilot repository just so that we get everything in one place. But I wanted to make it really easy to go and get these. So that's what we're going to talk about in a moment. But in the meantime, we have now got our specification. It's still being built out as you can see. It's a it's quite a long one. I have quite a lot of requirements. Um, it has identified a a number of key elements, key areas. Uh, and you can see the little square dot means it is it has been changed. Um, but let's go and uh, open that up again and it's still doing last checks. Um, I see it's looking at dependencies. It should hopefully won't be a few more moments before it's finished this. Um, so here it's given us a summary that has completed our specification.
Now, this is a really great asset that we commit to our repo. We keep up to date with our with our application and in fact, we use it to write our code or get our get Copilot to write our code. So, I'm going to keep this. I'm going to assume it's right. We don't really have time to go into the detail. I of course normally would check through this and make sure a it's correct, but b my understanding of it is correct. That's really important. I need to understand this. It's not just computer-generated. So, we've now got our specification. Um, let's go and uh, implement this. We could just send Copilot to go and actually let's let's let's do something else. Let's see if there are any problems with this specification that could be pro improved. I in fact know there is, but I'm going to be I'm going to I need I need a chat mode to help me do this.
Now, we haven't talked about chat modes. Uh, of course, when you have open up GitHub Copilot in Visual Studio Code, you have you have three chat modes: agent, ask, and edit. You can actually create your own custom chat modes. Now, these change the behaviors. They have built-in grounding. You can specify the tools that these chat modes can use. It's like being able to create your own agent with a persona, a set of tasks and awarenesses and and references to files that it will use whenever you're talking to it. It's a great way to really change the default behavior to be say, a senior C# developer, or perhaps a uh, DevOps engineer persona, or something is just there to challenge your assumptions, a critical thinking persona. But I'm going to use a mentor because I want to actually have a look and decide, is there any problems with my specification?
So, how do I get one? So, the easiest and well, I was going to say the previous way of doing this is to jump over to one of these fantastic repositories. So, this is the uh, GitHub Awesome Copilot repo. I will share the chat in we share this link in the uh, video notes. But as you can see, they have a link down to custom instructions, which we're not talking about today. I think they are fairly well-known. They've got reusable prompts. Those are the prompt files, the instructions, basically the tasks, uh, the predefined templated prompts. Uh, they've got custom chat modes. Uh, they actually don't have the one I'm after. I want one called a mentor mode that I that I created. Um, and of course, you could create your own. I highly encourage everyone to do that. But if you just want one that you know already exists or you've found handy in the past, I'll show you how to go and get it.
So, you can also go to my repo, which I'll I'll share that link as well. This is my GitHub Copilot assets library. Very similar structure. I have um, I have tried to align and structure uh, with the um, Awesome Copilot because I am migrating all my content over there. Um, but as you can see, there's a mentor mode, which is help the engineer by providing guidance and support. There are another other modes that I could use here. For example, the principal software engineer is another good one that will sit there and and really challenge uh, specific patterns. The expert .NET software engineer is another one. And I could use the install to VS Code button, and that will install that um, VS Code. That will install that prompt into either my workspace or my repo. But I'm going to do this a different way. I'm going to switch back to um, my uh, Visual Studio Code. Let's head back over here and let's get rid of this. We'll make this full screen. Um, if I had just done it the other way, you know, copied and pasted or installed it, I might see the the uh, prompts in. Actually, I'm in the wrong repo, aren't I? Uh, I might see the prompts in these files in the GitHub folder, chat modes. I might see some additional files in there.
But what I'm instead going to do is I'm going to clear create a new chat. I don't need the specification open anymore. So, I'll close that. Don't need that either. Might as well close everything. Um, we will type slash. Now, you'll notice I have four other prompts in here: suggest awesome GitHub Copilot chat modes, suggest awesome GitHub Copilot prompts, and suggest GitHub Copilot chat modes and suggest GitHub Copilot prompts. Now, these are prompt files I have downloaded and put in my user folder. So, they're available to me in every Visual Studio Code instance. So, this is how I like to download these prompt and these prompt files and chat modes from those libraries. I don't want to have to jump in there because perhaps I'm in a Python library and I a Python repo and I want to download I want to ensure that I've got chat modes for Python or I've got prompt files that are relevant for Python. You know, maybe running um, specific linting and rough testing that I I prefer. But in this case, I want a mentor chat mode. So, I'm going to go to this suggest GitHub Copilot chat modes and I'm going to say mentor.
Now it'll actually this will look through my repository and also look at what code I've got in here, packages and so on and also and look at the chat modes that are available in that website. Remember this one over here that I that I shared because I'm using the default one. It is using my my library source. So picking up it. Hopefully we'll pick up that mentor. Uh, we all love it. Deterministic demos. Sometimes things work differently. Um, and I'm going to close that because that's the wrong one. Here we go. It is now looking at the repository content to decide what what chat modes might be relevant. It's already got the list of chat modes. Um, so this is what it's told me. I've got in my repositories, bunch of CNN .NET 9 stuff. Fantastic. Got Semantic Kernel. So, it's suggested number one, mentor mode. Uh, but it's also suggested a few others. Expert software engineer C#.NET janitor implementation plan generation mode. That's a good one. Uh, I might need architect. There's a whole lot of stuff because I'm using Azure. You can see here um, it's suggested one Azure AVM Bicep mode, but that's already installed. So it said don't worry, I've installed it. It's looked over here in my repo and seen that it's there.
So, I can now say uh uh, install the install the mentor mode and maybe also the principal software engineer. Yep. Cool. So, it is now going to go off and copy or download those files. As you can see, it's down got the raw file from my repo and it's going to chuck it over here in the chat modes folder, I think. Or did I ask for a prompt file? And it's a chat mode. Um, and it's also got the same principal software engineer. And it's going to go create both of those files. Now, of course, uh, like a good GitHub Copilot, it will show that those files are new and changed and I can accept those as is or I can I can make changes to them. In this case, I'm not going to change anything. I know what it's basically just done a one-to-one download. You can see it's got the mentor chat mode in there now and it's it's busily creating the software principal software engineer mode. So, we'll give that a moment to complete. And now it will say I've done that. Thank you very much. And we can keep both of those files. And those files are now available to us as new chat modes.
So, we've sort of inceptioned it here. We've used a custom prompt file to find another chat mode or another prompt file that might help us solve another problem. So, that keeps us in the flow. You know, we don't have to jump out to another repository. You don't go to find it. Click the button. Does it did we install it to the right place? So, now if I look at my agents, I have got mentor. So, I'm going to say, okay, great. I might start a new new chat here just to give it keep things clean. I'm going to say um, can you check the uh, spec data connection manager and identify any areas where this uh, design pattern could be problematic, especially with thread safety. We all know how important that is and we all know how often we get it wrong. Um, so I'm getting my mentor uh, which is really a it's a a chat mode and if we have a look at the chat mode while that is running um, we can see it's it's um purely designed. You're in mentor mode. Your task is to provide guidance and support to the engineer to find the right solution. Uh, it will ask questions. It is, you know, it wants to make sure it understands the proposed solution. It wants to make sure you understand the proposed solution. It identifies areas of of, you know, risk and problem. It's it's a great little friendly helpful tool that helps you as you're building out your software, you're doing your design to make the right decisions. But in fact um, it is uh, if I'm going to read through all this um, it is calling out a number of problems. So, primary thread safety concerns, serious thread safety issues. Agreed. Um, I'm going to just quickly say uh, could implement me a um, factory pattern here, improve this. I think it can. Always good to get a second opinion. Fingers crossed. Non-determinism. Um, of course, it's it's a mentor. It's designed to uh um, challenge my thinking.
Now, of course, in the real world, I'd have more time. You wouldn't be sitting here watching a video and waiting for all this to happen. So, you would read through this carefully, maybe ask a few more more discussions, uh, have a few more rounds of discussion with the mentor and really come to a solid uh, implementation plan. So, let's go and say I want now to um, you know what, I want to update the spec. So, I've got another chat mode, update specification um, uh, update the data connection manager to implement a factory pattern. Now again, this is an example of using a prompt to which is predefined to really rewrite that specification with requirements, but it's using the history of the chat. Um, but mentor's actually told me, wait, hold on um, which is great. I don't actually I would should really look at this and make a better decision on this and uh, oh, it's given me it's really really refused. So, I'm going to switch out of mentor um, and going to just say, let's just go ahead and do this because mentor is right. There is a few other problems and and issues that I think should be fixed and there's better patterns we could use here. But it's going to rewrite um, this specification for us. Won't take too long. Um, let's go with option A. Please again, terribly, don't do this in real life. Uh, this is we're only shortcutting for the purposes of um, this video. So, we have now uh, begun the process of upgrading our updating our specification. So, this will take a few minutes.
Now, after we have got an updated specification, you might think, well, let's go get coding, but one of the things I've found um, with whilst the many months of using uh, Copilot chat and AI build tools is that is that trying to get uh, GitHub Copilot or any of these tools to boil the ocean doesn't result have a good result. Usually, it becomes too complex, too many things, too many balls in the air, too much complexity. It either stops or it gets into a loop. It just doesn't give you the code it wants. So, I've always found break the problem down. I mean, in reality, when we as software engineers work on large problems, we always attack it as piece by piece. We break the problem down, small subtasks. We're going to do the same here. We're going to use an implementation plan.
Now, you will notice as this still works, I don't have an implementation plan prompt. I know there is one because I created it. Down here in uh, in my repository, I've got a prompt plan that says create um, create implementation. Uh, where is it? Implementation plan. One of these is the create implementation plan. That's the create. It must be this one here. Implementation plan update prompt. So, this is the one. I just need to update the name of it. It's looks like it's got a bit of a bad name there. Uh, but this is the prompt I want. So, I'm going to install that uh, via my um, previous method, my inception method, where I'm going to use the um, suggest uh, prompt file. Right, I'm going to use one of these uh, built-in prompt files. I still wait for this to finish as it's rewriting a significant part of my um, significant part of my code here, my specification.
The other way I could have done this, of course, is um, sent this off uh, as a GitHub issue and got um, this prompt mode to rewrite the GitHub issue in using a coding agent. So, I could have signed it there, but of course, it still would have taken time. These models are not magic. They do they do take a little bit of time to do their work, especially on large complex files like this. This is really again why this implementation plan is is important because complex changes, there is usually a lot of work to do. Using uh, an implementation plan to break down the problem is a really good way of doing it. Now, you could you could actually get Copilot to run through the implementation plan once it's created bit by bit by bit, you know, stage by stage by stage. And in my case, I put a table in the implementation uh, document recording where which parts of the implementation plan have been have been completed. I could of course have done this with GitHub code issues. Could have had the implementation plan create GitHub code GitHub issues which I could have then assigned to coding agents. Uh, but in this case, I'm just trying to be a little bit more pragmatic and demonstrate to you uh, how I work in general on large code bases, large complex code bases.
So, here we go. We have finished. It's giving us a little bit of a wrap-up, but it's significantly rewritten our specification to handle that option, factory pattern. Um, I'm going to just keep this. Um, so now I've got my finished specification. I really need that implementation plan. So, I'm just going to quickly say um, uh, suggest Copilot prompts um, implementation plan. And of course, once you've done this, you know, say you've you've pulled a prompt into your repo. You can um, you can then use that prompt over and over. You don't have to pull the prompt every time. It's stored in the repo. You could uh, I think there is some new features now in the panel where you can say um, configure prompt files and you can copy an existing prompt file to a different location. So, you might be able to copy one from perhaps it's a create specification and you use it across every uh, application, then you every repository and you don't want to store it in the repository. I think you can copy it or move it into your repo into your user workspace. I haven't tried that yet, but I'm sure that's how it was going to work. If you if you have tried it and you do know, let me know. Add a comment.
So, we've now been listed. Here's a bunch. The create implementation plan. That's actually the one I wanted. So, and I can actually click through and this will take me through uh, to the implementation plan prompt itself. So, I can review this. So, this is what my implementation plans look like or get created as. Um, you know, I've got very clear instructions on how I want this to be done. Uh, my implementation plans contain multiple phases, autonomic phases with tasks. Uh, each phase has multiple tasks. List things like dependencies and how we're going to test it and so on and so forth. So, let's go and let's say install. Let's do it this way. See if this works. Uh, install the create implementation plan. All right. Looks like I can talk faster than I can type. It's always fun in an office filled with people uh, talking to Copilot. I think that'll be what's needed in the long term is uh, Copilot with specific voice recognition. So, only it'll only recognize your voice uh, when you're talking to it. But I can imagine it's going to get noisy in a room full of developers all coding with voice. So, uh, it's going to again download my implementation plan. You'll see that uh, appear in here. This is my create implementation plan prompt, which just showed you on the screen before. It's telling me it's done. I can now use this prompt to create my implementation plan.
So, let me go and do that. So, keep that. I'm going to say uh, create implementation plan. But I'm going to say from the specification file, the data. So um, make sure the changes will work after each phase. Make sure the changes make sure the app and no breaking changes between phases. Now, this is going to make sure that at each point my application is still going to be runnable. It's test is still going to pass so that I can if I wanted to commit between phases. This is really really important. Um, you know, large changes uh, really shouldn't be spent you know, days and weeks making large feature changes. Really isn't the way to make large feature changes. Rather, we should be using uh, feature flags, breaking our changes down into small, deployable, individually testable chunks, and then enabling those with feature flags or building our application changes in such a way that that um, we aren't making breaking changes or changing the functionality of existing functions. We're just adding to or enhancing uh, that function. Uh, so as we can see, the implementation plan is being uh, built. It's actually going to go and look at the code for this. So, we'll start to see in this this folder here, a plan um, you can see I've I've created another a number of few plans. I've got a plan here where I was upgrading a package uh, that had a breaking change. So, you could you can use plans for small changes like package upgrades or massive changes, you know, u adding new features or large scale refactoring. In this case, this is a fairly large scale refactoring. It would touch multiple parts of the application. So, it's going to go and be a bit thorough. So, as you can see, it's still working on it. Hasn't started writing our plan yet.
While we're doing this, I think it's important to call out that building these chat modes and prompt files. Building them and making them reusable is a huge advantage to your team, to your organization. Now, every prompt file and every chat mode is not going to work for everyone. You should be customizing these for your environment, for your codebase, for your setup, for your working style. There is no right or wrong way to do this. All I want you to take away from this is you can use these to enhance and increase your productivity significantly. But not only that, it helps take over take on some of the drudgery tasks that we typically just skim over. When we're when we're writing specification documents, we just think, you know, we infer a lot of things. We allow assume a lot of things. We skip over, skim over a few things. Large language models don't. They will quite happily overdocument. Yes, they can. Uh, you can get them to trim that down, and there's nothing wrong with that. But they will take care of so many tasks that we really wouldn't have time to do. And in fact, barely will we write a specification. We'll maybe have a def, you know, a few um, acceptance criteria documented in a in a user story, but that's really not much of a specification. And the specification can be used in so many different ways, or all these assets can be used in so many different ways.
So, now we've got our our um, implementation plan. And as you can see, if we expand this out, we'll get rid of the chat. You can see we got a whole lot of tasks. None of them are complete. We've got a as as the um, as the process or the agent works through delivering these changes, which we'll do in a moment, it will tick them off as they go. So, we can watch it. We can keep an eye on it. We can actually stop and at any point it's re it can continue on. So, if it starts going in the wrong direction or we decided actually that wasn't right, we we really wanted to make it do something else, we can pause or stop it. So, let's keep that and we are going to now I think we're ready to deploy, ready to build. So, let's close all those just to get a nice clean uh, screen and of course Control Shift I to open up our console.
Now, I'm just going to use plain old agent mode. Now, you might have you might have created a specific uh, software engineering mode. I expect you might have done something like created some some in-code uh, instructions which I'm not covering in here, but that's a way to control certain um, other default behaviors when Copilot is generating code uh, but and I've already got my C# 14 best practices in here. There are many others. You could actually implement the same process, the bootstrapping um, the inception of uh, getting a prompt file to download chat these instructions from those public repositories because we've both been putting them in there. But let's go ahead and just say uh, let's start building uh, the changes from implementation plan. Uh, what do we call it? Architecture database manager one. All right, let's do this.
So, it is going to go ahead and start to make those changes. Um, I have found it sometimes updates um, the process as it's going through these this table as it goes. Sometimes it does it at the end of the phase and sometimes it gets a little bit forgetful and you got to sort of say, "Hey, don't forget to update it." But either way, it actually tends to often pause between phases for you. You can actually ask it in the prompt, hey, I want you to make sure you pause between phases so I get a chance to provide feedback. Another tip I also use is, hey, while you're building, if you have any questions or you have you're not clear on something, stop and ask and we'll review it. So um, as you can see, it's working on phase one. Now, I could go and let this work and it would quite happily continue on. I would this may take 10, 15, 20 minutes. Uh, the other way I said I could have done this is I could have uh, used a prompt to take each of these each of these phases, create them as GitHub issues, and then assign those GitHub issues to coding agents if I had them. Now, that would be a fantastic way of using coding agents. By the way, everyone who has got GitHub uh, Copilot Business, I think has now got access to coding agents. It does use um, premium uh, queries from GitHub Copilot and I think it also uses GitHub Actions runner minutes, but it's still hugely valuable. Something you can get just out of the box if you've got GitHub Copilot a GitHub Copilot Business. Um, I'm not going to wait for all this to finish because we'll be sitting here watching it and it's great. Fantastic. Uh, yeah, we're probably going to have to make a few changes at the end, but no problem. I'm going to stop it now because one thing I wanted to show you was well, how do you remember I talked about these four prompts? These uh uh, suggest awesome, suggest suggest awesome GitHub Copilot prompts uh, and the suggest how do I get those in?
So, easy way is to open your panel. If you've got the latest latest GitHub Copilot extension along with it, insiders build. You can actually do this over here and go prompt files. So, click the little cog um, up here, click prompt files, and you can do it that way, but I'm assuming you don't. So, I'm going to do it panel, just type prompt, and you will see chat configure prompt files. And you also get new prompt file. So, what I'm going to do, select new prompt file. And now I'm going to select my user data folder. And I'm going to call this suggest another GitHub uh, prompt file. Right, now that is going to then open this folder. Now I want you to then go over to uh, my repository, which is this plague github-copilot-assets-library. I will share the link in the video uh, video description. But down here you will find the suggest GitHub Copilot chat modes Celeste, suggest GitHub Copilot prompts um, and those are the only two. There is two more on their way uh, which I will have uploaded by the time of this video. Um, the two for the um, for the Awesome GitHub Copilot uh, repo. So, you can get um, you can get prompts from there as well. So, you go and click that to get the content of that and we'll go to raw, get the whole file. Copy that and going to have to do this once. Paste it in there and save it. Close it. And now we've got another suggest uh, what did I call it? Suggest. Another GitHub prompt file. Now that means that every new repo I open on this machine or using this work using um, this user account will have access to these suggest prompts. So, that means that no matter which repo or which workspace I'm working in, I can go and grab prompt files and chat file chat uh, modes just by starting having that chat saying, give me suggest a new chat mode that might work here.
There are so many amazing and awesome things that can be done with chat modes and prompt files. It blows me away the power of these things. They are so much worth your time investing in, investigating, learning to use, building out custom ones for your for your personal use, for your for your company, for your team, for whatever. Um, please explore. Please share, comment. If you've got any great use cases or built some chat modes and prompt files, go and contribute them to the Awesome Copilot repo. Um, that is where they're going to be accumulating many and many of these uh, awesome different ways of using GitHub Copilot. Go and throw throw in there. There's some some seriously cool stuff. Um, I can't wait to see what people are going to do, especially when you start adding specialized MCP tools like SQL database, the new SQL MCP tool, or um, or whatever else is out there.
So, with that, I'm going to wrap up and I'm going to say thank you again for watching. Really appreciate uh, the time you've taken to learn about how you can evolve your development practice using AI and really level up and become the next generation of AI-driven developers. Ciao. Thank you.