Consider whether or not you have a case for a counter claim. Most judges don't take kindly to frivolous counter claims. A frivolous counter claim could even have an effect on the claim brought against you.
Assemble all of your evidence. Nothing hurts your case more than going into court without all of your documentation. Make sure you have invoices, phone records and anything else you need to prove you are in the right.
Communicate with the party suing you. Many times lawsuits arise because of a breakdown in communication. You may be able to save everyone time and trouble if you can settle your dispute out of court.
Research cases that are similar to yours. The legal system works on the principle of precedent. If you can show a judge several instances in which other judges and juries have found in your favor under similar circumstances, you could have a leg up on the person who has filed suit against you.
Submit your documents to the proper judicial body. You may need to have them notarized or prepare them in some other way.