The Prophet (blessings and peace of Allah be upon him) said: “Allah, may He be glorified and exalted, will say: ‘The angels have interceded and the Prophets have interceded and the believers have interceded, and there is no one left but the Most Merciful of those who show mercy. And He will seize a handful from the Fire and will bring forth from it people who never did anything good.” Narrated by Muslim. What is the meaning of the words “[they] never did anything good”?.
What is meant by the words “[they] never did anything good” is that they did not do any righteous deeds apart from believing and affirming in their hearts. These people either died before they were able to act, so they believed and then died before they were able to do anything, so in that case it is true to say that they never did anything good;
Or this hadeeth is to be understood in the light of other hadeeths which indicate that forsaking some righteous deeds constitutes kufr, such as prayer, so the one who does not pray is a kaafir even if he claims to believe in Allah and His Messenger. The kaafir will not be benefited by the intercession of any of those who intercede on the Day of Resurrection; he will abide in Hell for ever and ever -- Allah forbid.
The point is that this hadeeth either applies to people who believe but were not able to do any righteous deeds as they died straight after they believed, so they never did anything good;
Or it is general in meaning but an exception is made with regard to matters which the shar‘i texts state are essential, such as prayer -- so the one who does not pray is a kaafir who will not benefit from intercession and will not be brought out from Hell. End quote.
Shaykh Muhammad ibn ‘Uthaymeen (may Allah have mercy on him)