Then David gave to Solomon his son the pattern of the porch [of the temple], and of the houses of it, and of the treasuries of it, and of the upper rooms of it, and of the inner chambers of it, and of the place of the mercy seat;
David himself did not invent this pattern, but God gave it to him, having first given it to Moses; and David learned all about it from  Exodus 25:10,17-22; 31:7; 40:20; and in  Numbers 7:89.  The statement in the next verse that David had this pattern "by the Spirit" is a reference to the fact that God's Spirit revealed all of these things to Moses.