It is a thought provoking question. Those who speak so against works think they have the answer by simply saying we must not work, and scripture says we must. Scripture tells us to be perfect on one hand and that we will never be perfect on the other. Scripture says it is only faith we are judged by and our heart, that God gives us grace based on that.By what will those be judged that are judged? Those that have Christ will be judged by His righteousness, yes, and those without by their own filthy works, but by what is righteousness measured? Is it simply belief and unbelief in Jesus or something more?
I think it has to do with how we react to our faith. If there was a bridge we had to go over to get to our home and we said we had faith in that bridge that it would not break if we used it, but our faith in the bridge wasn't enough to actually step on it, then how we acted would tell our faith. So if we have faith in God's instructions to be kind to our neighbor and we did something to harm him, it would show we didn't have faith in what God told us.