Determine the dimensions for your door and order a prehung door from a manufacturer.
Take a tape measure and make marks with a pencil on the sole plate the width of the opening plus 1 inches. Make marks 1 1/2 inch and 3 inches outside of the width marks for the king stud and jack stud placement. Choose a 2-by-4 to use as a king stud and hold it against the angle of one of the rafters. Make a mark on the stud for the angle. Repeat for another 2-by-4.
Take one of the 2-by-4 king studs and have a helper hold it on one of the sole plate marks as you plumb it with spirit level. Measure from the sole plate to where the stud meets the rafter. Cut the stud to length and on the angle mark you made with a circular saw. Repeat at the other mark for the second king stud.
Take a hammer and nail the king studs in place with two nails on both sides at the edges of the sole plate and at the rafters. Check for plumb.
Measure from the floor and make marks on the king studs and any intermediate studs in the wall framing at the height of the door plus 2 1/2 inches. Cut the intermediate studs at this height with a reciprocating saw. Leave the tops of the intermediate studs as cripples, or shortened studs. Cut out the sole plate between the jack studs and remove.
Measure from the to the marks 1 1/2 inch from the opening to the marks for the door height and cut two 2-by-4s to this length. Nail these two jack studs to the insides of the king studs. Face nail, or nail straight on rather than at an angle, them at the top and bottom of the king studs. Check for plumb.
Cut a two pieces of dimensional lumber to length for the header after discovering the code requirements. Two 2-by-8-inch boards will suffice in most cases for doors up to 5 feet wide. Measure between the king studs above the jack studs and cut to this length. Cut a 1/2 piece of plywood to fit and place it between the boards. Glue the plywood to the boards with wood glue. Nail the board together at each end. Check for level.
Place the header on top of the jack studs and and nail to both the jack studs and king studs. Nail the cripple studs to the header and the header to the studs.
Measure the distance between the jack studs at the bottom of the opening. Obtain an adjustable threshold, which lets you change the height of the threshold as needed, to fit. Place two beads of caulk on the subfloor between the jack studs.
Bring the prehung door to the site when the exterior of the A-frame structure is complete. Have a helper assist you as you center the door over the opening. Use shims at the lockset and hinge locations to achieve plumb. Check for plumb. Hammer nails partway through the hinge holes to steady it temporarily.
Adjust shims as needed and place loosely packed fiberglass insulation in the gaps between the jams and studs. Check for plumb. Open and close the door to check the fit.
Hammer 10d casing nails into the door jambs at each shim. Remove any retaining brackets that came with the door. Open and close the door once again to check its operation.
Remove the temporary nails you put in and screw the hinges to the jamb. Drive 10d casing nails into the casing at the sides and top of the door frame.
Adjust the threshold as necessary to eliminate any gap under the door. Thresholds often adjust via screws along their length.
Cut off the shims, ensuring that you leave them flush with the framing.
Apply a layer of caulk around the casing.