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:43:56

And We made them a precedent and an example for the later peoples.  

And We made them a thing past (salaf, is the plural of sālif, similar ˹in pattern˺ to khādim, khadam) that is to say, a precedent, as a lesson, and an example for others, after them, that they ˹posterity˺ might take their predicament as a lesson and so not engage in actions similar to theirs.
القرآن:٤٣:٥٦

فَجَعَلْنَاهُمْ سَلَفًا وَمَثَلًا لِلْآخِرِينَ  

{فجعلناهم سلفاً} جمع سالف كخادم وخدم أي سابقين غيره {ومثلا للآخرين} بعدهم يتمثلون بحالهم فلا يقدمون على مثل أفعالهم.