Though I am a novice with writing/editing Drafts scripts I would still much prefer to use an external editor on the Mac such as BBEdit to edit a script.
Put your code in a file in the
Scripts directory, edit it in BBedit, and
require it in your action.
For general development, the following may also be useful to speed things up. I use VS Code for my Drafts scripting on the Mac, but the same underlying approach as above.
Thanks again Stephen. The ‘require’ trick should help.