Skip to main content

revit-code-style

Structure Autodesk Revit API code — API boundaries, document and transaction ownership, thread affinity, and converting Revit objects to plain models. USE FOR: structuring Revit API code — where Revit types may live, who 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.

Jump to install

Source facts

Repository
Nice3point/revit-skills
Last source activity
September 6, 2026 at 12:40
Detected SKILL.md language
English
Stars
13
Forks
3

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
revit-code-style
description
Structure Autodesk Revit API code — API boundaries, document and transaction ownership, thread affinity, and converting Revit objects to plain models. USE FOR: structuring Revit API code — where Revit types may live, who 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.
license
MIT
# Revit Code Style Keep Revit API types contained, own document and transaction lifetime explicitly, and convert Revit objects to plain models before they leave a Revit-aware boundary. ## When to use - Placing Revit API code and deciding which project may reference it. - Structuring who opens, mutates, and closes a document and its transactions. - Deciding what crosses a service or process boundary. ## API boundaries - Keep Autodesk Revit API references inside a Revit-aware project; keep routing, message contracts, serialization, and generic hosting free of Revit types. - Convert Revit objects to plain, immutable models before data crosses a service or process boundary. - Verify an unfamiliar Revit or Nice3point API against its official documentation or source. ## Ownership and threading - Open a document in the scope that owns processing it; close it and dispose generated resources in the matching owner scope. - Keep transactions short and named after the visible model change. - Treat Revit API objects as thread-affine; keep general I/O outside a Revit API execution context unless the API requires it. ## Reuse before writing helpers - Prefer the `Nice3point.Revit.Extensions` fluent wrappers over raw Revit calls (`revit-element-and-parameter-access`, `revit-element-collector`, `revit-utils-extensions`). - Prefer `Nice3point.Revit.Toolkit` context, options, and callbacks over recreating their contracts. - Keep a local extension small, deterministic, and explicit about cost; do not hide a collector, mutation, or file operation behind an innocuous name. - Cover a non-trivial local extension with a Revit test. ## Validation - [ ] Revit API types stay inside Revit-aware projects. - [ ] Documents and generated resources are closed and disposed in their owner scope. - [ ] Transactions are short and named for the change. - [ ] Revit objects are converted to plain models before crossing a boundary. ## Common Pitfalls | Pitfall | Correct approach | |--------------------------------------------------------|------------------------------------------------------------------| | A Revit type on a message contract or serialized model | Convert to a plain model inside the Revit-aware boundary. | | A transaction spanning unrelated work | Keep transactions short and single-purpose. | | A local helper duplicating a Nice3point extension | Use the existing extension; add a local one only when none fits. |
View on GitHub