You probably already know this part, but for others finding this thread later, here’s the overview FAQ for how custom code works in smart things:
So now you’ve got two separate issues to solve with custom code. One is color control of the Hues, and the other is getting the Cooper switches to follow Each other for dimming. To be honest, I’m not sure if you can do it all with one smart app or if you’re going to need two.
Since you have a technical background, there is a community project in the early stages of development for an extremely sophisticated rules engine. Because it’s just an alpha, there will be glitches, and you may have to from time to time remove everything you’ve done and reinstall. But if you do get involved you’ll be able to work directly with the developer and can influence which features are added. Here’s the thread for that. ( again, this is a bunch of highly technical people talking to each other, and not a fully baked solution yet. )
If you prefer to look at something which is much more mature, there’s an excellent smartapp for managing Hue scenes. You can also ask in that author’s topic if anyone is using dimmer switches as masters (again, always with the caveat that a physical dimmer switch should not control the current sent to a smart bulb).
Separately, the issue of having one dimmer follow another using the hub as the middleman, there are several popular smart apps that do this. “Dim with me” and “dim and dimmer” are both well established.
This is a newer one which would also be worth looking at because it’s a “many to many” version of dim with me, so it might fit your set up better. Dim with me assumes one master switch and then everyone else follows it. What people have traditionally done with that is to install it multiple times with each partner as a master in one version. So if you have switches A, B and C, one version has a as the master, another version has B as the master, and a third version has C as the master. This newer “synchronized dimming” smart app does all of that in one install.
There are a lot of other lighting smart apps with different variations, so you can just check the community created smart apps area of the forum and see what’s there.