I have a question about computations in general relativity and transition from a Lorentz frame to a general fame just by substituting the flat metric with a general one and ordinary derivatives with covariant ones, I'm a little confused by this. For example if I have to compute the d'alambertian of the square of a scalar field I'd do the following:
First compute it in a Lorentz frame: $$ \Box f^2 = \partial_\mu \partial^\mu f^2 = \partial_\mu(2 f \partial^\mu f) = 2 \partial_\mu f \, \partial^\mu f + 2f \partial_\mu \partial^\mu f $$
Now I go to a general frame replacing ordinary derivative with covariant derivatives obtaining
$$ 2(\nabla_\mu f \, \nabla^\mu f + f \, \nabla_\mu \, \nabla^\mu f) = 2 (\partial_\mu f \, \partial^\mu f + f \, \Box f) $$
Where the in the last equality the I used the fact that the covariant derivative of a scalar field is an ordinary derivative and $ \nabla_\mu \, \nabla^\mu = \Box$.
Is this the correct way to procede in these situations?
Can I apply this method everytime?
As far as I understand everything I've done here is right but I'm not completely sure about it, are there any other smart and right ways to do these computations?