Andrew Ng0:02
Hi, I'm Andrew. I want to show you how to build fun, useful software using AI, regardless of your background or training. If you're intrigued about using AI or vibe coding to build cool software, but aren't sure where to start, this course is for you. Let me show you a funny birthday card app that you learn to build in minutes using ChatGPT, Gemini, or any other similar AI system, even if you've never written a line of code before. This birthday card app has a computer program called a web application, which means that it runs right in your web browser. The app takes whatever you type in and creates a custom card for you on the spot. In the next lesson, you build your own version by describing what you want the AI to do, and the AI will write all the code for you. To use the app, you enter a name, an age, a hobby, penguin fashion design, an adjective, suspiciously fun, and a plural noun, lucky sauce. Then hit generate card, and it says, Karen, against all odds, you've turned 27. Your devotion to penguin fashion design is stuff of legends, and your system fune iconic. Statistically speaking, most people like you. I think that's pretty funny. Or if I don't feel like filling in all of these words myself, I can hit I'm feeling lucky and have this fed automatically and then generate a different card and there's another birthday card and you get a different funny story or different funny birthday card this time. Notice the app stores all the cards we've generated. If I click copy on any of them, the birthday message goes to my clipboard. So I can paste the message into an email or text and send it as a birthday card. You might be excited to jump right in and start building out your own idea. And if so, that's great. And before doing that, spending a little time building this birthday card app yourself will help a lot. Doing so will give you a better feel for how to talk to the AI so you actually get the results you want. And this practice process will build your intuition for how to shape what the AI actually creates. And you get a better sense of how even small tweaks can lead to very different outcomes. Once these set of concepts become a bit more familiar to you, building your own ideas will come faster and easier because you have a better sense of how to steer the process. So, an app like this might seem complicated to build, but in the next video, I'll show you how you can build something like this in minutes. Let's go on to the next video.
The easiest way to create software in the AI era is no longer to type out code yourself. Instead, you should tell AI to do it for you. Telling AI what to do is called prompting. When given precise instructions, AI can do a lot of things for you. What I want to do in this video is share with you some best practices for prompting AI to create software for you. First, we'll walk through an example together. Then you try yourself using any AI chat system like ChatGPT, Gemini, Claude, or the one built right into this website. To use any of these AI systems, you give it a prompt or set of instructions like this to tell it to create a web page to help me write birthday cards. And when I give a person's name, age, and hobby, it should give me back a funny message. And if you do this, it might actually generate an app that looks like this, which is a good start. You can enter the name, age, and hobby, and it generates, you know, an okay message like this. But if you aren't satisfied with this, you might then continue the conversation with the AI and say, 'Make it prettier by adding a festive title and colors.' And this would give you a second version of the app that now looks a bit better. And if you're still unsatisfied, you might say, 'Display the card on the right side, make it look inside a birthday card,' and get back a third version. And if you have ideas to make it even better, you could give it more instructions like add a fine title at the top and so on. This is how I actually work in practice when using AI to write code for me. I often start off with a basic set of instructions and see what I get and I repeatedly tell the AI how I want to improve it. It turns out that when you're building software applications, there's a number of basic building blocks you might end up including in the prompt. One thing I often include is the goal. So here the goal is to create a web page to help me write birthday cards. And another thing you might include is to specify what is the input that is what does the user have to tell the software. This is us telling the software what we want it to output as well as the layout. So what's on the left, what's on the right, how do you arrange the different parts of this app, and lastly any special instructions for additional features you wanted to include. There are many ways to write good prompts, but as you start your journey of telling AI to build software for you, I encourage you to consider these five building blocks as common pieces that you might choose to include in the prompt. That is the goal, namely what you want to create, what input the user will provide, what is the layout of the software app, what special features you want to have, as well as what you want the software to output.
In the previous slide, we went through a back and forth process of me incrementally in four steps adding to the instructions I gave the AI to tell it what I wanted to do. But if you already know in advance more or less what you wanted to build, you can also specify all of the building blocks in a single prompt. For example, if I already knew the specification I want for the software, I could write a single much longer prompt like this to create a web page to help me write birthday cards, what to give a person's name, age and hobby, remember message, use fit titan colors, and so on. And in this example, I've taken all five building blocks and written them all into a single much longer prompt. So instead of building things step by step like you saw in the last video, you can also give it all the instructions in a single longer prompt and that might give you a better first version of your app, which you can then further refine if it's still not quite what you want. Now, whether you're writing a single long prompt all at once or whether you're giving it one building block incrementally, one piece at a time, I will often start by telling the AI what is my goal and then of the remaining building blocks, there are multiple ways to put them together and you don't have to use all the building blocks every time and the order is also not very important. Start at the goal and tell the input, output, layout, and maybe not list any special features or you might put the building blocks together this way and it could work fine or you might list out the building blocks in a different order and the AI is usually pretty good at understanding these different rearrangements of the building blocks. And if you're feeling like boy this is a lot I would say don't worry about it if you just tell the AI whatever's on your mind even if it's partial and imperfect you can then work and go back and forth for the AI a few times to hone it towards something that you want together with the AI.
One of the skills you hone over time is the ability to give AI more specific instructions because it turns out that the results you get may vary even if you give fairly specific prompts. So here's a long detailed prompt that you saw just now specifying all of the five building blocks. And if you give these same instructions to the same AI system multiple times, maybe one time would give an app that looks like this, which is pretty nice. And maybe a second time it'll build something like that and the third time it'll build something like that. And all of these look pretty good. We can see that there's some variation among them. In contrast, if someone were to give a much less specific prompt, a much less clear prompt, so it's a very short prompt that just says create a web page to help me write birthday cards. Because this is a relatively vague prompt. The results you get if you run this multiple times through an AI system, maybe once you get this, a second time you get this, which looks totally different with different fields, and a third time you would get this, which again looks totally different than the first two times. The more specific and the more precise the prompts you write, the more predictable will be the results. But even then, there'll be a little bit of variability. So, if you get results that are a little bit different than what I show in this video, don't worry about it. That's a normal cause of how AI systems behave. But if it surprises you with something you really don't like, that's okay, too. Just give it additional instructions to steer or to move the AI closer to whatever you do want it to do. The best way to learn this is to put your hands on your keyboard and to try using AI yourself. Let me show you what it'll look like.
What I'd like you to do after this video is go to this section on the website and go through this exercise yourself. So there are instructions here that you can read later, but this is an AI system similar to ChatGPT and Gemini and Claude and so on. And I'm going to select and then copy and paste the first prompt here where it tells the AI to create a web page to help me write birthday cards and so on. And I'm going to hit this to send it to the AI. So here it'll think for a little bit and then it will generate an HTML page that it can then download and run. Notice while it's still running that this download button here is grayed out. So I can't actually click on it yet. But the AI system will take just a little bit of time to write something called an HTML page. This is what web pages are made of that will be this birthday card generator. Now that the AI has finished generating all of this HTML code, I can click this download button. And here I'm running Chrome on a Mac. I'll show you later what to do if you're on a different machine. And I can go to this downloaded menu here and open up file.html. And this has created a little birthday card generator. So here's Karen 27. And I can create a simple birthday message. Not bad. And notice that this is actually a piece of code written in HTML that is running on your computer right now if you were to do this yourself. The code is in this file called file.html and it's actually saved to my computer right now. And if you do this, it will be saved to your computer. Now, if you want to improve the code, you can then prompt it add a festive title and colors and then it updates the code. Same as before, have to wait until it's finished writing the code. But if I can download it and now I can download it and same as before, open it. Oh wow, now it looks much more festive. And so what I'd like you to do is try it out for yourself. If you can, you know, add this third prompt, run it at this fourth prompt or try some other prompt if you feel so inclined, but it's also fine to use just these four prompts one at a time and see what birthday card generator you get out of this process. Even though I'm showing you this process on a website, these same prompts should give you similar results on OpenAI ChatGPT, Google's Gemini, Anthropic's Claude, or any other popular AI system. What you're learning isn't tied to any one platform. And these skills apply to any AI system you choose to use. When you click the download button, your web browser will usually download the file.html or whatever is the file the AI generated with the code to your downloads folder. So these videos show you how you can navigate on either Windows or Mac to the downloads folder to find that file. And then if you double click on it, it should open up in a web browser and let you see what the code you just generated looks like when it runs in your web browser. Please try this out after you try out this process and generate a web app.
One mindset I hope you have is that getting feedback is often a great step in building software applications. Whenever I write software, I'll often show it to friends, show it to family, or sometimes respectfully approach strangers and ask if they're willing to look at whatever I'm building and see if they can let me know what they think or email it to a colleague or post it on an online forum. So, you get feedback because I find that when people look at it, they often have suggestions for how to make it even better. Or sometimes if you get a laugh out of a friend by showing them something funny, I find that really encouraging as well and gives me the energy to keep on going. So what I'd like you to do now is go on to the next item in this course and try it out yourself. Get AI to generate some code for you and download the HTML file and see what results you get. If you feel so moved, I hope you also show it to a friend or show it to someone else to get their feedback. After that, please come back to the next video where we'll keep on working on the app and we'll look at how you can add even more features to the birthday card app to make it even more fun and interesting.
Now that you've built a basic birthday card app, let's see how you can add additional features to it so it can do additional things or be more fun. If you showed your app to anyone else, maybe they'll have ideas for things to add, too. And I also want to show you what to do if there's something wrong with whatever the AI had built for you, such as if it doesn't work the way you're expecting. As before, the primary way we will tell AI what features to add is by prompting. To understand why it's important to be specific in the way you prompt, let me pick an analogy to ordering food. If you go to a food truck and say, 'Give me a sandwich.' Who knows what type of sandwich they will give you if that's all you say? But you say something more specific like, 'I would like a vegetarian sandwich.' Then that narrows down the range of what you may get back. Or if you say, 'I like a vegetarian sandwich with hummus and cheese and multigrain bread.' Then that specific instruction really means what you get back becomes much more predictable. Or if you say, 'I'd like such and such vegetarian sandwich and add a drink and make it to go, please.' Then it becomes much more predictable what the food truck will give you back. At a food truck, by being specific with what you ask for, you're more likely to get what you want. And so too, it is with prompting AI. By writing more specific prompts, you're more likely to get exactly what you want. Oo, this is exactly what I wanted. As you gain skills in getting AI to write for you, you get better at being more specific with the instructions you give the AI, and this would give you better results. I previously built an app using a prompt like this, either on one go or by going back and forth a few times. What I'd like to do now is add a few new features and modify some existing ones. For example, instead of having three input fields like we have so far, name, age, and hobby, maybe you want to gather five pieces of information. So, five input fields that users can input so you can create more personalized messages. Or maybe you want an I'm feeling lucky button that automatically fills out all the fields for you, so you don't have to type everything in each time you use the app. Or you can also update the look and feel. Say change the title or add a button that copies the message to your clipboard so you can easily email it to friends or even redesign the entire color scheme to better match your style. After having built the basic app, you can then make the app yours by deciding what features you want to add. So, you might continue the chat conversation by telling the AI to make it have five clearly labeled inputs. Name, age, hobby, an adjective, and a plural noun. And it'll update the app to look like this. And notice that I'm writing very specific instructions here. I'm not just saying make it five fields. I'm telling it what are the five views I want it to have. Or if I add an I'm feeling lucky button, again, I try to be specific in telling it what I want the I'm feeling lucky button to do. I want it to automatically fill in the blanks with random words. And I want the predefined word choices to be funny. And here I'm actually adding two features at the same time. I might update the titles and subtitles and also add a button to copy the card to clipboard. So this is actually two of the bullets from the previous slide that I'm adding at the same time. And I actually like the color blue. So let's make the color theme blue. Feel free to try out these prompts yourself or even better pick a different color theme or tell it to implement any other idea that you have. If you like pink like my daughter does or green like my son does, tell it to use a pink or green color theme instead or make some other changes depending on what you feel like doing. And if you ever change your mind, you can do that too. So after I've made the color theme blue, if I decide that I don't want it blue after all, I actually want it to be purple. You can write a prompt like that and the AI will obediently change it to purple.
Now, a lot of the time AI is pretty good at giving you exactly what you ask it to do, but sometimes there's a chance to generate an HTML page that doesn't work. In software, we call this a bug when there's something that doesn't quite work the way it's supposed to. Here's actually a broken version of an app that AI generated for me earlier where I've typed in all of these fields, but if I click generate card, nothing happens. So, that's kind of weird. Here, I'm clicking my mouse, but it's not actually generating a card. It turns out I'm feeling lucky works. But again, generate card doesn't create any card for me. If that happens, what I'd encourage you to do is to clearly tell the AI what happens. So here I typed nothing happens when I click on the generate card button. Can you fix it for me? And if you do that, the AI is usually pretty good at finding at least basic bugs and fixing whatever is wrong. When you do this, sometimes the AI will write some technical explanations of what went wrong. So here it says no JavaScript is attached. The button is click event. Boy, that's a lot of technical terminology. I would say for now, just don't worry about what the AI is saying here. You don't need to understand these technical details. If you're really curious, you can actually ask the AI, 'What do these terms mean?' But you don't have to do that. Let the AI do its thinking, say what it wants about the technology, and then focus on downloading the new HTML file to see if that works. I hope you will start with the basic birthday card app or add some features that maybe your friends have suggested or your own ideas. And in fact, if you're not sure what else to do, you can also ask the AI for ideas. So if you ask it, how can I make this birthday card app cool, it may give a few suggestions, and then you could pick one or more and use the AI's idea to make your app more cool. I actually use AI as a brainstorming tool a lot when I'm building software, and you should do the same, too. If you don't already have ideas that you're excited about, please go to the next item in this website and have fun adding features or play with the color theme or implement whatever you feel like. When you come back, we'll use the skills you've already learned to build a second app, a ping pong game.
Using the skills you now have in prompting, let's build another app. This time, a ping pong game. Because of AI, it is now possible to go from an idea to a working app, sometimes in minutes. One of the earliest video games in computer history was a game called Pong, which was sort of a two-person ping pong game, and that had taken the team weeks to build. But now, thanks to AI, you can build something like this in minutes. Let's apply the prompting techniques we learned. I'm going to start quickly and write a moderately specific prompt and say, 'Build me a table tennis game as a single HTML file. User plays, computer moves the paddle, the arrow keys.' And if you do that, you might get a first version of the app that looks like this. I go, okay, that's a good start. But I wanted to add three difficulty levels and let the user specify the number of points required to win and also have it keep score. And this builds me a second version like that. And this now looks like a fun game, but I want the graphics to be fancier. So I'm going to say make the playground green, paddles beige, ball white, and I'm going to tell it to insert this image into the background. And so I end up with a game that looks like this. And here is the game. It's actually pretty pretty fun. The ball is bouncing back and forth. I could actually play this for quite a long time, maybe longer than you'd actually want to watch me playing it. But I hope you will have fun with this. As a reminder, being specific in how you write your prompt gets you better results. And so you can look over the prompts I was using. And I was fairly specific in a number of details like the color, the points, and so on. If you're not sure what to include in the prompt, think about the building blocks. Do you want to specify the goal? The output, the input, the layout, the features as a set of things to consider including. And lastly, use your chatbot to iterate, improve, and troubleshoot. You don't need to get it right the first time. You can tell what you already know, what you already have in mind, see what you get, and then use that to further refine what you tell the AI to do. I actually enjoy ping pong in real life, and now you can build a game to play it also with your computer. Please go to the next learning item to give this a shot yourself. And in addition, beyond building a birthday card generator or ping pong game, if you have an idea of something else you want to try to build, give it a shot. May or may not work, but it's by practicing, exploring our ideas that all of us get better at building things.
If you made it this far, congratulations. You're an AI builder. Now, I've met people who've been clearly building software with AI, maybe even for months, that somehow still wonder if they're actually a builder. I'm here to tell you, yes, you are. And I count you as one of us, a builder. I hope you do one last activity and get a certificate for this course. The final project is to make your own fill in the blanks story builder. I hope you use the prompt building blocks to build your own fill in the blanks app. Your final project must include three to five input views, a button that takes input and then generates the output, and a place to display the output. You've already seen the birthday card app. Here are some other ideas for maybe inspiration. This is a funny product review generator where the blanks are the product name, some number, a noun, a body part, and so on. And it generates product reviews. Notice it says there are totally honest product reviews that look like this. Feel free to pause the video and read this if you want, but I love this. Or here's another time off request generator where you specify how much time you went off, a noun, a body part, an object, and then it says, 'I need an entire month off effective immediately because a vintage ver requires my urgent attention.' And so whether a birthday card or a product review or a time off or some other type of story generator, please write your own prompts and use it to generate an app like this. On the website, when you go to the next item, you will see the usual chatbot that you can use to write your prompts to get an HTML file and download it onto your own computer. Please do that. Run it. See if it works to your satisfaction. And you could either use our website or you're also welcome to use an external website like ChatGPT or Gemini to generate your HTML file. When you're done building this project, please go to this final page. It might take a second to load. And then click upload file. And here I'm going to navigate to the file that I had downloaded. And here's a preview of the app I actually generated. When you're ready, hit submit assignment and our AI will look at your HTML file and see if it seems to work correctly and give you feedback if any. Assuming it works, this will bring you to the last exercise of this course and will earn you a certificate. Most effective builders keep taking courses and also keep building. I find that if someone only builds, they often end up unaware of core concepts and can end up spending months reinventing the wheel or worse, doing things in very strange ways. But conversely, if someone only takes courses, then they end up with theoretical knowledge without knowing how to apply it. So both building and taking courses are important. Please keep building whatever you feel like and I'll also suggest some additional courses for you to consider in the next item. Keep sharing your applications with friends to get the feedback or maybe just to get a laugh out of them. Being a builder is one of the most fun things in the world. I'm glad you and I have started this journey together and I hope we'll keep building and learning together. Thank you also to Tao's Summer, Andres Gonzalez, and Tommy Nelson who had contributed to this.