Remove the baseboards from the walls and measure the distance between the two side walls. Cut two two-by-fours this same length, one piece for the top of the frame and one for the bottom. Draw a line across the floor 30 inches out from the back wall. Line up a cut two-by-four, making the inside edge flush with the line.
Mark on the bottom plate where to put the studs and where to align the dividing wall plate. Attach that between the back wall and the bottom plate. You should measure it to fit the 30 inches from the back wall to the inside edge of the bottom plate.
Use a level and a straight piece of wood to locate the correct placement for the top plate of your frame. Lay the wood against a side wall with the bottom of it against the inside of the attached bottom plate. Make sure it's straight and mark the position on the ceiling. From here, draw a straight line to the other side wall and attach the top plate with the back edge flush with your line.
Attach the top plate to joists in the ceiling and anchor the ends with drywall screws. Insert the screws at an angle to ensure stability. Place the studs at the marks on the bottom plate and secure them to the top and bottom plates. Ensure that the studs are straight.
Add trimmers to the sides of your closet frame. These are slightly shorter than the stud and you attach them to studs on each side of the closet frame as well as to each stud at the dividing wall plate.
Finish the closet frame by adding the headers. These are boxed units, a top, bottom and two side pieces each, that you fit on top of the trimmers and between the studs. Add cripplers, or vertical support pieces, between the top and bottom pieces of the headers.