Nimona by Noelle Stevenson

A shape-shifter sidekick named Nimona teams with the villainous Lord Ballister Blackheart to show the kingdom the wicked truth behind Sir Ambrosius Goldenloin's seemingly heroic ways, desperate to reveal the Institution of Law Enforcement and Heroics for what it really is.