So whoever knows the right thing to do and fails to do it, for him it is sin. (ESV)
I have known people who thought that they were going to heaven based on the fact that they did not do anything that warranted their being punished. It is one of many lies that man believes. We think that because we are better than the really evil people (murderers, rapists, Dallas Cowboys fans) we somehow will be declared right before God.
Enter James 4:17. James takes the standard of God's holiness and makes it even more impossible for us to attain. He is saying here that it isn't avoiding sins that is all that is required. He tells us that if you know the right thing to do and you did not do it, you have sinned. Is there anyone on the planet who can honestly say that they have always done every right thing they knew they should have done?
God's standard of holiness requires that we avoid sin, and also that we do the righteous things he has required. The more we look into this perfect standard we find that we simply do not match up. We could find all kinds of righteous things to do for God but then realize we forgot to do even more. Avoiding one thing that we know we ought to do is for us, sin.
What is to be done about this predicament that we find ourselves in? We go to the cross. We recognize that Jesus Christ is the fulfillment of all of God's Law. I am not holy because I behave in a holy manner. I am declared holy because of my faith in the sacrifice of Jesus Christ, the perfect fulfillment of the law, on my behalf.
Ask the Lord to show you the things that you need to do for him. His Holy Spirit will empower you and encourage you. Don't dwell on your sin. Dwell on the grace of God. He loves you.