(1) بَاب كَيْفِيَّةِ خَلْقِ الْآدَمِيِّ فِي بَطْنِ أُمِّهِ وَكِتَابَةِ رِزْقِهِ وَأَجَلِهِ وَعَمَلِهِ وَشَقَاوَتِهِ وَسَعَادَتِهِ
Hadhaifa b. Usaid Ghifari, a Companion of Allah's Messenger (ﷺ), reported it directly from Allah's Messenger (may peace upon him). as he said:
There is an angel who looks after the womb when Allah decides to create any- thing after more than forty nights are over; the rest of the hadith is the same.
Reference: Sahih Muslim 2645 d
In-book reference: Book 46, Hadith 7
USC-MSA web (English) reference(deprecated numbering scheme): Book 33, Hadith 6396