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.
bukhari:7554Muḥammad b. Abū Ghālib > Muḥammad b. Ismāʿīl > Muʿtamir from my father > Qatādah > Abū Rāfiʿ > Abū Hurayrah

I heard Messenger of Allah ﷺ saying: "Before Allah created the creations, He wrote a Book (wherein He has written): "My Mercy has preceded my Anger.' And that is written with Him over the Throne." (see Hadith 3194)  

البخاري:٧٥٥٤حَدَّثَنِي مُحَمَّدُ بْنُ أَبِي غَالِبٍ حَدَّثَنَا مُحَمَّدُ بْنُ إِسْمَاعِيلَ حَدَّثَنَا مُعْتَمِرٌ سَمِعْتُ أَبِي يَقُولُ حَدَّثَنَا قَتَادَةُ أَنَّ أَبَا رَافِعٍ حَدَّثَهُ

أَنَّهُ سَمِعَ أَبَا هُرَيْرَةَ ؓ يَقُولُ سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَقُولُ إِنَّ اللَّهَ كَتَبَ كِتَابًا قَبْلَ أَنْ يَخْلُقَ الْخَلْقَ إِنَّ رَحْمَتِي سَبَقَتْ غَضَبِي فَهْوَ مَكْتُوبٌ عِنْدَهُ فَوْقَ الْعَرْشِ  


See similar narrations below:

Collected by Aḥmad
ahmad:7528ʿAlī b. Ḥafṣ > And Rqāʾ > Abū al-Zinād > al-Aʿraj > Abū Hurayrah

[Machine] The Messenger of Allah ﷺ said, "When Allah created the creation, He wrote in a book that is with Him, above the Throne: 'Indeed, My mercy has preceded My anger.'"  

أحمد:٧٥٢٨حَدَّثَنَا عَلِيُّ بْنُ حَفْصٍ أَخْبَرَنَا وَرْقَاءُ عَنْ أَبِي الزِّنَادِ عَنِ الْأَعْرَجِ عَنْ أَبِي هُرَيْرَةَ قَالَ

قَالَ رَسُولُ اللهِ ﷺ لَمَّا خَلَقَ اللهُ الْخَلْقَ كَتَبَ كِتَابًا فَهُوَ عِنْدَهُ فَوْقَ الْعَرْشِ إِنَّ رَحْمَتِي سَبَقَتْ غَضَبِي  

ahmad:8127

Messenger of Allah ﷺ said, "When Allah completed the creation, He wrote in His Book which is with Him on His Throne, "My Mercy overpowers My Anger." (Using translation from Bukhārī 3194)  

أحمد:٨١٢٧

وَقَالَ رَسُولُ اللهِ ﷺ لَمَّا قَضَى اللهُ الْخَلْقَ كَتَبَ كِتَابًا فَهُوَ عِنْدَهُ فَوْقَ الْعَرْشِ إِنَّ رَحْمَتِي غَلَبَتْ غَضَبِي