I'm aware that for some tensor product space, Schur-Weyl duality lets me decompose the space into irreducible representations by looking at irreps of the symmetric group. The simplest example is $V\otimes V\cong \mathrm{Sym}^2(V)\oplus \Lambda^2(V)$. In physicists' notation (warning, I am a physicist), we would write $T_{ab} = T_{(ab)} + T_{[ab]}$.

However, when talking about tensors on a manifold $M$ with metric $g$, we can also take traces and so further reduce symmetric products into a trace and trace-free part, i.e. $T_{ab} = \frac{1}{d}g_{ab}T + [T_{ab}]^{\tiny{STF}} + T_{[ab]}$ where $T\equiv g^{ab}T_{ab}$, $d$ is the dimension of the manifold, and $[T_{ab}]^{\tiny{STF}} = T_{(ab)}-\frac{1}{d}g_{ab}T$. This seems to be relevant because because $g$ is an invariant symbol of $SO(p,q)$ where $(p,q)$ is the signature of $g$. There will also be an alternating tensor of highest rank which will be an invariant symbol, and this could also appear in the decomposition.

Schur-Weyl doesn't seem to say anything about metrics, trace/trace-free decompositions, etc. What is the general decomposition here? Is there an algorithm to follow?