Position a step ladder under the attic stairs so that you can easily access the ceiling area.
Stretch a tape measure along one of the long sides of the stair opening and write down the measurement. Measure the opposite side as well, even though it should be the same as the first side.
Measure the front edge of the stairs from left to right using the tape measure, and write down the measurement. Repeat to measure the rear-hinge side of the opening; it should match the front-edge measurement.
Lay long pieces of 5/8-inch or 2 1/4-inch case molding or clam shell molding on a work table. Transfer each measurement onto the molding using the tape measure and a pencil.
Place the molding into a miter box, and align one of the pencil marks with the 45-degree mark on the box. Insert a handsaw through the top of the box in the same angled slot, and cut straight down to create an angled cut on the molding. Repeat the process on each remaining piece of molding so that you have four individual pieces, all with angled ends.
Climb back up the step ladder and place the left molding piece up to the side of the attic opening, 1/8 inch away from the door. Insert 4d finishing nails every 6 inches using a hammer to hold it in place. Install the right molding piece in the same manner.
Place the front molding piece up to the ceiling and position it 1/8 inch from the door. Slide the angled corners so they slip perfectly against the angled corners of the side pieces. Nail the molding in place with finishing nails.
Install the rear-hinge section of molding in the same manner, but increase the spacing to 3/8 inch from the opening to allow the hinges to move freely.
Place a nail set tool on top of each nail head, and tap it firmly to sink the heads. Apply wood putty on top of each depression and wait until it dries. Sand the wood putty smooth using 200-grit sandpaper.
Prime the trim with a latex primer and paintbrush. Wait until the primer dries, and apply a coat of latex paint using a clean paintbrush.