The claim that God is perfect grounds the claim that God is goodness itself in the Thomist worldview only because the Scholastic philosophy to which St. Thomas subscribes regards "being" as synonymous with "goodness." The Scholastics essentially argued that not existing is the greatest possible imperfection, and the more fully realized a thing is, the better it is. The mind of a human is better than the mind of an animal because it it more fully realized, encompassing more actual (and thus fewer potential) faculties. Something perfect, therefore, would have to be 100% actual and 0% potential, existing as completely as it is possible to exist. This makes perfection synonymous with complete being, and therefore with complete goodness.
St. Thomas regards God as perfect, since He is the origin of all perfection in the universe. Every possible perfection in the universe is in God, actual and fully realized. Since God is perfect, 100% actual and 0% potential, he is a complete being and therefore absolute goodness. Every form of being and goodness must exist in God in a fully realized state.
The Catholic Church has continually used this teaching to combat the assertion of the Cathars, and other sects it regards as heretical, that there are two Gods, one good and one evil. The Church replies that an evil God would lack both perfection and actuality.