Since most chords are formed from notes of the major scale of the key, you need to know the notes of all 12 major scales from memory in order to be able to create any chord in any key. The following chart shows all existing major scales up to the 13th for reference in constructing chords.
Try memorizing one scale per week until you know them all. You should also make a habit of choosing any starting note and building all chord types up to the 13th on that note.