The show employed Ian Martin as a "swearing consultant"; one of his roles is to pen the complex and creative insults used in the show.
The only time the BBC vetoed a line of dialogue was this line from Malcolm Tucker following the revelations about Jimmy Savile - "That's inevitable. It's as inevitable as what they'll find in Jimmy Savile's basement after he's dead."
Each episode has a credit for "the cast" under the writer credits. This is due to some of the dialogue being improvised.
British politicians have said that the only thing unrealistic about the show is the infamous amount of profanity, which is reportedly much worse in real life.