Supreme Court Justice Antonin Scalia, center, sits onstage with school administrators during commencement at Stone Ridge School of the Sacred Heart in Bethesda, where his granddaughter Megan graduated. (Katherine Frey/The Washington Post)

Supreme Court Justice Antonin Scalia delivered an off-the-bench opinion on graduation addresses Thursday, drawing laughter and applause as he criticized cliches that don’t work during a commencement speech at an all-girls Catholic school.

“My problem with these platitudes is not that they are old and hackneyed, but that a lot of them are wrong,” Scalia said, standing before 79 graduates and hundreds of relatives and friends in the main gymnasium at Bethesda’s Stone Ridge School of the Sacred Heart.

Scalia’s appearance came as his granddaughter Megan graduated with the Class of 2015 from the independent Catholic school. Adding to the star power of the occasion was her classmate Katie Ledecky, the record-breaking swimmer and Olympic gold medalist.

As they and others listened, Scalia parsed a litany of stock phrases, melding them with his own advice. He first took issue with the oft-expressed sentiment that “we face unprecedented challenges.”

“Class of 2015, you should not leave Stone Ridge High School thinking that you face challenges that are at all, in any important sense, unprecedented,” he said. “Humanity has been around for at least some 5,000 years or so, and I doubt that the basic challenges as confronted are any worse now, or alas even much different, from what they ever were.”

Scalia — dressed in a suit and tie — took on other bits of advice, too, including, “To thine own self be true.”

“Now this can be very good or very bad advice, depending on who you think you are,” he said, as laughter rippled through the crowd.

He also turned some age-old sayings on their head.

“Never compromise your principles,” Scalia said, “unless of course your principles are Adolf Hitler’s, in which case you would be well advised to compromise them as much as you can.”

Scalia’s speech came in morning ceremonies that included a heartfelt address by the class valedictorian, Nora Gosselin, and a Taylor Swift song — “Long Live” — performed by the class. The graduates wore long white ­dresses of their own choosing instead of caps and gowns.

Ledecky was among those who received an award, recognized for her citizenship and Christian service.

In his speech, Scalia said that modern society encourages the idea that “believing deeply in something, following that belief, is the most important thing a person can do.”

“It is much less important how committed you are than what you are committed to,” Scalia said. “If I had to choose, I would always take the less dynamic, indeed even the lazy person, who knows what’s right rather than the zealot in the cause of error.”

He told graduates that it was their responsibility “not just to be zealous in the pursuit of your ideals, but to be sure that your ideals are the right ones, not merely in their ends, but in their means. That is perhaps the hardest part of being a good human being. Good intentions are not enough. Being a good person begins with being a wise person. Then when you follow your conscience, you will be headed in the right direction.”

Scalia, who was appointed by President Ronald Reagan and is known for his conservative views, is the longest-serving justice on the current court. Scalia has nine children and 36 grandchildren and is Catholic.

“Thirty-six is a lot of graduations,” he said as he opened his remarks.

After the ceremony, parents and graduates lauded the speech.

Graduate Grace Hwang said she admired Scalia’s intelligence and enjoyed his address. “It was a new way of looking at it,” she said of his take on platitudes. “He gave such great insight.”

Marianne Prendergast, whose daughter Maggie graduated Thursday, said she thought that Scalia “offered the girls very practical advice and bits of wisdom they could take with them.” She noted that it might not be the last time a Supreme Court justice speaks at a Stone Ridge graduation: Scalia has another granddaughter at the school, and the daughter of Chief Justice John G. Roberts Jr. also attends Stone Ridge, a spokeswoman said.

As Scalia ended his remarks, he mentioned one other graduation cliche: That this is not an end, it is a beginning.

“I want to tell you that is not true,” he said. “There is no more significant rite of passage in our society, no more abrupt end to a distinct age of your life, than the graduation from high school and the departure from home that soon follows.”

He told the young women that they would soon be off on their own, away from parents who love and supervise them.

“From here on, you are much more than you have ever been — I’m groping for a platitude to convey the thought — captains of your own ship. Masters of your own destiny. Your moral formation, what makes you a good person or a bad one, a success in all that matters or a failure, is now pretty much up to you.”

The 79-year-old justice told the teenagers that he had high hopes for them. “Good luck,” he said. “And let’s see, I had one last platitude around here somewhere. Oh, yes: The future is in your hands.”