5. Separating instructions from data

When you work with prompts that include both instructions and external data, keep a clear separation using delimiters.

The problem of mixing everything together

Confusing prompt:

Hi. You have to arrive at 6 in the morning because I'm the boss. Rewrite this email more politely.

Where does the instruction begin and where does the content begin? It's not clear.

The solution: delimiters

Improved prompt:

I have the following email:

--- You have to arrive at 6 in the morning because I'm the boss. ---

Rewrite it more politely but without changing the main message.

Using XML tags

XML tags are especially effective:

I have the following email:

<email> You have to arrive at 6 in the morning because I'm the boss. </email>

Rewrite it more politely but without changing the main message.

Multiple pieces of data

Compare these two articles and tell me which one is more objective:

<article1> The new mayor has implemented revolutionary changes that will transform the city into an urban paradise. </article1>

<article2> The mayor has implemented several measures in his first month, including new pedestrian zones. The reception has been mixed, with 60% approval according to a municipal survey. </article2>

Explain your reasoning in 2-3 sentences.

Why it works

Separating instructions from data:

  • Eliminates ambiguity
  • Improves precision
  • Makes complex prompts easier
  • Makes prompts reusable

Using delimiters and XML tags is a simple but powerful technique. When you clearly separate what you want to do (instructions) from what you want to work with (data), you eliminate confusion and get more precise responses.

But there is an even more effective way to communicate what you expect: showing concrete examples. Instead of describing in words how you want the response, in the next lesson you will learn to let the AI learn from the pattern you show it.

This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.

Desafíos de programación atemporales y multiparadigmáticos

Desafíos de programación atemporales y multiparadigmáticos

Te encuentras ante un librillo de actividades, divididas en 2 niveles de dificultad. Te enfrentarás a los casos más comunes que te puedes encontrar en pruebas técnicas o aprender conceptos elementales de programación.

Buy the book

Will you buy me a coffee?

This is how I keep writing without ads or paywalls.

Comments

There are no comments yet.