I have a Lagrangian which contains the term $$\operatorname{tr} \left(D_\mu\phi^{\tilde{a}} D^\mu \phi^{\tilde{a}} \right),$$ where $\phi^{\tilde{a}}=\phi^{\tilde{a}a}T^a$ with the indices $a$ and $\tilde{a}$ denoting the gauge and flavor group respectively. Furthermore, $D_\mu$ is the gauge covariant derivative which can be written as $$ \partial_\mu+ig A_\mu^aT^a $$ I have a hard time writing the above term explicitly, i.e., I am not sure how to assign color labels (without the tilde) to the fields. Intuitively I expand it as $$ \begin{aligned} &\operatorname{Tr}\left( \left[\partial_\mu \phi^{\tilde{a}}+ig A_\mu \phi^{\tilde{a}} \right] \left[ \partial^\mu \phi^{\tilde{a}}+ig A^\mu \phi^{\tilde{a}} \right] \right)\\ & \operatorname{Tr}\left(\partial_\mu \phi^{\tilde{a}a}\partial^\mu\phi^{\tilde{a}b}T^aT^b+2ig\partial_\mu \phi^{\tilde{a}a}A^{\mu b}\phi^{\tilde{a}c}T^aT^bT^c-g^2A_\mu^{a}\phi^{\tilde{a}b}A^{\mu c}\phi^{\tilde{a}d}T^aT^bT^cT^d\right)\\ &=\partial_\mu \phi^{\tilde{a}a}\partial^\mu\phi^{\tilde{a}a}+2ig\partial_\mu \phi^{\tilde{a}a}A^{\mu b}\phi^{\tilde{a}c}\operatorname{Tr}\left(T^aT^bT^c\right)-g^2A_\mu^{a}\phi^{\tilde{a}b}A^{\mu c}\phi^{\tilde{a}d}\operatorname{Tr}\left(T^aT^bT^cT^d\right) \end{aligned} $$ Please correct me if I am wrong.