Runs Autodesk Revit API work from modeless windows, background threads, or other non-API-context callbacks using Nice3point.Revit.Toolkit external events. Includes source generator support.
Ships in revit-ui. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The Revit API is accessible only inside the API context.
Nice3point.Revit.Toolkit external events initialize automatically.
A caller constructs an event and raises it from any thread without creating it inside the API context first.
ShowDialog: it runs on the API thread and calls the API directly.ExternalEvent / ExternalEvent<T> — fire-and-forget with zero or one argument.AsyncExternalEvent / AsyncExternalEvent<T> — await completion.AsyncRequestExternalEvent<TResult> / <T, TResult> — await a returned result.Mark every containing type partial and annotate a handler method with [ExternalEvent].
The generator emits the event member from the method signature and names it after the method — <Method>Event for the synchronous form and <Method>AsyncEvent for the awaitable one — and the caller raises the work through that generated property.
Open and commit the transaction inside the method.
public sealed partial class WindowCleaner
{
[ExternalEvent]
private void DeleteWindows(UIApplication application)
{
var document = application.ActiveUIDocument.Document;
using var transaction = new Transaction(document, "Delete windows");
transaction.Start();
document.Delete(document.GetInstanceIds(BuiltInCategory.OST_Windows));
transaction.Commit();
}
// from any thread or context
private void OnDeleteClick() => DeleteWindowsEvent.Raise();
}
A value-returning method generates only the awaitable request form (<Method>AsyncEvent, raised with await); a method with two or more extra parameters also gets a generated Raise(...)/RaiseAsync(...) taking the individual arguments.
Use the public constructors for a lambda or field, a non-partial type, a DI-created instance, or a signature the generator rejects.
Each event type offers two handler families — one that takes the argument(s) only, and one that also receives the current UIApplication — and every family has an optional ExternalEventOptions overload.
(There is no ExternalEvent.Create(...) factory; the constructor is the manual entry point.)
private readonly ExternalEvent<ElementId> _deleteElement = new((application, elementId) =>
{
var document = application.ActiveUIDocument.Document;
using var transaction = new Transaction(document, "Delete element");
transaction.Start();
document.Delete(elementId);
transaction.Commit();
});
// from any thread or context
_deleteElement.Raise(elementId);
Omit UIApplication where the handler does not use it (new ExternalEvent(() => …), new ExternalEvent<T>(arg => …)) and read ambient state through RevitContext.
Await completion with AsyncExternalEvent/AsyncExternalEvent<T> (await …RaiseAsync()), and return a value with AsyncRequestExternalEvent<TResult>/<T, TResult> (var result = await …RaiseAsync(arg)).
Set [ExternalEvent(AllowDirectInvocation = true)] only when one operation must serve callers inside and outside the API context.
The event runs the method inline when the caller is already in the API context.
Never use it to bypass ownership or concurrency rules.
Await async event results before using the Revit objects the handler creates, and test the observable model result.
[ExternalEvent] method's containing type is partial.AllowDirectInvocation is set only for a real dual-context need.| Pitfall | Correct approach |
|---|---|
[ExternalEvent] on a method whose type is not partial (RVTTK0005) | Mark the containing type partial. |
[ExternalEvent] method returns Task or is async void (RVTTK0001/0002) | Use a synchronous signature; use Async… event types to await. |
Generic [ExternalEvent] method (RVTTK0003) | Use concrete parameter types. |
| Using an external event while already in API context | Call the API directly. |
ExternalEvent or [ExternalEvent] not found | The Nice3point.Revit.Toolkit package is not referenced. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/revit-command-and-applicationBuild Autodesk Revit add-in entry points with Nice3point.Revit.Toolkit base classes, not raw IExternalCommand/IExternalApplication interfaces. USE FOR: authoring an external command or application with a simplified Execute()/OnStartup() override, optional OnShutdown() override, ready context properties, and automatic dependency resolution. DO NOT USE FOR: dispatching API work from code that runs outside the Revit API context (use revit-external-events).
/revit-context-accessAccess the Autodesk Revit database application through RevitApiContext or an active UI session through RevitContext from Nice3point.Revit.Toolkit, and suppress dialogs. USE FOR: reading Application, the current UiApplication/ActiveDocument/ActiveView without a commandData, or suppressing TaskDialog and message boxes with BeginDialogSuppressionScope. DO NOT USE FOR: suppressing expected Revit warnings and failures during a transaction.
/revit-context-menuAdd Autodesk Revit right-click context menu entries with the Nice3point.Revit.Extensions fluent API. USE FOR: registering context menu items, submenus, and separators bound to command classes during application startup. DO NOT USE FOR: ribbon panels and buttons (use revit-ribbon).
/revit-dockable-paneRegister a WPF dockable pane in the Autodesk Revit UI with Nice3point.Revit.Toolkit DockablePaneProvider. USE FOR: registering a dockable pane and its initial dock state during application startup with the fluent API.
/revit-ribbonBuild an Autodesk Revit ribbon with the Nice3point.Revit.Extensions fluent panel and button API, not raw RibbonPanel and PushButtonData calls. USE FOR: creating ribbon panels, push/pulldown/split buttons, stacked rows, icons, tooltips, shortcuts, and availability controllers in an application's OnStartup. DO NOT USE FOR: right-click context menu entries (use revit-context-menu).
/revit-selection-filterFilter which elements and references a user can pick in Autodesk Revit UI with the Nice3point.Revit.Toolkit SelectionConfiguration, not a custom ISelectionFilter. USE FOR: constraining an interactive Selection.PickObject/PickObjects with a fluent Allow.Element / Allow.Reference filter. DO NOT USE FOR: headless API callbacks such as family load or duplicate-type options (use Toolkit option handlers like FamilyLoadOptions).
/revit-ui:revit-external-eventsfrom revit-ui
npx claudepluginhub nice3point/revit-skills --plugin revit-uiOther plugins' skills for the same job