A temporary compound used as an adjective before a noun, a compound adjective that precedes a term it modifies, and two or more modifiers with a common base are a few main rules for hyphenating compound words. The rules do not concern commonly used compound words, such as light year.
A handful of compounds consisting of prefixes or suffixes are generally not hyphenated, such as antisocial, midtown and wavelike. However, a hyphen is necessary when the compound contains a year, a capitalized suffix or more than one word, or if it is potentially difficult to read without a hyphen, such as pro-life.
For the most part, compounds with a repeated vowel should be hyphenated. Reestablish and reedit are exceptions, but spelling differs between dictionaries and writers.