How to route wire around a box?
The box must be large enough for the wire fill and device by code since you are installing a 20 amp circuit it should be #12 wire. #12 wire has a volume of 2.25 per conductor and 4.5 for the device so if you use a shallow box and only run the 3 wires into it the box volume would need to be 11.25 sq inch (listed value not measured) if there is enough room to put the wire to the back of the box and still have 1-1/4" to the face of the stud this would be legal. If you run through the box without a splice the volume would need to be 15.75. You only count 1 ground wire in the box. I did not add a clamp volume of 2.25 because these look like non clamp boxes. And the cables will need to be stapled within 8" of the box, 12" with clamps.