It is difficult to write a constitution in a vacuum.
The adopted text should already have meaning, drawn from underlying values the society accepts. If it pulls from shared philosophy, it will be strengthened in that it coheres but also because those within the society will naturally accept and respect its principles.
When the first working draft of the U.S. Constitution was written by the Constitutional Convention's Committee of Detail mid-way through the Summer of 1787, the drafters pulled from three plans proposed by various members of the Convention, including the Virginia Plan, the Patterson Plan, and the Pinckney Plan. Yet they also pulled from external documents such as the Articles of Confederation and state constitutions. "We the people" was directly copied from the 1780 Massachusetts Constitution, authored by John Adams.
Yet the library which informed the 55 delegates to the Convention of 1787 was much broader. In 1731, Benjamin Franklin, with 50 subscribers, began the Library Company of Philadelphia. This was an outgrowth of the attempt to pool books within his Junto on the premise that access to information would expand exponentially by pooling resources. And so the first "public," or subscription library, in North America was founded.
In his autobiography, Franklin claimed that this library was the "mother" of all the North American libraries which began to proliferate in North America after 1731, LCP providing a model in form and in substance--its collection was the biggest, but the Enlightenment titles on its shelves were found, to one extent or another, in new libraries throughout the colonies.
The proliferation of information occasioned by these Enlightenment libraries, Franklin wrote as early as 1759, "have improved the general conversation of the Americans, made the common tradesman and farmers as intelligent as most gentlemen from other countries, and perhaps have contributed in some degree to the stand so generally made throughout the colonies in defense of their privileges."
This common library produced a common philosophy on which to build a society. It helped the Constitution adhere to itself, and the people adhere to the Constitution.
How can this be replicated in other countries? The answer, simply, is to find common beliefs, value systems, and libraries. For the Middle East and North Africa region, this could be the Classical authors which Islam preserved, and the Islamic Philosophers of the sixth century. Perhaps, if the Enlightenment is viewed as an extension of the Classics, it, too could be considered as providing essential ingredients with which to rebuild.
Whatever library and philosophy is landed upon, it must be pervasive enough to allow the written constitution to stand up under its own weight and be embraced by a people who recognize their own values within its strictures.