A spec describes what the product will do, how it should look and how it should behave before anyone writes the code. Spolsky compared writing specs to flossing, which everybody agrees is good and nobody does, and warned: "Software that wasn't built from a spec usually winds up badly designed and the schedule gets out of control." Changing a paragraph costs seconds; changing a shipped feature costs weeks.
The thick documents of 2000 are rare now, but the discipline survives in lighter forms: a design mockup in Figma 867 , acceptance criteria in the issue, an OpenAPI description of the back-end contract, and a short design document or RFC that colleagues review in a pull request, just like code. Specs matter even more with AI coding agents, which do exactly what you describe; a vague prompt produces confidently wrong code.