Measure the width of the door, then measure the width of the wall frame to check that the door fits in the frame.
Pick the location of the door in the wall. If there are studs in the wall frame in this location, remove them by pulling out the nails with the claw of the hammer. There should be no studs in the span across the door frame.
Add 2 inches to the measurement of the width of the door. Use a reciprocating saw to cut this length from the bottom plate in the wall frame to clear the door opening.
Measure the distance between the top plate and the bottom plate. Cut two studs, called the king studs, to this length. Use a circular saw to cut these studs, and all other pieces of lumber from this point.
Nail the king studs into place, one on each side of the cut in the bottom plate, set back away from the cut by 1.5 inches. Use metal connector brackets to connect the studs to the top and bottom plate at 90-degree angles.
Measure the top of the closet door and add 1 inch. Cut two studs to this length. These are the jack studs.
Position each jack stud on either side of the doorway opening so that one side of the stud is flush with the cut in the bottom plate and one side of the stud is pressed against the king stud. Nail each of the jack studs to the king studs.
Measure the distance between the king studs and cut the header to this length. If the wall is not load-bearing, the header will be a standard 2-by-4 piece of wood. If the wall is load-bearing, check the design plans for the appropriate size of lumber to use.
Position the header horizontally over the top of the jack studs so each end is touching a king stud and the bottom is touching the jack studs. Nail the header into place.
Divide the length of the header by 16. Round the number to the nearest whole. This is the number of cripple studs you should cut for the top of the door. Measure the distance between the header and the top plate. Cut the cripple studs to this length.
Nail the cripple studs above the door with a distance of approximately 16 inches between each stud. It is alright if the distance between the cripple studs and the king studs is less than 16 inches.