AI Prompt Templates to Code your Entire Application

AI Prompt Templates to Code your Entire Application

Category: Software
Tags: Artificial Intelligence

The world of software development has completely changed. Artificial Intelligence (AI) makes it easy to create entire applications, chatbots, and websites. OpenAI’s ChatGPT, Google Bard, Microsoft Bing, and GitHub Copilot can all write and debug code in almost any programming language.

There are step by step prompt templates you can use to generate your application code using AI services. The approach detailed here follows a proven system design and development methodology. The difference with this approach vs. traditional software development is that the coding portion is accelerated from months to days using AI.

You design your application largely by defining the requirements. The design is comprised of natural language descriptions of the data your application manages and what users can do with it in your system. Software development methodologies have already been doing this. The difference with an AI-assisted approach is that you need to be precise in terms of the details.

Traditional software development leaves room to elaborate on the requirements through each iteration. While this is still true, when it comes time to prompt the AI to generate code, you need to give it all of the relevant information about how your application should work.

The term prompt engineering is commonly used to reference the activity of constructing prompts that create the desired output. This is a fancy term for a simple concept, but an important one. Simply put, you need to be able to define and capture your thoughts in clear, English text that can be used in a prompt.

A problem well-stated is half solved. --Charles Kettering

Charles Kettering was the head of research at General Motors from 1920 to 1947. This quote has never been more true. Fortunately, AI enables us to deal with the other half of the problem faster than ever before.

You fill in your specific application details in the AI prompt templates provided in our book. These prompts must specify your requirements, so be as detailed as possible. Any detail that you do not provide will be decided by the AI. In some cases, you may be happy with what it generates. In other cases, you may want something different than what it chose. More often than not, you will have specific constraints and ideas about how your application should work. Be sure to think through these details and include them in the prompt templates.

A series of prompts is needed because you won't be able to generate your entire application in one prompt, unless it is very tiny. AI is amazing, but does not have the ability to manage that much context at a time. Coding assistants are incredibly good at writing isolated or small-scale software functions. However, you need a full-scale software application, website, or service.

You will use an iterative process to create your application as shown in the diagram below.

Prompt Template Process

The state of the world in AI assisted coding

As of late 2023, AI can write about 90% of your code completely and accurately. This is not clickbait, I will show you the data. It is quite incredible what it can do.

Even for problems it can't entirely solve, it can shorten the coding time from hours to minutes. Incomplete solutions that it generates provide a great start. They can even be an inspiration for ideas about how to finish or rewrite the solution.

This is not hands-free driving though. AI generated code can still contain subtle bugs. For example, it can generate code to insert data into a database that fails to consider referential integrity checks. Sometimes it fails to properly create or parse JSON data.

Fortunately, there are techniques you can use to quickly remediate these issues. For example, we have found that having AI generate and parse XML data is far more reliable than plain text or JSON formats.

Your role as a software engineer changes with AI. You are a designer. You are a code reviewer. You are an assembler. The good news is, the whole process goes much faster. You can impress your manager or build that startup idea you've been waiting to bring to life. The world of software development has changed, for the better.


Learn to use AI to build software applications

Prompt-by-prompt guide to building web applications using Python, Django, and ChatGPT



Rapid Software Engineering with ChatGPT

How software engineering roles change when using AI

The table below shows how traditional software engineering tasks change in an AI-powered world. The emphasis changes from writing code to specifying requirements, validating output, and assembling the final result. It is critical to prompt AI to generate tests at each step of the process and run those tests.

Traditional Engineering Tasks AI-assisted Engineering Tasks
Obtain specifications Write specifications
Design use cases Design use cases
Write code Prompt to generate code
Perform code reviews Review AI output
Integrate code into project
Write test cases Prompt to generate test cases
Run tests Run tests


This book walks you through the entire process, step by step. The secret to effectively using AI is to break up the process into smaller steps. This allows the AI to create your software a few components or functions at a time, an amount of code that fits within its context limits.

Following a step-by-step process is beneficial for both you and your AI assistant. It helps you to think through the details of each use case. You start with a high-level business idea. Then you model the data for the application. Then you define the use cases that each actor in the system can perform. Each step along the way requires detailed information in the prompts so that AI can generate the code that meets your requirements. Breaking down the development into a step by step process forces you to think through how you want each step to work.

A little bit of design goes a long way in terms of code generation. So once you have the vision in mind for your app, you are ready to get started.

Your code may vary

One last thing to note is code you generate may be different than the examples shown here. That is perfectly okay. In software, there are many different ways to accomplish the same thing.

The important thing is that whatever the implementation is, it produces the desired result. The same test cases should pass on an implementation generated by ChatGPT, Bard, or any other AI assistant.


Learn to use AI to build software applications

Prompt-by-prompt guide to building web applications using Python, Django, and ChatGPT