An article is necessary because "yellow shirt" is a singular, countable noun.
"A" is used before singular nouns that begin with a consonant sound. Since "yellow" starts with a consonant sound, "a yellow shirt" is correct.
"The" is used for specific or previously mentioned things, but in this case, it’s a general mention.