Tattoos & Coding With ChatGPT

I’ve seen a few users post about tips & tricks for using ChatGPT as a coding buddy for larger projects. While I don’t claim to be an expert here are a few things I do that tend to help…

Tip #1 - Use Tattoos
If you’ve ever seen the film ‘Memento’ coding with ChatGPT tends to be a lot like having a conversation with the main character in this movie ‘Leonard’ who doesn’t have the ability to form new memories. You can have a perfectly cogent conversation within the context window limits of ChatGPT and then boom it’s forgotten the critical context that took place earlier in the conversation. I address this the same way Leonard addressed his problem, I regularly get ChatGPT to create the equivalent of ‘tattoos’ for the important stuff. My prompt looks something like “Write a prompt that I can use with another chat session to quickly establish context on where we are at on this project and pick up from where we left off.” I then usually have to refine it a bit to include key technical details etc. but it has worked surprisingly well over a relatively large scale project. I’ll do this once every couple of hours or so based on how much progress I’ve made.

Tip #2: Keep things short
Another tip (that others have already surfaced) is to keep your code modular (best practice anyway) as I’ve found ChatGPT definitely starts to get ‘creative’ (read changing variable names etc.) if asked to do too much at once.

Tip #3: Beware of outdated code
Having been bitten by the ‘using outdated approaches/libraries’ etc. snake numerous times I’ve learned that you should be especially cautious when ChatGPT is proposing libraries. I spent a lot of time troubleshooting issues that were ‘state of the art approaches’ circa 2021 but now are no longer recommended and/or not supported. Curiously this actually happens quite a bit even when referencing OpenAI’s approaches to doing certain things.

Tip #4: You can ‘update it’ at least for a short while
Within the bounds of the context window, I’ve had some success ‘teaching’ ChatGPT new approaches/technologies etc. at least for a short while. Things like LangChain, Microsoft Guidance, Function Calling (though it really struggles with this) I’ll typically grab the most cogent bit of API doc that would be the most helpful for ChatGPT to chew on and then run it through a ‘space remover’ in python to reduce the token count. If done thoughtfully you can get some mileage on newer technology that it wasn’t trained on, but again the ‘Memento’ effect will bite you before long.

Tip #5 - Always get it to work off an actual code snippet if possible
To minimize the level of destructive ‘creativity’ in it’s coding it’s important not to rely upon it remembering a code snippet you provided several steps back in your chat. I’ve found that’s when the unicorns and moonbeams tend to find their way into your code, so if you are looking for higher precision code updates share your code snippet and ask it to start with that right in the prompt.

Tip #6 - Beware the sycophant
The ‘reinforcement’ learning that OpenAI is doing on ChatGPT is definitely degrading the ‘trusted advisor’ capability of the model. I’ve noticed in the last few weeks especially that even a lightly worded push back on my part will take ChatGPT away from a perfectly valid and better direction and towards whatever hair brained direction I suggested, often with disastrous consequences. It seems to be really poor at ‘standing up to me’ even when I ask it to. I’m sure this will get calibrated better in time but as a coding companion I’d prefer that it was a bit more assertive in guiding best practices.

Tip #7 - Force it to slow down and think
For more complex tasks that require a strategic mindset it’s really helpful if you ‘force it’ to stop and think before coding. It doesn’t matter how many times I tell it to proactively ask if my requirements are unclear (which they often are) it almost never proactively asks for clarification, and then this leads to bad guesses. When I ‘force it’ by explicitly saying in a prompt ‘let’s stop and evaluate blah blah’ then and only then will it ask important questions that clarify my intent. Without question this typically yields much better results on complex tasks.

Anyway, those are a few things that have worked for me. Your mileage may vary. “Don’t believe his lies.” (Watch Memento to get this reference. :wink:


This would be more appropriate for the “prompting” category of the forum.

Also, ChatGPT is distinctly not API.

Nice write-up. I’ve also noticed that I need to almost continuously refresh ChatGPT with the information otherwise it quickly returns to what it’s trained on.

Love the momento reference as well.

I’d like to add separating concerns. Sometimes I catch myself blending multiple instructions, which isn’t necessarily bad, but having it reason out it’s answer for a single purpose and then building on top of that has really helped me.


I’ve gone ahead and moved the topic to Prompting.

1 Like