Prevent chatGPT from giving code if not asked explicitly

Hello !

I am a junior developer and I use ChatGPT a lot as a learning tool, as if I had a senior available to answer my questions. The problem is that most of the time, when I ask a simple question, I get a response that is way too long and almost always includes code that I didn’t ask for. Yet I have customized the instructions for it to give me simple and concise answers, and I constantly ask it not to give me code unless I explicitly request it. It is becoming extremely frustrating to have to stop its responses every 3 messages and repeatedly ask it to go step by step, simply and without code… Is there a way to stop this problem? I feel like the “Customize ChatGPT” instructions are useless…

Thanks for your help !



Yes, this behavior is a pain at times.
I often choose a prompt that the conversation is on a ‘conceptual level’, ‘purely explorative’ and that ‘code is not wanted at the current point in time’.

It works almost always for me.
If you really can’t get rid of this behavior you can maybe share some example prompts.

Hope this helps!


Thank you for the advice!

In my prompts, I often explain in detail my needs and the context around it, and I almost always start with “do not give me code unless I explicitly ask for it”, but as soon as the conversation gets a bit long, ChatGPT seems to forget this.

I will focus a bit more on the prompt and see if it makes a difference!

1 Like

You can do this in a few ways:

  1. Structured Approach:

    • Create sections with comments in your code.
    • Instruct ChatGPT to focus on a specific section and make changes only after you provide details and confirmation.
  2. Step-by-Step Guidance:

    • Tell ChatGPT to follow your lead and focus on specific locations in the code (e.g., class, function name).
    • Have it create or modify code only after you confirm the upgrades, changes, or different approaches to solving the problem.
  3. Placeholder Method (for extensive work, though with GPT models, this might not be necessary):

    • Create placeholders in your code, similar to making a selection in a picture using DALL-E (imagine that way of selection, you will do it for him with comments in code).
    • Instruct ChatGPT to focus on the code inside the placeholders and provide specific instructions.

For example:

other functions...

# Start of the section where we focus:
# TODO: Add your instructions here

# End of the section where we focus.

other functions...

Thank you for the response, but it doesn’t really fit my situation.
I rarely copy my code to send to ChatGPT. Generally, I tend to send only error messages when I am stuck.

My problem is more when I ask it simple questions, for example about architecture or technology choices, and it responds with much more than what I ask for, including a lot of code (step by step instructions).
Typically, I try to understand what is happening without mindlessly copying and pasting its instructions, and I may have a lot of questions for each step provided.

But your answer is still interesting and I might have to use it in another context!

I saw Prompting and ChatGPT tags there. You’re welcome

I experience this problem too, even if I start with the prompt:
It still will spam code examples in response.

The most effective way for me so far is to add after each of my questions “pas de code” (no code). It’s not that long to type and works everytime.
I got used to it now.

If I do want some code, but I don’t want ChatGPT to answer with tens of useless lines, I’ll just add “juste le code nécessaire” (only the code needed).

You might need to experiment with it and see what works for you. Since I primarily converse with ChatGPT in French, I’m not certain what will be effective in English or your native language. However, you should be able to find a short sentence for these types of situations.

Yes this would work, but it’s a shame it seems to ignore the custom instructions for it completely. I have a lot of new conversations and it would be a lot more user friendly if it would respect these instructions better, not only limited to the not displaying of code, although this is the most annoying one for me.

What I do sometimes when doing initial planning for a piece of code, or object is to tell it we’re working on pseudocode, not real code as I want to make sure we have the correct code structure first. It doesn’t take it more than 1-2 prompt before it start to ask “shall I code it?” though.

Secondly I often break down the problem in isolated objects - and small snippets, where I can say “this is the input” - “I need this output” - it works well on smaller snippets. Not always doable - I know.