Anas ibn Malik reported: The Messenger of Allah, peace and blessings be upon him, said, “Seven deeds of a servant continue to be rewarded after his death while he is in his grave: knowledge to be learned, constructing a canal, digging a well, planting a date-palm tree, building a mosque, handing down a written copy of the Quran, and leaving a righteous child who seeks forgiveness for him after his death.”
Source: Musnad al-Bazzār 2773
Grade: Sahih (authentic) according to Al-Suyuti
عَنْ أَنَسٍ قَالَ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ سَبْعٌ يَجْرِي لِلْعَبْدِ أَجْرُهُنَّ مِنْ بَعْدِ مَوْتِهِ وَهُوَ فِي قَبْرِهِ مَنْ عَلَّمَ عِلْمًا أَوْ كَرَى نَهْرًا أَوْ حَفَرَ بِئْرًا أَوْ غَرَسَ نَخْلا أَوْ بَنَى مَسْجِدًا أَوْ وَرَّثَ مُصْحَفًا أَوْ تَرَكَ وَلَدًا يَسْتَغْفِرُ لَهُ بَعْدَ مَوْتِهِ
2773 البحر الزخار بمسند البزار
4627 المحدث السيوطي خلاصة حكم المحدث صحيح في الجامع الصغير