
Fast-Track pyRevit Systemβ’

Lesson 12
SuperCharge with AI

Written Summary
SuperCharge Your Tool with AI π€
By now you've got a solid NameSwapper tool that you can share with your team. But we can make it even better by supercharging it with AI.
In this lesson, we'll hand our tool to an AI agent and turn it into Swapper+ β an enhanced version with a custom WPF UI form for selecting views, setting renaming rules, and (most importantly) a live preview of every rename before you commit. That last part is the killer feature: you get to decide if the result is good before anything touches your model.
Pick your agent
There's a lot we could do with AI here, but let's keep the setup honest and simple.
I normally prefer Claude Code for all my agent workflows.
But to make this simpler and faster, we'll use Cursor's native agent β no setup at all, so we can all do it together right away.
For the model, I'm going with Claude 4.8 β that's a really good one β or maybe GPT 5.5. Whatever you prefer.
Don't overthink the choice. The process is what matters.
Step 1: Throw in a (slightly crazy) prompt
Let's go a little bit crazy with the first prompt:
Send it in. This is a big ask β there are hundreds of lines of code just to create the UI form β so the agent is going to think for a while, working in a loop: create code, verify, fix, repeat.
β οΈ Important: Without any reference files, AI tends to write WPF code with vanilla settings. It works, but it's messy β and maintaining it wouldn't be nice. Keep that in mind when you let an agent build UI from scratch.

πΌοΈ [IMAGE: Cursor agent panel with the Swapper+ prompt sent and the agent "thinking", new tool folder appearing in the extension file tree]
Step 2: Reload pyRevit while the agent thinks
These agents can take quite some time, so let's not just sit here. I can already see a new folder in our .extension folder, which means we can reload pyRevit now β even if the agent keeps changing the code, that's totally fine.
Go to Revit and reload pyRevit.
Wait for the new Swapper+ button to show up in your tab.
Let the agent finish writing the code.
π‘ Tip: You only need to reload pyRevit to make a new button appear. Once the button exists, the code updates automatically every time you click it β no reload needed (unless you're working with libraries).
Step 3: Test the first version
The agent finished, so let's click the button and see what we get.
A form shows up! And here's the cool part: the agent went through our existing extension, found a working example, and used it as a base. I honestly expected it to come up with some random stuff β but no, it grabbed our form. If you go agentic with your own extension, most of your tools will get built this way: your existing code becomes the reference.
πΌοΈ [IMAGE: First version of the Swapper+ WPF form β view list with checkboxes, search box, and basic renaming fields]
Now let's poke at it: Select None, search the views, try to find the "L" floor plans... and, okay, it's not perfect. L1 shows up, L2 doesn't exist in the list, the filtering is clunky. Not ideal.
And that's fine. First drafts from AI rarely are.
Step 4: Just ramble your feedback
So I don't like it β which means I go back to the agent and just kind of ramble about what's wrong:
π‘ Tip: You can often just ramble to these agents β they're pretty good at parsing it. Honestly, it beats carefully typing: you're faster, and you naturally throw in more context and extra details. Sure, it's a bit dirty, and you can always clean it up if things go sideways. But overall it works great.
While the agent works, here's the bigger point: you can push this really far. You can even spin up multiple agents working on multiple tools at once. But when you code with AI, it's really good if you can judge the code and the output. AI is great, but agents are either slow and thorough, or fast and a bit dumber β missing context, doing things the "kind of right" way but not the best way. Your understanding is what keeps it on track.
Step 5: The final Swapper+ in action
The agent made its changes. Let's open the tool again β and now it's working. Let's run through a real rename:
Click Select None β the preview goes empty.
Filter by Floor Plans and grab the L views: L1, L2, L3, L4, L5.
In Find, type
L. In Replace, typeLevel 0.Add a Suffix β something like
draft.Watch the live preview update with the new names for only the selected views.
Hit Rename. Perfect. Perfect!
πΌοΈ [IMAGE: Final Swapper+ form β view type filter dropdown, selected L1βL5 floor plans, and the live preview showing Current Name vs New Name columns]
Under the hood, the renaming logic is the same one you built by hand earlier in this training:
The AI just wrapped it in a much nicer experience. We could even turn the output into another menu with more functionality β but hold that thought.
Judge the output β and know when to stop
This is why pyRevit is so much fun right now: we have agents, we have AI, we always have somewhere to get answers. But two honest warnings from this session:
β οΈ Important: Don't blindly follow the AI. It can go astray, and getting back on track from there can be really hard. There were a few suggestions in this build I didn't like and pushed back on. Normally you'd also set up a proper backup system (version control) so you can always roll back β but that's a topic for another time.
And second: AI gives you so much code power that you need to know when to stop. Sometimes you have to tell yourself: "Erik, don't do it. It's enough." The tool works. Ship it.
The full journey, start to finish
Look at what you just went through β all the stages of real tool development:
Plan β we talked it through and gathered research (okay, we took a shortcut, but still).
Proof of concept β maybe 5 minutes and 15 lines of code, and we already had a working tool.
Feature by feature β one, two, three, four, five... slowly building it up.
AI supercharge β at the end, we threw it at an agent: "do that, and that, and that."

And now you have an amazing tool that you can start using right away β and a process you can reuse for every tool you build from here. Try the same approach for creating modules, and keep experimenting with AI to see how far you can push it.
What's next π
Congratulations β you did a great job, and you've got a genuinely useful tool to show for it. There's just one more lesson left, where I'll talk about your next steps: what to focus on and how to keep getting better with pyRevit and the Revit API. See you in the next one!