Persists add-in data inside Revit documents using Extensible Storage. Covers schema definition, entity read/write, and element filtering. Use when data has no parameter equivalent.
Ships in revit-api. 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.
Read when SKILL.md points to them.
Extensible Storage stores add-in data in the .rvt file.
A Schema describes the shape, an Entity contains the values, and any Element stores one entity per schema.
The layout below mirrors EF Core: a schema definition corresponds to an entity configuration, a context corresponds to a DbContext, and a plain class contains the values.
Nice3point.Revit.Extensions wraps the entity read and write pair as SaveEntity/LoadEntity on Element, and the schema filter as WithExtensibleStorage on the collector.
The data class, the schema definition, and the context change in one edit.
ProjectData/
ProjectData.cs // the values
ProjectDataConfiguration.cs // the schema definition
ProjectDataContext.cs // access to the stored values
| EF Core | Extensible Storage |
|---|---|
IEntityTypeConfiguration<T> | *Configuration class driving SchemaBuilder |
DbContext | *Context class managing the schema and store |
| entity type | plain data class |
SaveChanges() | Transaction.Commit() |
DbSet<T> query | collector.WithExtensibleStorage(guid) |
| migration | a new schema GUID |
namespace RevitAddIn.ProjectData;
public sealed class ProjectData
{
public string Number { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public double GrossArea { get; set; }
}
Schema.Lookup returns the schema already registered in the session, and Finish throws once that identity exists.
using Autodesk.Revit.DB.ExtensibleStorage;
namespace RevitAddIn.ProjectData;
public static class ProjectDataConfiguration
{
public const string Number = "Number";
public const string Name = "Name";
public const string GrossArea = "GrossArea";
public static readonly Guid Identity = new("0E73AF93-E7F3-42E6-9BA5-AFC1CA23D42B");
public static Schema Create()
{
var schema = Schema.Lookup(Identity);
if (schema is not null) return schema;
var builder = new SchemaBuilder(Identity);
builder.SetSchemaName("AcmeProjectData");
builder.SetDocumentation("Project data owned by the Acme add-in");
builder.SetVendorId("ACME");
builder.SetReadAccessLevel(AccessLevel.Public);
builder.SetWriteAccessLevel(AccessLevel.Vendor);
builder.AddSimpleField(Number, typeof(string));
builder.AddSimpleField(Name, typeof(string));
builder.AddSimpleField(GrossArea, typeof(double)).SetSpec(SpecTypeId.Area);
return builder.Finish();
}
}
A double, float, XYZ, or UV field declares its spec with SetSpec, and every read and write of it passes a compatible unit.
Schema and field names must read as C++ identifiers — ASCII letters, digits after the first character, and underscore.
Build the schema when the data is first touched, not during add-in startup.
Registering a schema at startup slows document open and save.
A document-wide record belongs on a DataStorage element, an invisible element designed to store entities.
One DataStorage element stores one subject.
In a workshared model, editing a subject borrows only the storage element of that subject.
Data that describes a single element belongs on that element instead — take it as a constructor argument and skip the lookup.
Reads need no transaction, writes do. The caller opens the transaction, and the context opens none.
using Autodesk.Revit.DB.ExtensibleStorage;
namespace RevitAddIn.ProjectData;
public sealed class ProjectDataContext
{
private const string StorageName = "Acme Project Data";
private readonly Document _document;
private readonly Schema _schema;
public ProjectDataContext(Document document)
{
_document = document;
_schema = ProjectDataConfiguration.Create();
}
public ProjectData Load()
{
var storage = FindStorage();
if (storage is null) return new ProjectData();
return new ProjectData
{
Number = storage.LoadEntity<string>(_schema, ProjectDataConfiguration.Number) ?? string.Empty,
Name = storage.LoadEntity<string>(_schema, ProjectDataConfiguration.Name) ?? string.Empty,
GrossArea = storage.LoadEntity<double>(_schema, ProjectDataConfiguration.GrossArea, UnitTypeId.SquareMeters)
};
}
public void Save(ProjectData data)
{
var storage = FindStorage();
if (storage is null)
{
storage = DataStorage.Create(_document);
storage.Name = StorageName;
}
storage.SaveEntity(_schema, data.Number, ProjectDataConfiguration.Number);
storage.SaveEntity(_schema, data.Name, ProjectDataConfiguration.Name);
storage.SaveEntity(_schema, data.GrossArea, ProjectDataConfiguration.GrossArea, UnitTypeId.SquareMeters);
}
private DataStorage? FindStorage()
{
return (DataStorage?) _document.CollectElements()
.OfClass<DataStorage>()
.WithExtensibleStorage(_schema.GUID)
.FirstOrDefault();
}
}
SaveEntity returns false when the schema has no such field, and LoadEntity returns the default when the field is missing or nothing was written yet.
The context is bound to a Document.
Create one per document, and never store it in a static field or register it as a singleton.
using var transaction = new Transaction(document, "Save project data");
transaction.Start();
var context = new ProjectDataContext(document);
context.Save(data);
transaction.Commit();
WithExtensibleStorage applies an ExtensibleStorageFilter, a quick filter that rejects elements before they expand into memory.
var annotated = document.CollectElements()
.WithExtensibleStorage(ProjectDataConfiguration.Identity)
.ToElements();
element.DeleteEntity(schema); // returns false when the element has no entity of the schema
document.EraseSchemaAndAllEntities(schema); // every entity in the document
Both need an open transaction and write access to the schema. The erased schema remains registered in memory for the rest of the session.
Save, close the document, reopen it, and read the values back. Data missing after the reopen was never written to the file.
double, float, XYZ, and UV field declares a spec, and every read and write of one passes a compatible unit.WithExtensibleStorage, not by loading everything and probing GetEntity.| Pitfall | Correct approach |
|---|---|
| Adding or renaming a field in a schema that already shipped | Create a new GUID, read the old schema, and write the new one. |
new SchemaBuilder(guid) without Schema.Lookup first | Finish throws once the identity is registered in the session. |
A double field without SetSpec | Declare the spec, then pass a compatible unit on every read and write. |
Mutating the entity from GetEntity and expecting it to stick | GetEntity returns a copy, and SetEntity stores it. SaveEntity does both. |
Treating the result of GetEntity as null when absent | GetEntity returns an invalid entity, not null — check entity.IsValid(). |
Wrapping Transaction in a custom unit of work | The caller opens the transaction; the context only reads and writes. |
| Dumping one large JSON string into a single field | Split it into separate fields, arrays, and maps. |
Loading every element to probe GetEntity | document.CollectElements().WithExtensibleStorage(guid). |
SaveEntity/WithExtensibleStorage not found | The Nice3point.Revit.Extensions 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-api-option-handlersSupply small Autodesk Revit API callback interfaces with Nice3point.Revit.Toolkit ready-made handlers, not hand-rolled classes. USE FOR: passing IFamilyLoadOptions, IDuplicateTypeNamesHandler, or ISaveSharedCoordinatesCallback to a Revit API call. DO NOT USE FOR: constraining what a user can pick in an interactive selection, or building a dockable pane's UI element.
/revit-code-styleStructure Autodesk Revit API code — API boundaries, document and transaction lifetime, thread affinity, and converting Revit objects to plain models. USE FOR: structuring Revit API code — which projects may reference Revit types, which scope opens and closes a document, how to scope a transaction, thread affinity, and converting Revit objects before they cross a service or process boundary. DO NOT USE FOR: the mechanics of individual model operations (querying, parameter read/write, *Utils wrappers), which have their own focused skills — apply this to the structure around them.
/revit-element-and-parameter-accessRead and write Autodesk Revit elements and parameters with the Nice3point.Revit.Extensions fluent accessors. USE FOR: finding an Element by ElementId, finding a parameter by BuiltInParameter/ParameterTypeId/Guid/name, reading its typed value, setting it, and converting internal units. DO NOT USE FOR: querying the model for a set of elements (use revit-element-collector).
/revit-element-collectorQuery the Revit model with the Nice3point.Revit.Extensions fluent FilteredElementCollector wrappers; filter with Revit's parameter filters, not by loading elements and filtering with LINQ. USE FOR: writing or reviewing element queries that filter by class, category, or parameter value and return the first match, a count, or the full set. DO NOT USE FOR: reading or setting parameters on an element already retrieved (use revit-element-and-parameter-access).
/revit-failure-handlingSuppress expected Autodesk Revit warnings and failures during a bounded API operation with Nice3point.Revit.Toolkit RevitApiContext. USE FOR: auto-resolving or auto-cancelling a known failure that would otherwise block opening a document, loading a family, or committing a transaction. DO NOT USE FOR: suppressing UI dialogs that are not failures (use RevitContext.BeginDialogSuppressionScope), or running API work from outside the Revit API context (use a Toolkit external event).
/revit-utils-extensionsReplace verbose Autodesk Revit *Utils static calls, static managers, and hand-written enum/id conversions with Nice3point.Revit.Extensions fluent extensions. USE FOR: any call to a SomeUtils.Operation(…) or any other static Revit API helper, any conversion or formatting of a Revit value, and any iteration of a Revit array, set, or map. DO NOT USE FOR: querying the model for elements (use revit-element-collector), or reading and writing element parameters (use revit-element-and-parameter-access).
/revit-api:revit-extensible-storagefrom revit-api
npx claudepluginhub nice3point/revit-skills --plugin revit-apiOther plugins' skills for the same job