The general rule is that for a shipyard tooled for class A, it can build class B if the refit cost from A to B is less than 20% of the BP cost for class A, where refit cost is:
Refit Cost = (cost of B components not on A) * 1.20 * ABS(sizeA - sizeB) / sizeA
Note that this is not a symmetrical cost, i.e. the cost to refit from A to B is not the same as or even mathematically related to the cost to refit from B to A, since the cost of removed components does not factor into the calculation. In other words, if a shipyard tooled for A can build B, that does not mean that a thipyard tooled for B can build A, so you need to choose which class you tool for very carefully.
For a freighter/colony ship combo this is fairly easy, as the cargo hold is quite cheap and the components are otherwise identical. Design a freighter with your desired size of cargo hold, then copy it and replace the cargo hold with cryo modules of the same total mass for your colony ship. Tool the shipyard to build the colony ship (which is usually more expensive) and you've got it. You may be able to do something similar for a supply ship (carrying MSP) since it also uses cargo shuttles, but given how tonnage-efficient MSP is this may be a waste of tonnage until much later in the game
For the collier and tanker this is harder since they require different load/unload modules which bumps up the cost of a refit. Honestly, my suggestion here would be to just build more commercial shipyards since they're really not that expensive to push up to the 25,000 or 50,000 tons you would need for each type of auxiliary ship. Alternatively, you can combine tanker/collier/supply ships into one larger auxiliary design, which will save you a couple shipyards at the cost of an inefficient design.
As a general note, if you're having trouble getting two ships to be buildable at a common shipyard, remember that they need to have a lot of their component BP in common. Often the most expensive common component is going to be the engines, which leads to the rather unintuitive advice that you may be able to make the refit cost "cheaper" (i.e. a smaller percentage of the ship cost) by adding more engines. For your Luna class I would probably add 4-6 more engines at least, which also gives you more speed (125 km/s is painfully slow outside of the conventional era), and that might help you get closer to a common shipyard for more of your commercial ships as well - eventually, engine costs will be high enough that even the tanker and collier refit costs will get under that 20% margin. As a side note I'll point out that the optimal ratio of engine mass to fuel mass is 3:1 so if for example you have six engines (150 HS), you can bump up to 50 HS of fuel (2,500,000 litres), which is a bit more than 3x what you have now so you'll keep roughly the same range.