This article explains a simple JavaScript snippet that automatically prepends a fixed message to the ChatGPT prompt input field. The goal is to enforce a consistent instruction—such as asking ChatGPT to always generate Git commit messages in English—without manually typing it every time.
The script is wrapped in an Immediately Invoked Function Expression (IIFE) so it runs as soon as it is loaded. Inside, it follows these steps: