Chronic stimulation can cause T cell dysfunction and limit efficacy of cellular immunotherapies. CRISPR screens have nominated gene targets for engineered T cells, but improved methods are required to compare large numbers of synthetic knockin sequences to reprogram cell functions. Here, we developed Modular Pooled Knockin Screening (ModPoKI), an adaptable platform for modular construction of DNA knockin libraries using barcoded multicistronic adaptors. We built two ModPoKI libraries of 100 transcription factors (TFs) and 129 natural and synthetic surface receptors. Over 20 ModPoKI screens across human TCR and CAR T cells in diverse conditions identified a transcription factor AP4 (TFAP4) construct to enhance long-term T cell fitness and anti-cancer function in vitro and in vivo. ModPoKI's modularity allowed us to generate a ~10,000-member library of TF combinations. Non-viral knockin of a combined BATF-TFAP4 polycistronic construct further enhanced function in vivo. ModPoKI facilitates discovery of complex gene constructs to program cellular functions.