To get back to the question of the number of SY
Early game:
3 commercials with 3 slipways each (1 for freighters, 1 for colony ships and 1 for anything else)
5 military; 3 x 6000t with 3 slipways each for building DDs (DDG, DD and DE) and 2 x 1.000t with 6 slipways each for FAC construction
Mid game:
2 additional commercials (3 slipways each) so I don´t have to retool the "auxilary" one quite so often and the freichter/colony yards get additional slipways (those are the ships I want to massproduce)
3 additional military yards (also with 3 slipways) for building cruisers (CR, CG, CE) in the 12.000 to 15.000t range (usually, I expand the destroyer yards in size and expand the new ones to 8.000t (DDs get bigger over time)
Late game:
Maybe an additional FAC yard.
Other than that, the DD yards get expanded to 15.000t and the CR yards up to 35.000t
I´d like to have another 3 military yards, churning out DDs, but by that time, I usually hurt for minerals, so construction slows down somewhat anyway.
When you happen to start in a nebula, you can forget about the missile designs and reduce the number of shipyards accordingly.
3 slipways per yard seem to be a good compromise between retool-cost and mass-production.