I'd recommend writing your own contract/agreement if you can. Keep it short and simple, what you'll do, how much you'll get paid, when you'll get paid. Also, that you own the code.
I'd recommend being up front about possible reselling. Your customer may gripe about it, but better to talk it out now than make an enemy out of your first customer later. Surprises are bad.
Another option is to find a standard agreement. The other guy mentioned one, there is a book from Nolo Press,
In Germany I have heard writing one's one contract can have disadvantages: if you happen to include anything that later turns out to be "illegal", it will be interpreted against the person who wrote the contract. "illegal" not meaning something you would be punished for, but there are some things you can not write in a contract (for example "the client agrees to work as a slave for the other party for the rest of his life" - a contract has to be "appropriate").
IANAL, though - not sure how much it really matters, it is just something I have heard.
It might be good to have a checklist for things to watch out for.
I usually try to change the parts about who owns the right to the code. I don't mind the client to be allowed to do whatever he wants with the code, but I don't want to be prevented from using my code. It is hard to describe exactly, but I try to be explicitly allowed to keep using standard practices of coding. Otherwise, a client could put my out of business for good after the first project (I guess that is paranoid, but I just want to get that right), because he owns the rights of my "for loop pattern".
Another thing is accountability. German law knows several degrees of accountability, something like "neglect" and "accidents" (not sure how to translate it). It is possible to make the contract tighter than the standard law, so that you are only accountable for neglect, but not accidents. (roughly something like that...). Also maybe one could write in the contract something along the lines of the client being responsible for testing the software?
I'd recommend being up front about possible reselling. Your customer may gripe about it, but better to talk it out now than make an enemy out of your first customer later. Surprises are bad.
Another option is to find a standard agreement. The other guy mentioned one, there is a book from Nolo Press,
http://www.nolo.com/product.cfm/objectID/2C02C865-21E7-497C-...
and there are surely others on the web.
Be careful about Work For Hire. I believe a Work For Hire agreement transfers ownership of your code to the purchaser. Not what you want in this case.