Before or immediately after moving in, the tenant should walk through the unit with the landlord to make a list and take pictures of all existing damage and necessary cleaning. Both parties should sign two copies of the list and each should get a copy of the signed list to keep in their records.
The tenant should follow the same procedure when moving out. Even if one party refuses to take this walk through with the other, each party alone should carefully document the condition of the unit by making lists and taking pictures. Preferably a disinterested witness can also look at the condition of the unit.