I have done both. There is a method for writing device generators in Tcl directly, which is what's in the file sky130A.tcl and draws all the devices that magic currently knows how to draw. But that doesn't include waffle pattern power transistor layouts. But lately, for writing scripts to do DRC checks in batch and stuff like that, I've been tending more toward writing a Python script that writes a Tcl script and then launches magic in batch mode using a subprocess call.