Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

extension-authoring

БесплатноБез исполняемых скриптовНе проверен

Turning a working script into a pyRevit button the user keeps. Covers where agent-made extensions live, adding and removing extension search paths, the bundle…

pyrevitlabsот pyrevitlabs★ 2 094 звезды на GitHub

Об этом скилле

Extension authoring

A button outlives the conversation: it runs whenever the user clicks it, without the run guard, rollback or approval prompt that protect agent runs. Build it only from a script that already works, and only with the user's go-ahead.

Workflow

  1. Prove the logic first. Develop it with run_query, or run_modify with dry_run=true, until it does the job on the user's model.
  2. Agree on the button. Before writing anything to disk, tell the user the extension, tab, panel and button names, the folder you will write to, and what the button does. Write files only after they agree.
  3. Write the bundle in the layout below, with your own file tools. If you have none, write the files from a run_query script with open(); file writes aren't rolled back.

Writing files, changing the search paths and reloading all happen outside the model. No run mode rolls them back or shows the user an approval prompt, not even run_modify, so the user's agreement in the conversation is the only check: get it for each of these steps before you run it. 4. Register the folder if it isn't %APPDATA%\pyRevit\Extensions (see Extension search paths). 5. Reload pyRevit (see Reload). 6. Check it loaded (see Check the button), then ask the user to try it.

Where agent-made extensions live

  • By default, put them in %APPDATA%\pyRevit\Extensions\. pyRevit loads every *.extension folder there without any configuration.
  • When the user wants them somewhere else, such as next to their scripts or in a repository, put them there and register that folder as a search path.
  • Keep everything you make in one extension, for example AgentTools.extension, unless the user asks for another. Ask the user what to call it the first time.
  • Never edit extensions you didn't create: not the ones shipped with pyRevit (pyRevitTools, pyRevitCore, ...) and not the user's own. Updates overwrite the shipped ones, and the user's own belong to them.

Extension search paths

A search path is a folder that contains *.extension folders, not an extension folder itself. Changing the list changes the user's pyRevit config, so do it only when the user asked for it or agreed to it. With a shell, prefer pyrevit extensions paths add <path> and pyrevit extensions paths forget <path>. Otherwise run this with run_query, passing inputs={"path": ..., "action": "add"} or "remove":

import os
from pyrevit.userconfig import user_config

action = inputs.get("action")
if action not in ("add", "remove"):
    raise ValueError("'action' must be 'add' or 'remove': {!r}".format(action))
path = inputs.get("path") or ""
if not os.path.isabs(path) or (action == "add" and not os.path.isdir(path)):
    raise ValueError("Extension search path must be an absolute, existing folder: {!r}".format(path))
path = os.path.normpath(path)
paths = user_config.get_thirdparty_ext_root_dirs(include_default=False)
others = [p for p in paths if os.path.normcase(os.path.normpath(p)) != os.path.normcase(path)]
user_config.set_thirdparty_ext_root_dirs(others + [path] if action == "add" else others)
user_config.save_changes()
result = user_config.get_thirdparty_ext_root_dirs(include_default=False)
  • Always pass an absolute path. A relative or empty one would register Revit's working folder.
  • Removing a path takes its tabs off the ribbon after the reload; the folder stays on disk. Say so, and delete files only if the user asks.

Reload

Reload pyRevit with run_query, so the new or removed extensions take effect. Only after the user agreed to the reload:

from pyrevit.loader import sessionmgr
result = {"session": str(sessionmgr.reload_pyrevit())}
  • Tell the user first: the ribbon rebuilds, which takes about 10-20 seconds, and any open pyRevit window closes.
  • The agent host keeps serving during and after the reload; your next request works as usual.
  • Don't reload while the user is in the middle of a pyRevit tool.

Layout

%APPDATA%\pyRevit\Extensions\
  AgentTools.extension\
    lib\                     optional: modules every button can import
    Agent Tools.tab\
      Rooms.panel\
        Number Rooms.pushbutton\
          script.py
          bundle.yaml
          icon.png           optional, 32x32 PNG
  • The folder names are the UI: the tab is named after *.tab, the panel after *.panel, and the button after *.pushbutton, unless bundle.yaml sets title.
  • The folder suffixes are required. Use .pushbutton for a plain button. A .pulldown or .stack groups several buttons; put .pushbutton folders inside it.
  • A module shared by several buttons goes in the extension's lib\ folder, which is on sys.path for every script in the extension. Copy helpers you kept in your workspace there; a button can't see your workspace.

bundle.yaml

title: Number Rooms
tooltip: Numbers the rooms on the active level fro
Полный SKILL.md на GitHub

Установить extension-authoring в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл extension-authoring?

Turning a working script into a pyRevit button the user keeps. Covers where agent-made extensions live, adding and removing extension search paths, the bundle folder layout, bundle.yaml, converting an agent script into a button script, reloading pyRevit, and checking the button loaded. Use it for "make this a button", "add a tool to the ribbon", "create a pyRevit extension for this", "load the extension in this folder", "remove that tab" and similar tasks.

Как установить скилл extension-authoring?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл extension-authoring запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить extension-authoring с