T cells are developed in the thymus gland. They are called Thymocytes.
In order to be properly developed they must undergo two stages called positive selection and negative selection.
Positive selection occurs first in the developing thymocytes. Once the Thymocytes have both CD4 and CD8 expression, they will undergo positive selection. MHC molecules displayed on thymic epithelial cells are used to test if the thymocytes have proper binding functions or not. If they bind to the MHC molecules then those thymocytes are kept for negative selection, but if they do not bind to MHC molecules then they will be destroyed by apoptosis.
In Negative selection, the thymocytes will be tested for self reactivity by determining how much they bind to thymic APCs. AIRE proteins function in transcribing hundreds of specific tissue proteins to be tested on these developing T cells. Thymocytes that are found to be self reactive by binding to thymic APCS, will undergo apoptosis. The ones that do not bind to the thymic APCs will be able to move on to the next stage.