A few simple rules.
If a piece of wire (or shield) is terminated at ONE END ONLY, then no current can flow through it. Actually small amounts can flow due to capacitance but this will usually not be significant in this environment.
Keep signal (limit switch, sensors, encoder) wiring well away from stepper motor wires and always try to rout them at right angles to each other, and never tied together in the same bundle.
Just because you have a negative terminal nearby don't use it instead of running a wire back to the common negative.
Single points for negative power.
Single points for positive power.
Never use the 'nearest' common of a conductor. This is important if significant current flow is concerned.
Consider every wire as a resistor. Analyze what currents flow, and
don't allow currents to flow in ANY of you earth conductors.
That's a start any way...
It easy to get the smoke out. Hard to get it back in again.
My 1000th post. Cool.. :withstupi
Super X3. 3600rpm. Sheridan 6"x24" Lathe + more. Three ways to fix things: The right way, the other way, and maybe your way, which is possibly a faster wrong way.