him. Wang Ji was later promoted to the position of Administrator () of Anfeng Commandery (安豐郡; around present-day Lu'an, Anhui). During his tenure, Wang Ji governed his jurisdiction strictly but fairly. He also performed some acts of kindness from time to time to win popular support from the masses. As Anfeng Commandery was located near the border between Wei and its rival state Eastern Wu, Wang Ji also set up and strengthened its defences to deter the enemy. He was subsequently given an additional appointment as General Who Attacks Rebels (). Sometime between 245 and 252, there were reports of Eastern Wu forces mobilising and gathering at the Wu imperial capital, Jianye (present-day Nanjing, Jiangsu). The Wu forces also publicly revealed that they were preparing to attack Wei territories in Yang Province. Zhuge Dan, the Wei governor of Yang Province, sought Wang Ji's opinion on how to counter a Wu invasion. Wang Ji replied: As Wang Ji analysed correctly, Sun Quan did not launch any attack on Wei during this time. When Cao Shuang was regent of Wei from 239 to 249, he monopolised power and practised cronyism, which resulted in political corruption and cultural decadence. Wang Ji wrote a text, "Shi Yao Lun" (時要論; "Essay on the Needs of the Time"), to express his views on contemporary politics. He then resigned from his post as the Administrator of Anfeng Commandery, using poor health as an excuse. He was soon recalled by the Wei government to serve as the Intendant of Henan (). However, before he assumed office, Cao Shuang was ousted from power in a coup d'état by his co-regent, Sima Yi, and executed along with the rest of his family and associates. As Wang Ji used to be a subordinate of Cao Shuang, he was implicated in the purge and removed from office. As the Inspector of Jing Province Within the same year (249) after his removal from office, Wang Ji was summoned back to serve as a Master of Writing () in the imperial secretariat. In the following year, he was promoted to Inspector () of Jing Province and appointed as General Who Spreads Vehemence (). Shortly after he assumed office, the Wei government ordered him to join the Wei general Wang Chang on a campaign against Eastern Wu. During the battle, Wang Ji led an army to attack Wu forces led by Bu Xie at Yiling