You need to use the Question Tags to indicate the name and full version number of the Story Format you are using, as answers can vary based on that information.
A. If you are using the 1.x series of Harlowe (eg. v1.2.4) then your example will work because that series only requires you to pass a single String parameter to the (prompt:) macro.
(put: (prompt: "What's your name?") into $name)
(set: $name to (prompt: "What's your name?"))
B. If you are using the 2.x series of Harlowe (eg. v2.0.1) then as explained in the (prompt:) macros documentation you need to pass two String parameters to that version of the macro.
There are two examples of how to use the 2,x series version of the (prompt:) macro in @Chapel's answer to your question.
1. you can use either a (put:) macro or a (set:) macro to assign the returned value of the (prompt:) macro to a variable.
2. the 1.x series documentation for the (prompt:) macro incorrectly states you need two parameters.