Most ganglion cysts can be diagnosed just by vision and palpating it. If they are on extensor tendons, they might bulge more when the joint is moved and disappear when it is flexed.
A majority of ganglion cysts disappear without treatment. If it is painful, the doctor might aspirate it with a needle. About 1/4 of patients will have a recurrence after removal and aspiration can be tried again. Surgical removal is needed only if it is painful or causes numbness in the hand or fingers.
There is no way to prevent a ganglion cyst from occurring. In the old days a patient would undergo "bible treatment". Grandma would whack it with a heavy bible. We don't recommend that any longer.