Guard rails on stairs need to be 36 inches (minimum) above the stair nosing and cut to the same angle of the stair’s rise and run.
For quick height and angle layout, run two 2-bys along the stair nosings, then run a framing square on top. It’ll give you the proper height and angle in one move.