The Senate is no longer a locus of oratory, and the House is a haven for demagogues. The president can’t get legislation enacted, so he plays small ball, tweaking a vast regulatory state. Is it any wonder that the Supreme Court is an object of fascination, with several of its justices now enjoying celebrity status? The high court may be divided, and its decisions sometimes unpopular, but it isn’t dysfunctional or impotent, and its opinions are at least grammatical and often inspiring.

“Scalia/Ginsburg,” an opera by Derrick Wang that premiered at the Castleton Festival on Saturday evening, celebrates the virtues of the court through an affectionate, comic look at the unofficial leaders of its conservative and liberal wings. A great deal of media attention has been paid to Wang’s confection since bits and pieces of it were performed at the court two years ago. The premiere of the finished work was highly anticipated and attended by Justice Ruth Bader Ginsburg, who was warmly received by the crowd; Justice Antonin Scalia was in Rome and didn’t attend.

The one-act opera, paired on a double bill with Ravel’s “L’heure espagnole,” feels like what was once known as a pièce d’occasion, a work assembled for a festive event, and not necessarily intended to be a lasting contribution to the repertoire. Great composers often cannibalized music from these works for later duty in more finished, lasting compositions. Wang could do likewise, because there is much that is charming, clever and amusing in the score.

But it needs shaping and trimming. The opera, including the libretto, is woven together from operatic conventions, repurposed to give the composer (who is also the librettist) a chance to engage the two justices in musical and legal repartee, much of it drawn directly from their own writing or public comments. Drawing on the idea that the legal opinions are built on a long history of precedent, Wang has created a score that mixes direct quotation with musical pastiche, shifting from idea to idea with the manic frenzy of Carl Stalling’s old Looney Tunes scores. Printed versions of the libretto have detailed footnotes citing not just the source of the text but the musical allusions.

So we get bits from Bizet’s “Carmen,” Verdi’s “La traviata,” Puccini’s “La bohème,” plus a Christmas carol, the lament from Purcell’s “Dido and Aeneas,” “The Star-Spangled Banner” and a lot of Mozart and Mozart-like music.

The virtue of this style is its flexibility in transporting text, and Wang’s opera is text-heavy. Recitative and arioso passages allow the singers to barrel through words at a tremendous clip.

The libretto reads better on the page than it functions on stage, though opera lovers will enjoy the challenge of identifying its myriad references.

Lawyers and court watchers will play a similar game with the text. Some of the allusions are clever to the point that probably only those with a fetish for the court will get them: In the final trio, Justice Ginsburg sings music from Strauss’s “Der Rosenkavalier,” an opera whose main character, the dignified Marschallin, she particularly admires.

Ginsburg, sung with animation, clarity and a light, flexible soprano voice by Ellen Wieser, is clearly the sympathetic heroine of the work. Scalia, created by tenor John Overholt, is her comic foil, though not an unsympathetic character. Overholt has a natural comic’s gift and finessed a likable curmudgeon from material that might have yielded caricature. Presiding over the proceedings, which are loosely structured as a series of trials meant to test Scalia’s character (perhaps in the fashion of Mozart’s “Magic Flute”), is The Commentator, sung by bass-baritone Adam Cioffari, who has a suitably commanding voice.

How to salvage a musical theater piece from all this material?

First, cut. An aria near the end, which recalls the marriage of Ginsburg to her late husband, Martin Ginsburg (who died in 2010), is a touching tribute to love, support, fidelity and his fine cooking, but it is one of several set pieces that are simply tacked on to an already overlong drama.

Second, refine. Pastiche and quotation are woven into the concept of the work, but they need better framing. More original material, and closer attention to the orchestration — to create a distinctive sonic palette to unify the work — might help.

Third, recast. Many of the showpieces in the score take the singers’ voices into uncomfortable places, where they lose focus and power; critical lines of text from both Overholt and Wieser were sometimes lost in muffled lower passages.

But fundamentally, the composer faces a critical choice: Is this meant to entertain and engage audiences, or is it a conceptual stunt aimed primarily at court watchers, lawyers and Washington insiders? To his credit, Wang hasn’t used opera as a cheap comic vehicle for lawyer jokes, but he hasn’t yet decided if he really wants to write a serviceable work for the opera house.

“Scalia/Ginsburg” was preceded by Ravel’s one-act slapstick comedy of sex and sexual allusion, “L’heure espagnole,” a sophisticated trifle that premiered in 1911 at the Opera-Comique in Paris.

In Ravel’s hands, the comic concept — that a clockmaker’s lusty wife needs her mechanism regulated — is applied lightly throughout in a work that mixes sumptuous orchestration and harmonic color with burlesque antics.

Mezzo-soprano Kate Allen, as Concepción, was the most accomplished of the five singers who fill out the ensemble cast. Allen’s mezzo is gorgeous, with a slight vibrato and a good deal of power throughout its range. But her performance felt constrained, cautiously sung and not quite in the manic spirit of Ravel’s bedroom farce. Concepción is one of the most delightfully transgressive female characters in all of opera; Allen should be having more fun with this.

Tenors Tyler Nelson and Cris Frisco sang Gonzalve and Torquemada respectively, and both with voices comfortable with the light, quavery, nuanced style of French song. Bass-baritone Tyler Simpson was a fine comic presence as the pompous Don Iñigo Gomez and baritone Ben Bloomfield was charismatic as the good-natured, long-suffering, finally rewarded Ramiro.

Maria Tucci directed both shows, with a deft and sympathetic hand, and Salvatore Percacciolo conducted, drawing out the best of Ravel’s prismatic orchestration and keeping everything tight and orderly in the motley of Wang’s crazy-quilt score.

The double bill of Ravel’s “L’heure espagnole” and Derrick Wang’s “Scalia/Ginsburg” will be repeated July 17 and 19 at the Castleton Festival.