Tumor immune microenvironment (TIME) plays an important role in metastasis and immunotherapy. However, it has been not much known how to classify TIMEs and how TIMEs are genetically regulated. Here we showed that tumors were classified into TIME-rich, -intermediate and -poor subtypes which had significant differences in clinical outcomes, abundances of tumor-infiltrating lymphocytes (TILs), degree of key immune programs activation, and immunotherapy response across 13 common cancer types (n= 6,000). Furthermore, TIME-intermediate, -poor patients had significantly more inherited genetic defects (i.e., functional germline variants) in natural killer (NK) cells, antigen processing and presentation (APP) and Wnt signaling pathways than TIME-rich patients, and so did cancer patients than non-cancer individuals (n=4500). These results suggested that individuals who had more inherited defects in NK cells, APP and Wnt pathways had higher risk of developing cancers. Moreover, in the 13 common cancers the number of inheritable defected genes of NK cells was significantly negative-correlated with patient survival, TILs abundance in TIMEs and immunotherapy response, suggesting that inherited defects in NK cells alone were sufficient to shape TILs recruitment, clinical outcome and immunotherapy response, highlighting that NK cell activation was required in the 13 cancer types to drive the recruitment of immune troops into TIMEs. Thus, we proposed that cancer was a disease of NK cell inherited deficiencies. These results had implications in identifying of high-risk individuals based on germline genomes, implementing precision cancer prevention by adoptive transfer of healthy NK cells, and improving existing immunotherapies by combining of adoptive NK cell transfer (i.e., converting TIME-intermediate, poor tumors into TIME-rich tumors) and anti-PD-1 or CAR-T therapy.