Where does the expression “to cut capers” come from and What does “cut capers” mean?

The sense, to anyone whose knowledge of Latin enables him to recognize that the zodiacal sign Capricorn is a he-goat, is to perform like a goat, especially a kid or young goat; that is, to frolic about in a grotesque manner.

Although the expression “to cut capers” and its meaning were still new in his day, Shakespeare introduces it in Twelfth Night (1601) in a dialog between the two cronies, Sir Toby Belch and Sir Andrew Aguecheek, Act I, scene 3:

Sir Andrew: I am a fellow o’ the strangest mind i’ the world; I delight in masques and revel sometimes altogether.

Sir Toby: Art thou good at these kickshaws, knight?

Sir Andrew: As any man in Illyria, whatsoever he be, under the degree of my betters; and yet I will not compare with an old man.

Sir Toby: What is thy excellence in a galliard (a lively French dance),

Sir Andrew: Faith, I can cut a caper.

Sir Toby: And I can cut the mutton to it.