Place your tape measure against the top of the cabinet opening and measure all the way down to the bottom of the opening. Jot down the number to the nearest 1/8 inch on your paper.
Repeat step one, but measure from side to side instead of top to bottom.
Hook the tape measure onto the outer edge of the cabinet opening -- the edge that will hold the hinges -- and make sure that there is at least 5/8 inch of clearance in the direction the door will open.
Add 1 inch to both the height and width measurements. This allows the cabinets an extra 1/2 inch of overlap on all sides.