Provide Examples
One concrete example is worth a paragraph of description. If you want output in a particular shape, show the shape. This is the fastest way to eliminate ambiguity.
Format the data nicely.
Transform this array of users into a summary object.
Input:
[{ name: "Ann", role: "admin" }, { name: "Bo", role: "user" }]
Desired output:
{ total: 2, byRole: { admin: ["Ann"], user: ["Bo"] } }
Write the transform function and a test matching this example.
Examples pin down naming, structure, and casing that words alone leave fuzzy. When you can, include the example as a test — then "make the test pass" becomes an unambiguous instruction. The trick generalizes: a sample response from an (Application Programming Interface — the way one program requests data from another) pins down a parser, a before/after pair pins down a refactor, a screenshot or ASCII sketch pins down a layout. Whenever you catch yourself writing a long description of a shape, stop and show one instance of the shape instead.