I just think it adds more to a multi worker situation and a building that hasn't been built yet doesn't need repaired because it hasn't been built yet, but workers that can't build that type of building could use their repair skill to help contribute a bit.
That's already how it works.
It's not really, all units that can repair the building go over and repair it (if auto repair is on, else if instructed) and if instructed workers that can't repair it but have a repair command can be told to repair the building and they do which I'm not sure if it's meant to be like that or if it's a bug.
Also a building should only be completed by the build skill if it's about to be completed using just repair it should have -1 its total hp until a unit that can build the building comes and polishes it off this stop people using one worker type from starting the building then swapping to another to finish it off.
This all adds to a diverse faction that has multiple workers where some workers can build or repair faster or move faster, etc.
Why would a worker know how to repair something that he/she can't build? Either you can lay bricks or you can't. Why would a unit be able to lay every brick except the final one?
You have a good point here, maybe instead if a building is being built by workers that can build the building then workers that can't can assist with their repair skill (optional assist flag or something?). If the workers that can build the building suddenly stop and go away then all assisting workers that can't build it and are using their repair skill would stop. The idea is they're being guided by other workers so when the other workers go away the workers that can't build the building aren't being guided any more so have to wait for the other workers to come back.
Also the auto-repair skill should tell workers to auto-build nearby buildings that are being built too using their build skill not repair.
So when building buildings...!
If a unit can build the building:- They can start building it.
- They use their build skill in place of their repair skill when the building is using it's be_built skill.
- Auto-Repair effects building things as well as repairing.
If a unit can't build the building:- They can't start building it (obviously).
- They can only use their repair skill to help build the building which is slower and only when at least one worker that can build the building is using its build skill on it, else repairing is stopped/cannot be started.
- Auto-Repair acts as normal (so long as the building listed in the units repair list).
Also the repair skill/command should have a flag that disallows repairing buildings that are being built (using their be_built skill to be precise). As some units may have powerful repair skills which fix buildings fast. (One of my factions will have units dedicated to maintaining buildings, this would mean that they can use these units to build things really fast.)
If this makes some mods broken so that buildings are built too fast, perhaps buildings could have a flag or something set somewhere like their parameters or in their be_built skill where only a certain amount of units can use build on it (this would be a default of 1 but could be increased or set to 0 for no limit).