--- title: Develop with ChatGPT hide_title: true --- # Develop with ChatGPT ChatGPT is a great tool that is used daily to generate code by developers all over the world. However (being a language model and not a programming engine) it does come with its own set of quirks and limitations. In this guide we will look at tips, tricks and strategies for how to get around them, and see why ChatGPT is a great pairing with Noodl. > This guide is about how to use [http://chat.openai.com](http://chat.openai.com) as part of the development process. ## When to ChatGPT One of the lesser known limitations of ChatGPT is that it works with a tiny token memory. The details are technical, and not too interesting in the context of this guide, so we won't go in on it too much. Really, the only thing you need to know is that ChatGPT has the memory of a goldfish, and will start forgetting things (including its own train of thought) pretty quickly if you feed it too much information. This makes ChatGPT bad at handling large scale application code with many different moving parts. Using ChatGPT to code an application from scratch requires you to know how to program an application from scratch so that you can make up for all the mistakes the AI makes. Another implication of the tiny memory is that it limits the amount of instructions we can provide. ChatGPT gives the best solutions when you are very descriptive with what you want to achieve, and a full application requires a lot of describing. The best way to get good code from ChatGPT is really to break up your application into smaller modular pieces, generating those with AI, and gluing them together yourself. This is where Noodl shines. Since one of the base concepts of Noodl is to break your application into smaller reusable components, we dont have to ask ChatGPT to generate a whole app for us. We can just ask it to do the boring, tedious or more complicated functions. This still requires a little bit of programming know-how, but thanks to Noodls seamless combination of visual and text-based programming you don't have to know how to write complex apps at scale and can instead focus on understanding the functionality at hand. :::note While this guide is generally about ChatGPT you will get a lot more out of it if you already have some experience with Noodl. It might be a good idea to check out the [Fundamentals](/docs/getting-started/fundamentals) guide, or do the interactive tutorials in the Noodl editor first. ::: ### TL;DR: ChatGPT is great at generating code for Function and Script nodes, helping you connect to API's, work with external libraries, aggregating data or figuring out chunks of your app. It's a good idea to modularize your functions into separate Function nodes, or combine multiple Function nodes in series in a component. This allows ChatGPT to shine in a smaller scope while allowing for great reusability within Noodl. ChatGPT is also great as a search engine that you can have a conversation with. The ChatGPT model is trained on data up until 2021, so while it's not good for researching current events, it is very powerful with more general development patterns that can easily be translated into Noodl graphs. Sidenote: We have been experimenting with generating full Noodl Node graphs, but due to the limited memory it's not too good at memorizing current documentation. ## Priming for code generation If we want to use ChatGPT for code generation we have to be prepared to modify the code it gives us. That is just the current state of the AI. However, we can minimize the need for modifications if we start the chat with some instructions, giving ChatGPT a bit of context so that it understands what a Noodl function looks like, some rules for what it can/can't do and how to create inputs and outputs to the node. This is called a _primer_, and here is one that we have been experimenting with: ````markdown Hi ChatGPT. Here are your instructions. You must follow all of them. - You will be writing Noodl functions. - An input in a Noodl function must follow the format "Inputs.InputName". - An input in a Noodl function is only read, never written to. - An output in a Noodl function must follow the format "Outputs.OutputName = value". - A variable in a Noodl function never stores an output. - Sending a signal from a Noodl function must follow the format "Outputs.SignalName()". - Signals can not be passed values. All output values must be set as a Noodl function output. - Inputs and Outputs in a Noodl function are global. - Noodl functions do not use import statements. - Noodl functions do not use export statements. - Noodl functions can use recources from a CDN. - Noodl functions can access API endpoints with "fetch". - Define constants as Noodl function inputs. - A Noodl function follows this format: ```js const inputName = Inputs.InputName; // Check if the input has a value, otherwise return if (!inputName) return; // Perform the function logic ``` Reply "Okidoki" if the instructions are clear, otherwise ask me to clarify ```` This primer has given us great results so far - in many cases the snippets have worked with no modifications at all. Don't shy away from modifying it or trying a different approach though. ChatGPT is a complex technology, and new techniques and strategies are constantly being discovered. If you find something interesting, please don't shy away from sharing it with the community over at our [Discord server](https://discord.com/invite/23xU2hYrSJ). ## Tips and tricks for prompting code ### Benefits of a primer Using the primer above lets us use very sloppy prompts, while still getting a useful result:  Due to the primer, this result can be copied stright into a Function node without any modifications. Here is how it looks in a node graph with all the inputs and outputs: