Xunzi was a Confucian philosopher who argued human beings were bad by nature. He advocated self-cultivation to correct our natural shortcomings.
Like Confucius and Mencius before him, it is said that the Confucian philosopher Xun Kuang, or Xunzi (c. 310 – 235 BCE), was an itinerant advisor to kings and rulers.
Not much is known about his early life. But there are indications that in his later years as a political advisor, he had more success than both Mencius and Confucius. He was appointed to several high positions, before eventually retiring from public life and living out the remainder of his years far from the intrigues of politics.
A book to encourage virtue
What we know about Xunzi's thinking comes from a book that is usually referred to as 'the Xunzi', a book that now consists of thirty-two chapters. The Xunzi was compiled in the first century BCE by the librarian Liu Xiang, long after the death of Xun Kuang.
The book covers a huge range of topics: everything from ritual to Confucius, to self-cultivation, to a series of catchy and rather high-minded songs referred to as 'working songs' — songs that, apparently, were designed to be memorable enough to sing whilst working, to help encourage their singers to virtue.
As a collection of texts, the Xunzi is incredibly rich. These texts may not all have been written by Xunzi, and some parts may be written by later thinkers. But taken as a whole, the Xunzi does present a coherent set of concerns. And it is particularly famous for its exploration of human nature.
Xunzi is often contrasted with Mencius. But for all their differences, these two Confucian philosophers share a good deal: they are both concerned with human nature; they are both worried about how to establish a stable, functional society; and they are both preoccupied with things like justice or yi, fellow-feeling or ren, and ritual or li.
However, in thinking-through how to attain the end of a stable society, Xunzi came to very different conclusions from the more sunny-natured Mencius. Mencius built his philosophy on claims about the goodness of human nature. In contrast to this, Xunzi argues that 'The nature of human beings is bad; goodness is artificial.' Or, as Nick Cave once put it: 'People ain't no good.'
Taming our badness
Xunzi's objection to Mencius is relatively simple. He says that Mencius's claims about the goodness of human nature simply don't correspond with our experience of the world.
Mencius says: people’s nature is good. Nothing conforms to his distinctions, and this does not match the test of experience. He sits and propounds it, but when he stands up then he cannot implement it, and when he unfolds it then he cannot put it into practice. Is his error not great indeed!
Thus, if human nature is good, then one may do away with the sage kings and put ritual and yi [justice] to rest. If human nature is bad, then one simply must side with the sage kings and honor ritual and justice. 
Xunzi thinks it is reckless of Mencius to emphasise the goodness of human nature because in doing so, we risk underestimating the strength of our own selfish desires.
If we start from the idea that human nature is bad, on the other hand, we're not going to fall into this trap. We're going to set about urgently trying to cultivate goodness, rather than complacently thinking we are already good.
To say that human nature is bad is not a counsel of despair. Instead, it is a call to action. Human nature may be bad, but it can be refashioned.
Here, Xunzi takes his metaphors from the works of craftspeople and uses images of crooked trees that will already be familiar if you have read about Zhuangzi. For the Daoist philosopher Zhuangzi, crookedness was something to be embraced, on the principle that the crooked trees are the ones that are not cut down.
For Xunzi, on the other hand, crookedness is a challenge. However crooked we are, for Xunzi, with sufficient art and skill, we can be straightened out.
Thus, the press frame originated because of crooked wood. The ink-line arose because of things that are not straight. Lords and superiors were established and ritual and justice were made clear because of the fact that human nature is bad.
Looking at it in this way, it is clear that people’s nature is bad, and that their goodness is a matter of deliberate effort. Straight wood does not await the press frame in order to become straight, because its nature is to be straight. Crooked wood must await the press frame and steaming and bending and only then will it be straight, because it is by nature not straight. 
If you know your 18th-century philosophy, this may bring to mind the philosopher Immanuel Kant, who once wrote that 'nothing entirely straight can be fashioned from the crooked wood of which humankind is made.'
For both Kant and Xunzi, there's something about human beings that is fundamentally out of shape, that doesn't sit comfortably. But although they use the same metaphors, Xunzi is arguably more optimistic, because he claims that ultimately our crooked timber can in fact be made straight. We can make something good and true out of this crooked wood: and the tools by means of which we do this are ritual and justice.
The beauty of goodness
The challenge, then, is how to reshape ourselves. In saying that human nature is bad and that goodness is artificial, Xunzi isn't giving up on goodness. Instead, he is saying that goodness is an artefact created through human effort; and this artificiality is what makes it worthwhile.
Sometimes Xunzi is criticised for being harsh. And he is certainly a more austere philosopher than Mencius. But it would be unfair to present him as simply as a philosopher who just wants to give us a hard time or to make us feel bad about ourselves. Instead, in arguing that we are bad by nature, he wants to push us towards living better, more beautiful lives.
Xunzi argues that it is only when we recognise we lack something that we can desire to have the thing we lack. If we are ugly, we desire to be beautiful. If we are poor, we desire to be rich. If our experience is narrow, we desire it to be broader. So it is precisely in recognising our badness that we can see the desirability of goodness.
This leads Xunzi to the seeming paradox: 'people desire to become good because their nature is bad.' This is an interesting psychological insight. We might assume that people behave badly because they like behaving badly. But perhaps for most of us, when we behave badly, we want to be better—we just don't know how.
Refashioning our timber
This means there's something optimistic about Xunzi. With enough artifice, he tells us, even our crooked selves can be made good.
So what kind of artifice do we need? For Xunzi, one of the most important kinds of artifice is education. Chapter one of the Xunzi is called An Exhortation to Learning begins like this:
Learning must never stop. Blue dye derives from the indigo plant, and yet it is bluer than the plant. Ice comes from water, and yet it is colder than water. Through steaming and bending, you can make wood as straight as an ink-line into a wheel... The noble person learns broadly and examines themeslves thrice daily, and then their knowledge is clear and their conduct without fault. 
This is not just an individual pursuit of learning, but a social one. Like Confucius before him, Xunzi sees human beings as essentially social creatures. What we really need to do is to seek out those who have managed to refashion themselves, and hang out with them.
We need wise teachers who know what it means to refashion their lives. We need friends who have struggled hard to develop positive qualities. And we need people who have cultivated goodness in themselves. Because if we practice hard enough in the company of others, if we understand the transforming power of ritual, if we 'ponder, query and thoroughly investigate', then Xunzi tells us that moral perfection is within our reach.
Being perfectly good is hard. But it is perfectly possible.
 Eric L. Hutton, Xunzi: The Complete Text (Princeton University Press 2014), p 142
 ibid, p. 142
 ibid, p. 1. Translation slightly modified.
As well as producing the best contemporary translation of the Xunzi, Eric Hutton has also edited the Dao Companion to the Philosophy of Xunzi (Springer 2016), which is full of good stuff.
There's a breezy introduction to Xunzi and his ideas in Philosophy Now.