IN THE BEGINNING GOD CREATED: This text is related (to Prov. 8:30): AND I WAS WITH HIM AS A CONFIDANT. What is the meaning of CONFIDANT 'MWN? R. Judah bar Il'a'y said: That he was an expert 'WMN in the Torah. The Holy One would scrutinize the Torah as he was creating the world. Ergo: AND I WAS WITH HIM AS A CONFIDANT. What is written (in Gen. 1:1)? IN THE BEGINNING GOD CREATED. There is no BEGINNING but Torah, as stated (in Prov. 8:22): THE LORD ACQUIRED ME AS THE BEGINNING OF HIS WAY. Ergo: IN THE BEGINNING (i.e., in Torah) GOD CREATED.
The Torah as God's Blueprint for Creating the World
Midrash Tanchuma Buber, Bereshit 5:1