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:16:68

And your Lord inspired to the bee, "Take for yourself among the mountains, houses, and among the trees and ˹in˺ that which they construct.  

And your Lord revealed to the bee, a revealing ˹effected˺ through inspiration, ˹saying˺ (an, ‘that’, is either explicative or relates to the verbal noun): ‘Choose among the hills habitations, to which you can resort, and among the trees, ˹also˺ habitations, and among the trellises which they raise, that is, the places which humans build for you — for otherwise it ˹the bee˺ would not resort to these ˹places˺.
القرآن:١٦:٦٨

وَأَوْحَىٰ رَبُّكَ إِلَى النَّحْلِ أَنِ اتَّخِذِي مِنَ الْجِبَالِ بُيُوتًا وَمِنَ الشَّجَرِ وَمِمَّا يَعْرِشُونَ  

{وأوحى ربك إلى النحل} وحي إلهام {أن} مفسرة أو مصدرية {اتخذي من الجبال بيوتاً} تأوين إليها {ومن الشجر} بيوتًا {ومما يعرشون} أي الناس يبنون لك من الأماكن وإلا لم تأو إليها.