Basically, both designs need to have their most expensive parts in common.
My geosurvey and gravsurvey ships are never compatible since the geo and grav modules typically make for over 50% total cost. My terraformers are compatible, since the only difference between them is the engines, amounting for less than 10% total cost. I've also been able to make armored freighters (for nebulas) from the same shipyards as normal ones, since only several armor layers are added.
In the class design screen, DAC/Rank/Info tab, there's a box titled "Eligible additional classes if ...", and below it the refit cost from another class. The refit cost needs to be at most 20% of the total cost. Yes, you can have a refit cost of over 100% the total cost.
So you have a naval shipyard, tooled to produce a warship, that can also build a salvage ship?... My guess is they have about the same size and armor, with the same engines. ... You put commercial engines on your warship? Now I need the design specs, as stated by Nathan.