'I write comedy novels.'
'Oh no you don't.'
'Oh yes I do.'
'Tell us a joke then.'
'It doesn't work like that...mostly.'
While one liners work well in standup routines, and fairly well in comedy shows/plays, they rarely work well in novels. Yet despite this, I get some great lines from standup. My own standup that is.
I am compiling a book of routines and jokes for the day I may just do a standup routine, but in the course of compiling that book I stand in my front room and act like I'm in the final of Britian's Got Talent, making everyone laugh (even Simon Cowell). I go over it time and again to see if it works, rehash, rewrite, then commit it to paper once I'm happy(ish) with it.
When I get back to my novels, I use those performance skills in writing the comedy. The setting, the buildup and the punchline - There is one routine I've entitled 'there's no one there', which I am dying to perform to an empty theatre one day. (If it was full, the people might not laugh) - I also watch comedy films, read comedy books and watch/listen to comedians, trying to learn everything I can about the art of comedy.
Some writers act out their scenes to get an insight into it, like me, but the comedy angle needs a little bit more. As crime writers will investigate what methods are used in forensics, I examine what makes people laugh. And despite what some people think, if you examine things correctly, you don't kill the punchline.