How to handle input and output? Return JSON {"rules": [list of 2+ rules], "why": "brief"}.
Key mindset shift: Both user input AND model output are untrusted data. The user may try to break your prompt; The model may return incorrect, harmful, or substituted content. Rules: Do not paste model output directly into HTML, SQL or commands without escaping (risk of XSS and injections); validate the structure and content of the response before use; limit what the model can generally return (format, length); treat her text as input from an outsider, and not as code from yourself. Rule: trust the model’s output exactly as much as you would trust the text from a random user - that is, do not trust, but check.