Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:29:7

And those who believe and do righteous deeds - We will surely remove from them their misdeeds and will surely reward them according to the best of what they used to do.  

And those who believe and perform righteous deeds, We will surely absolve them of their misdeeds, by their performance of righteous deeds, and We will indeed requite them with the best of what they used to do, namely, their righteous deeds (it ˹ahsana˺ is in the accusative because the operator of the oblique ˹bi˺ has been omitted).
القرآن:٢٩:٧

وَالَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ لَنُكَفِّرَنَّ عَنْهُمْ سَيِّئَاتِهِمْ وَلَنَجْزِيَنَّهُمْ أَحْسَنَ الَّذِي كَانُوا يَعْمَلُونَ  

{والذين آمنوا وعملوا الصالحات لنكفرن عنهم سيئاتهم} بعمل الصالحات {ولنجزينهم أحسن} بمعنى: حسن ونصبه بنزع الخافض الباء {الذي كانوا يعملون} وهو الصالحات.