Follow the below three steps to build a chord:
Define the notes of a major scale of a given note. For example, D major: D, E, F♯, G, A, B, C♯.
Find a formula for the chord. For example, 1, ♭3, 5, ♭7 for a minor 7th chord.
Apply the formula – take the scale degrees defined by the numbers and apply accidentals if needed. For example, for D minor 7th chord notes would be D, F, A, C because the 1st degree of D major is D, the flattened 3rd degree is F, the 5th degree is A, and the flattened seventh degree is C.
Read more