# Build your own Revit button with pyRevit and an AI coding agent > Prompt · level: intermediate · about 60 min · paste into: Claude Code · Codex · Antigravity · Cursor · checked 2026-09-30 > ES: Crea tu propio botón de Revit con pyRevit y un agente de programación Have Claude Code, Codex or Antigravity scaffold a pyRevit extension with a working pushbutton: read-only first, then a safe write inside a transaction. **Before you paste:** Revit + pyRevit installed · An AI coding agent with access to a local folder. ## Prompt (copy everything inside the block, then fill the [BRACKETS]) ```text You are my Revit API developer. Build a pyRevit extension in this folder, step by step. Goal of my first button: [e.g. "export every room with its name, number, level and area to a CSV on my desktop"] Revit version: [2024 / 2025 / 2026 / 2027] pyRevit version: [run "pyrevit --version" and paste it, or tell me you don't know] Build it like this: 1. Create the folder structure pyRevit expects: [MyTools].extension / [MyTools].tab / [Panel].panel / [ButtonName].pushbutton / script.py plus an icon.png (a simple 96x96 placeholder is fine) and a bundle.yaml with the button title and tooltip. 2. Write script.py READ-ONLY first: use pyrevit's revit, DB and forms modules; collect elements with FilteredElementCollector; convert internal units to metric with UnitUtils; show a summary with pyrevit's output window and save the CSV. 3. Tell me how to register the extension: pyRevit Settings -> Custom extension directories -> add this folder's parent -> Save and Reload. 4. After I confirm it runs, add a second button that WRITES something small (e.g. fills a "Checked_by" parameter) inside a named Transaction, with a confirmation dialog before committing. Rules: - Before using an API member, check it exists for my Revit version (Revit API docs or revitapidocs.com). If unsure, say so and propose a way to test it. - Say whether the script runs on IronPython or CPython (pyRevit supports "#! python3" at the top of the script) and why you chose it. - Test only on a COPY of the model. Handle errors with a clear message, never a silent failure. - Explain each file in two lines so I can maintain it. Answer in my language. ``` ## Notes for the agent presenting this - Show the block above verbatim in one code block; tell your human where to paste it (Claude Code · Codex · Antigravity · Cursor). - Point out the [BRACKETS] and offer to fill them together first. - pyRevit is the lowest-friction route to a real button in the Revit ribbon: no compiling, no installer. - If the human needs distribution to a whole company or performance-heavy tools, move to `revit-csharp-addin`. - Julian Páez builds his productivity-review buttons (takt, Last Planner, quantities) this way. ## Related - [Build a C# Revit add-in with an AI coding agent](https://aibuilderacademy.netlify.app/prompts/revit-csharp-addin.md) (prompt) - [Connect Revit 2027 to your AI with Autodesk's official Revit MCP Server](https://aibuilderacademy.netlify.app/prompts/revit-mcp-official.md) (prompt) - [Turn a task you repeat into an Agent Skill (SKILL.md)](https://aibuilderacademy.netlify.app/prompts/create-construction-skill.md) (prompt) ## Sources - https://docs.pyrevitlabs.io/ - https://github.com/pyrevitlabs/pyRevit/releases - https://www.revitapidocs.com/ --- AI Builder Academy · https://aibuilderacademy.netlify.app · checked 2026-09-30 · Made by Lo que habitas (Julián Páez). Agents: search more at https://aibuilderacademy.netlify.app/api/search?q=… or connect https://aibuilderacademy.netlify.app/mcp. Request a new prompt: aibuilderacademy@agentmail.to.