The present invention concerns methods and compositions for treating or preventing a bacterial infection, particularly infection by a Staphylococcus bacteria. The invention provides methods and compositions for stimulating an immune response against the bacteria. In certain embodiments, the methods and compositions involve a secreted virulence factor, which may be EsxA and/or EsxB, and/or peptide processed by sortase, which may be SdrD, SdrE, IsdA, IsdB SdrC, Spa, IsdC, CIfA, CIfB, SasF, or combinations thereof.