When should I use a hyphen between three words?

Trigrams are sets of three words that are hyphenated.
When you use three words together as a single thought describing or modifying a noun and you put them before the noun, you should hyphenate them:
- It was a matter-of-fact decision.
There are certain trigrams that are always hyphenated, like commander-in-chief.