The Prophet ﷺ said, "Allah has appointed an angel over the womb, and it says, 'My Lord, a drop of fluid. My Lord, a clot. My Lord, a lump of flesh.' Then, when Allah
wills to complete its creation, the angel asks, 'My Lord, male or female? Wretched or blessed? What is its provision? What is its lifespan?' And so it is written while the child is still in its mother's womb."
حدثنا يحيى بن سعيد حدثنا حماد بن زيد حدثنا عبيد الله بن أبي بكر بن أنس عن أنس عن النبي ﷺ نحوه