There are several steps that I can think of that "precede" or are "peripheral" to the actual writing of Sta"m (Sifrei Torah, Tefillin and mezuzot). Can any of these be done by a Gentile?
Preparation / manufacturing of blank parchment sheets (I'm uncertain of the exact process of how parchment is made. Most likely, it involves numerous steps from the time of getting the skin off the animal until the time that it becomes parchment, including any "glossing" or other finishing.
Preparation / manufacturing of the ink
Sirtut - drawing rule lines on the parchment
Sewing parchment sheets together
Manufacturing atzei chayim (wooden "rollers") for Torah
Placing the atzei Chayim
- Manufacturing the straps including any finishing (polishing, coloring, cutting, trimming, etc.)
- Manufacturing the batim - all parts involved including stripping the leather, and shaping the housing, and any finishing, coloring, or polishing, etc.
I may have listed, mainly items that can not be done by a Gentile, inadvertently. If there are items that can be done by a Gentile that I haven't mentioned, please mention them.