Shatner, who plays lawyer Denny Crane, told the Los Angeles Times that Kelley has the characters refer to their own TV existence as a way to keep the show outrageous and unpredictable.
"So in that shocking moment of a character looking at the audience and saying 'Cue the music,' the viewer takes a mental step backwards and says, 'Good God, did he really say that?,'" Shatner said.
The ongoing comments from both Shatner and co-star James Spader have ranged from ruminations regarding the TV series' next season to introducing new series characters out of turn, but Kelly said they all are made under strict guidelines.
"You never want to throw the audience at the wrong time when the story is important," Kelley told The Times. "But at the same time, we don't take ourselves too seriously and particularly the characters don't take themselves too seriously. So it feels somewhat organic."