A prompt can be only a comment, a chat request, or a partly written function—yet a small wording change can produce a radically different result. Prompt phrasing is the particular wording and structure used to ask an AI system for an answer or code suggestion. It is not a reliable specification by itself: assistants may respond differently to nearly equivalent requests, and prior code, names, or conversation can alter what follows. section 1.3
Try the IPv4 puzzle. “Match an IPv4 address” led Copilot to a pattern that accepted dotted digit strings such as 56789.1.0.0987654. Asking ChatGPT to “Write a regular expression to match an IPv4 address” initially elicited a refusal-like limitation message; changing the request to “Write a Python program to match an IPv4 address” produced a substantially correct function, tests, and an explanation. The changed phrasing helped, but it did not turn the output into something beyond review. section 5.9
re.compile(r'(?P<first>\d+)\.(?P<second>\d+)\.' +
r'(?P<third>\d+)\.(?P<fourth>\d+)')
This first IPv4 suggestion looks plausible because it captures four dotted groups. Inspect it before trusting it: each group accepts one or more digits, so it recognizes the shape of an address rather than valid IPv4 ranges. section 5.9
Phrase prompts as hypotheses to test, not spells to obey:
- Vary the requested form when a response stalls. A request for a Python program succeeded where a request for a regular expression did not. section 5.9
- Ask for alternatives when an editor completion keeps choosing unhelpful prose or documentation rather than functioning code. section 4.24
- Check whether generated details answer the actual task. A generic domino-matching function and tests about the word “dominoes” are fluent but irrelevant. section 3.6
- Treat extra inferred requirements cautiously. Named IPv4 groups may aid subnet work, but that need was not requested. section 5.9
When a detailed comment still misleads
A comment-block prompt for detecting a same-rank pair in a poker hand eventually yielded working code and sensible explanatory comments. But its regex was cleverly wrong: under the stated hand format, no valid poker hand could match it. Better phrasing can obtain more output; it does not replace checking the representation, edge cases, and matching behavior. section 4.24
Prompt phrasing also interacts with the surrounding environment. In an editor, earlier variable and function names can steer completions; in a chat, previous exchanges can steer later answers. Since tools are continually retrained and responses may differ across attempts or interfaces, preserve the task’s real constraints in the prompt, then test the result against counterexamples rather than crediting apparent intent. section 1.3 section 5.9

















































