Who wrote the constitution?
In part, James Madison and the Virginia delegates wrote the Virginia Plan while in Philadelphia waiting for the other delegates to the Constitutional Convention of 1787 to arrive. The Plan became the starting point in the debate regarding how to create a new, more adequate structure of government than the Articles of Confederation.
William Paterson created the New Jersey Plan largely as a rebuttal to the Virginia Plan. The New Jersey Plan maintained a governmental structure that was closer to the government under the Articles of Confederation, strengthening the central government significantly but giving every state equal representation in the national congress.
Roger Sherman wrote the Connecticut Compromise, which combined the two plans by creating a bicameral legislature with different representations in the two houses. James Wilson suggested the Three/Fifths Compromise which addressed the question of how to count slaves when figuring the populations of the states.
There were other plans fron such as Hamilton and Pinckney. Input from all sources was debated and discussed through the summer of 1787. During the early fall,
the Committee of Style and Arrangement, headed by Gouverneur Morris, and including Hamilton, William Samuel Johnson, Rufus King, and Madison, produced the final version, which was submitted for signing on September 17. Morris is credited, both now and then, as the chief draftsman of the final document, including the stirring preamble. (Wikipedia.com, eNotes.com)