Why did officials in ancient times have to be able to write poetry?

Because the ancient official selection system has been the imperial examination system since the Sui Dynasty. The imperial examination system must test cultural knowledge. Candidates need to have a deep literary foundation. In this way, being able to write poetry is a demonstration of knowledge, and it is also A kind of foundation. The nine-rank Zhongzheng system before the Sui Dynasty mainly selected the children of aristocratic families as officials. The aristocratic families attached great importance to their children's reading and would definitely train their children to learn poetry.

In other words, in ancient times, officials must be able to write poetry because of the standards of the official selection system