Moves
Swagger, Klefki's main tool of annoyance, confuses the foe while doubling its Attack stat. This has perfect synergy with Foul Play, allowing Klefki to slam its foes hard after the boost! Foul Play also works well against Pokemon that may attempt to set up on Klefki if you are willing to make a risky prediction against foes such as Garchomp. Thunder Wave furthers aids Klefki's ability to cripple Pokemon, being an excellent tool to stop fast sweepers thanks to Prankster, pairing well with Swagger to further increase the chances of preventing your foes from moving!
Substitute makes Klefki more difficult to KO and has great synergy with Swagger and Thunder Wave because Klefki often finds itself getting free turns to set it up. It also saves Klefki from Choice Scarf + Trick users such as Rotom-W. Magnet Rise is more situational than Substitute, but its ability to save Klefki from powerful Earthquake users such as Mega Kangaskhan and Garchomp can be very valuable. If you feel Klefki needs to do better against defensive Pokemon such as Cresselia, Porygon2, and Slowbro, Toxic can be used as a surprise move to cripple them. You can even get rid of Thunder Wave if your team needs Klefki to handle itself better against stall. If you choose Toxic over Thunder Wave, consider running Heal Block to prevent Pokemon such as Suicune from using Rest.
Set Details
Leftovers is a key item on this set, as the free turns Klefki often gets as a result of Swagger and paralysis give it ample time to restore much of its health; in addition, it pairs well with Substitute. A Calm nature with maximum investment in HP and Special Defense is preferred, as Klefki's Swagger shenanigans tend to work better on special attackers. Most importantly, this allows Klefki to avoid a 2HKO from all of Mega Gengar's attacks except for a status-boosted Hex. It also lets Klefki better handle Aegislash, which can be defeated by Foul Play if it hits itself in confusion!
As an aside, a Bold nature with maximum HP and Defense investment is a reasonable option, as it allows Klefki to survive weaker boosted hits and an unboosted Earthquake from both Mega Kangaskhan and Garchomp when at full health.
Usage Tips
Try to use Substitute whenever possible against threats that can't do much to Klefki, such as Choice item users locked into resisted moves (common examples include Talonflame locked into Brave Bird and Garchomp locked into a Dragon-type attack), Greninja that lack Water-type moves, and Cresselia when Klefki is carrying Toxic. Then, Klefki should use either Swagger or Thunder Wave, depending on whether the opponent's team has a Ground- or Electric-type remaining. Paralysis and confusion together make it likely your opponent won't be able to attack! If Klefki is behind a Substitute or facing an offensive opponent that won't OHKO it after a Swagger boost, use Foul Play to deal serious damage against Pokemon that don't resist it.
If your Klefki is running Thunder Wave, choosing whether to use Swagger or Thunder Wave first can be a bit tricky. Using Swagger and then Thunder Wave has a better chance of preventing the foe from moving and tends to work well against special attackers. However, Swagger is riskier against physical switch-ins and allows the foe to switch out without a permanent status effect like paralysis. Thunder Wave can therefore be used as a less risky option first if your opponent prefers to send in physical attackers against Klefki, though Ground- and Electric-type Pokemon can use it as a free switch in.
Regardless of which move you choose to use first, use Substitute whenever Klefki gets a free turn from Swagger or paralysis, as this can set Klefki up to decimate offensive teams! Just try to avoid relying too much on the luck factor, because as tempting as it may be to crush an opponent with Klefki's coin flips, Swagger can backfire massively against physical threats if they don't hit themselves in confusion!
If you opt to run Toxic Klefki, don't use Toxic the first chance you get. Instead, keep your opponent in the dark about the true nature of your Klefki. Because Klefki tends to attract defensive Pokemon such as Cresselia, Porygon2, and Slowbro, you will want to hit them with Toxic when they least expect it, potentially opening new holes for an offensive teammate to rip through.
Finally, pay attention to the Team Preview, because Klefki tends to struggle against Ground-and Electric-types due to their Thunder Wave immunity. If you see Pokemon that Klefki has trouble with, such as Thundurus and Garchomp paired together, consider benching Klefki.
Team Options
A special teammate to consider for Klefki is Ditto. Because Ditto's Imposter copies the foe's stat boosts, you can potentially sweep your opponent with their own Pokemon by sacrificing Klefki against a Swagger-boosted physical attacker such as Garchomp! Just ensure that Ditto can OHKO the Pokemon so the strategy won't backfire.
Thanks to Prankster and its habit of forcing switches, Klefki is excellent at spreading paralysis with Thunder Wave, making it a good idea to partner it with slower, more powerful Pokemon. Hydreigon and Dragonite are especially good examples due to to their good defensive synergy with Klefki, but other good teammates to consider include Azumarill, Mamoswine, and Conkeldurr. If you're willing to place further emphasis on luck, you can even try to take advantage of paralysis to get more boosts with Moody Glalie.
Mega Kangaskhan and Ground-types are a huge problem, as their powerful Earthquakes easily take advantage of and smash Klefki and its Swaggers. Great defensive partners to consider include Cresselia, Porygon2, which also has access to Foul Play to take advantage of Swagger against special attackers, and Slowbro. Gliscor works against Ground-types as well, with the exception of Mamoswine, and Suicune and Rotom-W can work well too despite their lack of reliable recovery. Greninja, while very frail and hard to bring in, can hit Ground-types fairly hard thanks to a Protean-boosted Ice Beam and can hit Mega Kangaskhan hard with Low Kick as well.
While Klefki is a great paralysis spreader itself, carrying some extra Pokemon with paralysis moves can be extremely useful, as they allow Klefki to dish out Swagger with less pressure. Great defensive examples include Cresselia, Porygon2, and Rotom-W, while more offensive examples include Thundurus and Serperior, which can actually paralyze Ground-types with Glare.
If Klefki is only carrying Thunder Wave, defensive Pokemon such as Suicune, Cresselia, Porygon2, and Slowbro are able to easily stall it out. This makes stallbreakers a great addition to a Klefki core, with prominent examples being Mega Gengar, Swords Dance Mega Charizard X, and Toxic Mega Salamence. Conversely, if Klefki is carrying Toxic (and Heal Block for Suicune), it can turn the tables on its defensive checks and help support sweepers that have trouble against them; good partners for this include Garchomp, Mega Kangaskhan, Mega Salamence, and Blaziken.