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:18:91

Thus. And We had encompassed ˹all˺ that he had in knowledge.  

So ˹it was˺, in other words, the situation was as We have stated; and We encompassed whatever pertained to him, that is, what Dhū’l-Qarnayn possessed in the way of machinery, men and otherwise, in knowledge.
القرآن:١٨:٩١

كَذَٰلِكَ وَقَدْ أَحَطْنَا بِمَا لَدَيْهِ خُبْرًا  

{كذلك} أي الأمر كما قلنا {وقد أحطنا بما لديه} أي عند ذي القرنين من الآلات والجند وغيرهما {خبرا} علما.