Yan Shigu (Chinese: 顏師古; pinyin: Yán Shīgǔ; Wade–Giles: Yen Shih-ku) (581–645), formal name Yan Zhou (顏籀), but went by the courtesy name of Shigu, was a famous Chinese historian, linguist, politician, and writer of the Tang Dynasty.
Yan was born in Wannian (萬年, in modern Xi'an, Shaanxi). His ancestors were originally from Langye (琅邪, in modern Linyi, Shandong). Yan's grandfather Yan Zhitui was an official under the Northern Qi. After the fall of Northern Qi, Zhitui became an official of the Northern Zhou, and moved his family to Guanzhong. His son Yan Silu (顏思鲁), Yan's father, was also an official, and served in the residence of Li Shimin.
Yan was well-read during his youth and was familiar with philology. Recommended by Li Gang (李綱), he was given a post at Anyang county (now Xiangyang, Hubei) during the reign of Emperor Wen of Sui. One of his father's old friends, Xue Daoheng (薛道衡), was impressed by Yan's talent, and often asked for his comments on his new works. For some reason, Yan Shigu was later dismissed, and took up residence at Chang'an. During the next ten years he lived in poverty and taught for a living. He was later granted several important official posts during the Tang dynasty. Yan was promoted when Li Shimin ascended the throne, but resumed his duty after his mother's funeral.
After years of struggle, Yan was then demoted, but was subsequently ordered to revise the Five Classics in the library. He wrote commentaries on several Chinese classic texts such as the Shiji and Hanshu. According to New Book of Tang, he died on the road during an expedition to Goguryeo in 645.