Here are the basic requirements:
The agreement must be in writing, appropriately signed by both parties.
The parties must enter the agreement voluntarily. For example, the agreement should be signed well before the wedding to avoid the appearance of a coerced last-minute signing (leveraged by the possible embarrassment of a cancelled ceremony).
The agreement cannot be “unconscionable” (lawyer lingo for really, really unfair).
The parties must make full disclosure of their assets, debts, and income.
The parties should be represented and advised by separate lawyers.
The parties should then follow the terms of their agreement during their marriage. For example, if the agreement says they’ll deposit their income in separate accounts, describes bill-paying methods, and investment or saving approaches, the parties should follow their agreement.