Good deeds that come from God and good deeds that come from ourselves could be compared to gold. Gold that is nothing but gold and is called unalloyed gold is good gold. Gold that is alloyed with silver is gold, too, but its value depends on the alloy, while gold alloyed with copper is less valuable.
Artificial gold, though, and things given the color of gold, are not good; there is no real gold in them.
There is also gilding. There is gilt silver, copper, iron, tin, and lead, and also gilt wood and gilt stone. They may look like gold superficially, but since they are not gold they are valued according to their artistry or the cost of the gilding or the cost of the gold that can be stripped from them. This value is as different from that of gold as the value of clothes is from the value of the one who is wearing them.
For that matter, you can cover rotten wood or slag or even excrement with gold. This is “gold” that could be compared to pharisaical “good works.”
We can tell by science whether gold is substantially good, whether it is alloyed or fake, or whether it is just gilding; but science cannot tell us whether the good we are doing is essentially good. All we know is that good actions that come from God are good and good actions that come from ourselves are not good; so since it is important for our salvation to know whether the good things we are doing come from God or not, this needs to be revealed. Before it is revealed, though, something needs to be said about good works.
from Life/Faith, Sections 10, 11