Bacterial infections seriously threaten human safety. Therefore, it is very important to develop a method for bacterial detection and treatment with rapid response, high sensitivity, and simple operation. A peptide CF4KYP (C, cysteine; F4, phenylalanine tetrapeptide; K, lysine; YP, phosphorylated tyrosine) functionalized gold nanoparticle (AuNPs-CF4KYP) was synthesized for simultaneous detection and treatment of bacteria based on bacterial alkaline phosphatase (ALP). In solution, ALP can induce AuNPs-CF4KYP aggregation and produce significant color changes. After encountering bacteria, monodisperse AuNPs-CF4KYP can aggregate/assemble in situ on the surface of the bacterial membrane, change the color of the solution from wine red to grey, destroy the bacterial membrane structure, and induce the production of a large number of reactive oxygen species within the bacteria. The absorption change of AuNPs-CF4KYP solution has a good linear relationship with the number of bacteria. Furthermore, the aggregation of AuNPs-CF4KYP kills approximately 80% of Salmonella typhimurium. By combining enzyme-instructed peptide self-assembly technology and colorimetric analysis technology, we achieve rapid and sensitive colorimetric detection and killing of bacteria.