Gongsun Nizi 公孫尼子 "Master Gongsun Ni" was a Confucian treatise written during the Warring States period 戰國 (5th cent.-221 BCE) by the philosopher Gongsun Ni 公孫尼. The imperial bibliography Yiwenzhi 藝文志 in the official dynastic history Hanshu 漢書 says that the book was 28-chapters long, and remarks that Gongsun Ni was one of the seventy disciples of Confucius. In later bibliographies the book is listed with a length of 1 juan.
Gongsun Ni lived earlier than Mengzi 孟子 (385-304 or 372-289 BCE), but later than Li Ke 李克 (Li Kui 李悝, 455-395 BCE). His concept of the human character was similar to that of the philosophers Mizi 宓子 and Qidiaozi 漆雕子 and more flexible than that of Mengzi who said that man was good by nature.
The scholar Shen Yue 沈約 (441–513) from the Southern Dynasties period 南朝 (420~589) found out that the treatise on music Yueji 樂記, which is part of the ritual classic Liji 禮記, quotes from the Gongsun Nizi, yet the words in the received version of the Yueji are not identical with those that the Qing-period 清 (1644-1911) scholar Ma Guohan 馬國翰 (1794-1857) discovered. Ma also found fragments of the Gongsun Nizi in the books Chunqiu fanlu 春秋繁露 and Lunheng 論衡 and the encylopaedias Beitang chuchao 北堂書鈔, Chuxueji 初學記 and Taiping yulan 太平御覽.