There are two aspects to writing a valid script: syntax and semantics.
Getting the Syntax Right
The DicomEdit script must be written to conform with the rules of the language. We currently do not have a tool that will automatically validate a script. We must resort to trial and error. Sending data to XNAT through an invalid script will cause the underlying DicomEdit to throw errors. These errors will be captured in XNAT's log files. Of particular interest are dicom.log and anon.log.
Getting the Semantics Right
Even if the script is valid syntax, does it really do what you intend it to do? Here, there is no substitute for running test data through your script and manually verifying that the contents of the transformed DICOM objects are as intended. XNAT provides a number of places that provide access to a "DICOM Dump". This is a view of all the attributes that exist in the DICOM object and their values.