Adapted from a comment I posted in response to a query at Hacker News:
• In your statements of work, be as explicit and detailed as you possibly can in stating assumptions — especially assumptions about what the customer is supposed to provide and/or do. Drill down to a suitable depth, even if it seems silly. If you’re assuming the customer will have 110 volt AC power, consider saying so.
• Keep the customer informed — no one likes surprises.
• Make a habit of sending short, just-the-facts-ma’am email summaries confirming oral discussions — they can be incredibly useful in the event of later finger-pointing and “why didn’t you tell me X?” accusations. (Don’t be self-serving, though, because that’ll just make future readers think you were trying to hide something.)
• In the same vein, seriously consider never deleting any email to or from a customer or otherwise relating to a job. You might need it someday to prove what happened when. And if you delete an unfavorable email, Murphy’s Law says that someone else will have it, whereupon the other side will accuse you of trying to do a cover-up.
• Consider treating development of the specification as a separate, separately-priced deliverable.
• Consider providing an “extension of time budget” in the contract — that is, give yourself X days of extension budget that you can allocate to individual deadlines as you see fit, with a max extension of Y days for any single deadline.
• Watch out for IP-ownership provisions; try to make sure you get at least the right to continue using general knowledge, tools, non-customer-specific code, etc., for other projects.
• Be extremely careful using FOSS (free / open-source) software — the customer will be really PO’d if it has to release the source code to its product. Microsoft had to do that a couple of years ago because one of its consultants included GPL code; see this blog posting by Silicon Valley lawyer Mark Radcliffe for details.
• In the contract, try very hard to (1) exclude consequential damages, and (2) limit your liability to X or 2X or even 3X, where X is the amount you’re paid. If the customer balks, you can respond that you’re selling services, not business insurance, and that uncapped liability will have to carry a higher price.
• Investigate whether you can get professional-liability insurance (errors & omissions or “E&O”). If so, try to have a separate cap for your contract liability in the amount of your coverage — that is, your liability won’t exceed 2X, where X is the amount you were paid, or your policy limits, whichever is less.
[For more suggestions, see the e-book, Signing a Business Contract? A Quick Checklist for Greater Peace of Mind, shown in the right-hand column.]