ChatGPT: Crafting More Advanced Code

May 29, 2023 | 2 minutes read

A question was raised on Slack today:

Today when I asked ChatGPT for a coding prompt, it also told me,

Unfortunately, writing the full code for this would be beyond the scope of this platform.

Have you seen this before or is it an added limitation?

This response from ChatGPT isn’t entirely incorrect (though I’ve never gotten a response like that). The key to dealing with this is breaking down the larger task into manageable segments. Here’s the approach I tend to take:

Begin by saying:

I am in the process of creating a google apps script to carry out the following tasks... [define those tasks related to your outline]

Now create an outline for this script.

This outline will later serve as a roadmap for you to focus ChatGPT on specific functionality.

Next, prompt ChatGPT:

Describe the functionality of <outline step 1> without writing code.

Go through the list in this manner, keeping a document as a record of the progression. You’re the product owner here, so keep track of what needs to go into this.

Now, armed with these segments and your high-level summary, you’re ready to progress. Begin by saying:

I am developing an app that accomplishes <this high-level task>. I would like to construct this component: <insert the defined functionality>

Could you provide the code for this?

This approach helps break down complex tasks into smaller, manageable parts that can be tackled one at a time. The process not only helps in understanding the functionality better but also aids in building the code incrementally.

As you work through each step, you’ll run into errors. ChatGPT isn’t going to be perfect. Work through them. When you run into something that you don’t already know how to do - ask ChatGPT.

Don’t be afraid to start a new chat often. The new chat won’t know anything about the old chat - and that’s useful. When you need to ask about a problem with your editor, or installing a supporting tool, don’t contaminate the conversational context for the code you’re working on.

It’s important to remember that this is a conversation - if you have a question, ask it. If ChatGPT says something wrong, say so.

To see a sample implementation of this, take a look at ChatGPT Example: Crafting More Advanced Code