Diatonic chords - let's take C Major because it's easy.
So take each note of the scale (CDEFGAB) and then stack generic thirds on top of each, you now have 7 triads - C Major, D minor, E minor, F major, G major, A minor, B diminished.
These are the diatonic triads of the C Major scale. It's interesting to note that every Major scale will result in: Major, minor, minor, Major, Major, minor, diminished. A similar thing happens with minor scales.
Of these diatonic triads, take note of especially the 5th (the dominant) and the 4th (the subdominant) they are special in every scale.
Circle chord progressions will help you a lot w/ writing music, let's do C Major with perfect 4ths (try it):
C Major, F Major, B diminished (BDF), E minor, A minor, D minor, G Major, C Major.
Links:
https://www.piano-play-it.com/piano-chords.htmlhttps://www.musictheory.net/lessons