So, I'm in this Node Express project which I created earlier in this section and you
find it attached by the way, so that you can start with exactly the same project setup
as I have here.
The exact setup theoretically isn't too important, we're not going to build a real
app here just yet, we'll do that later, but nonetheless to have the same starting
point you find it attached.
And now I want to tweak that code a little bit, I want to add some new code to this project,
change the code a little bit and of course I want to use GitHub Copilot for that.
Now I could use the suggestions and completions feature to start writing code on my own and
have GitHub Copilot completed and that could be very efficient, might be the most efficient
way, but of course I could also use the chat to generate and change some code and I'll
do that here to dive a bit into that prompt engineering part.
So let's say we want to build an application here where we can book restaurant tables,
we can reserve a table in a restaurant, we can also cancel that reservation and we won't
build the entire application here, it's just a theoretical example.
Now what we could do of course is open up the chat, the sidebar here let's say, and
say I want to build a restaurant table booking website and hit enter.
Now that's not very specific, sure I'm making it clear what I'm trying to build
but that's about it.
So therefore of course I will get back a response and it might be the response I'm looking
for but it might also not be.
Now for example here I'm getting instructions on how to initialize a project even though
I already have a project.
Now again you might be getting different results but what you can see here and what you probably
can also see in the results you're getting is that whatever you get back here might be
helpful but it's not really helpful for this specific project we have here.
So let's start a new chat and I'll start by bringing in the workspace as a participant
and then I'll say I want to build a restaurant table reservation website and I'll actually
add a new file here in the routes folder, tables.js which is empty right now which I
now want to reference in my chat.
In the tables.js file add the following routes and I'll just add a couple of bullet points
here around for creating a new reservation and then some information number of people,
time, date, that seems reasonable, a route for deleting, canceling an existing reservation.
Now we could add more to edit reservations but here I'll keep it simple but I'm adding
this extra context here and that's very important context for my intent here which is in the
end that I want the AI to generate the appropriate routes and therefore maybe we should say that.
Maybe we should add this sentence here as context that we're building a restaurant table
reservation website but then add more specific intent here and say generate some express
routes for this website in the and then again I'll just add this tables.js file to be really
clear that it's this file that should contain the routes then I'll refer to it again so
actually now we can get rid of that since I'm referring to it here and I describe these
routes.
If I now hit enter, my chances are much higher that I'll get a result that's actually
helpful for me because indeed now it understands that well it should just generate these routes
so I can apply them here to my tables.js file, here we go, accept those changes and I got
these basic routes.
Of course I would yet have to add the logic, it did not do that because I did not ask it
to do that but it set up the basic route where it tries to extract the data I specified in
my prompt from the request.
body and also that route for deleting a reservation and it also tells me how to adjust my main
starting file, the root entry file, the app.js file.
It tells me how to adjust this here.
By the way, you can also click on a file here to be taken to it.
And I can also apply these changes to update this file to, as you see, also bring in those
table routes and then route requests that target slash API, which does not look like
what I want, but anyways, to these routes.
So for the moment, I'll accept these changes, but I'll tweak this soon.
Indeed, I'll tweak the overall code soon.
But this already shows you how important it is to be specific and how to add the right
context to your prompt.
And whilst this might seem obvious, it is indeed what many people get wrong.
Now here's another thing many people get wrong.