I have always described legalism as the view that your spirituality is measured by what you do (or don't do).
For instance, our spirituality used to be measured by the length of our hair (the shorter it is, the more spiritual you are); the length of one's dress (the longer, the more spiritual); the kind of cards you played, etc.
Somebody joked about it, saying "I don't smoke, drink or chew, or go with girls that do."
Dancing was mostly a no-no, particularly dancing in which the partners touched. Some modified it, saying dancing was okay if you were six feet apart shaking.
As far as cards, gin rummy was out, but Rook was okay.
Spiritual people stay away from the movies. Later, spiritual people could go to the movies, just not on Sunday.
My church's business meeting minutes of the late 1920s indicated that the church disfellowshipped a man for gambling. He invested in the stock market. (Considering what happened to the stock market in 1929, maybe the church was right).
The specifics change. The Pharisees had different criteria. The bottom line is that legalism measures your spirituality by external rules.