(1) بَاب كَيْفِيَّةِ خَلْقِ الْآدَمِيِّ فِي بَطْنِ أُمِّهِ وَكِتَابَةِ رِزْقِهِ وَأَجَلِهِ وَعَمَلِهِ وَشَقَاوَتِهِ وَسَعَادَتِهِ
Hudhaifa b. Usaid reported directly from Allah's Messenger (ﷺ) that he said:
When the drop of (semen) remains in the womb for forty or fifty (days) or forty nights, the angel comes and says: My Lord, will he be good or evil? And both these things would be written. Then the angel says: My Lord, would he be male or female? And both these things are written. And his deeds and actions, his death, his livelihood; these are also recorded. Then his document of destiny is rolled and there is no addition to nor subtraction from it. (ES)
Reference (ES): Sahih Muslim 2644 (ES)
In-book reference (ES): Book 46, Hadith 3 (ES)
USC-MSA web (English) reference(deprecated numbering scheme): Book 33, Hadith 6392 (ES)