In Analytical mechanics, when we formulate our principles, in general, it is assumed that we start with a cartesian coordinate system, and then find some generalised coordinates $q_j$s they are all independent each other in a way that they implicitly contain the constraints, so that changing the value of one of $q_i$s does not force force us to change the other $q_j$s, i.e they are independent.
However, in none of the books or lectures that I've seen, there haven't been anything mentioned about how to find those independent coordinates, or any thing about the issue that if we have some set of coordinates, how we can test whether they are all independent and a complete set of coordinates s.t they describe the system completely, or even the number of independent coordinates it is needed.
Of course, there are lots of things talked about the degrees of freedom of a system, but I haven't seen anything about how to determine the degrees of freedom of a given system.