Write the spec like a contract: inputs with types, outputs, and at least one example. The edge cases you list are where generated code usually fails.