Skip to main content
FridayPlus 图标FridayPlus
← Back to updates
2026-11-02Blog

Giving AI Its Rules: A Revit Plugin Development Skill That Keeps Evolving

The fastest way to fail with AI is not that it cannot write code — it is falling into the same pit over and over. The cure is a set of "rule assets".

The starting point: the wall of compile errors

When AI first wrote Revit plugins, what drained enthusiasm was not anything profound — it was compile errors:

  • Used LINQ, forgot using System.Linq — three times out of ten
  • Revit's Color vs WPF's Color name clash, CS0104 filling the screen
  • Modified the model without a Transaction — a runtime explosion
  • Forgot Revit's internal unit is feet: the UI shows 5930; the user thinks millimeters, it is really 1807 mm
  • Looked up a parameter by the string "直径" — returns null on an English Revit

None of these is hard. Every one of them keeps happening. AI's nature: scold it once in the conversation and it remembers once; new session, all forgotten. It has no muscle memory of last week's fall.

The solution: two documents, in and out

We built a two-layer memory system:

Skill (rules before the fact): a rules document loaded automatically with every session, read by AI before any code. It is all "how not to err": project skeleton templates, 5 must-checks while writing, a 20-item pre-compile checklist, a Revit version-difference quick reference, and the special rules of hosting WPF inside Revit.

Pit notes (archives after the fact): AI followed every rule and still erred? After the fix, the pit goes into the notes, three lines each: the pit in one sentence, the symptom, the fix.

The promotion mechanism connects the two: the same pit appearing a second time in the notes must be promoted into the skill — from "summarized afterwards" to "prevented beforehand".

What a rule looks like: two examples

Example one, from the checklist:

□ Search for .First( .Where( .ToList( → confirm `using System.Linq;` exists

Not the useless "be careful with LINQ usings" — an executable check. AI mechanically runs the list before every compile, and this error class went from "constant" to "extinct".

Example two, the version rule:

Every version bump, change three places in sync:
① AssemblyName filename  ② manifest.json version  ③ embedded version
No exceptions. Online update comparison reads the embedded FileVersion.

Born from a real incident: the DLL filename was bumped, the user installed it, and the manager still showed the old version. The pit went into the skill; AI now bumps all three automatically and has never missed again.

The boundary of rules: not just code

Over time the rules grew from "how to write code" to "how to work":

  • The requirement iron rule: no code without a confirmed plan; never guess uncertain logic — ask
  • Bug division of labor: for user-reported problems, AI analyzes and lists only; it acts when explicitly told "go"; testing stays in human hands
  • Asset discipline: one plugin, one folder, one git; the status sheet is the single source of truth; AI refreshes content but never touches the human-arranged priority order

That last one is the interesting one: the sheet's order IS the user's priorities — human will. AI may update entries but never reorder. Rules guard not only against AI's errors, but against AI overstepping.

Results, and the mindset

The original goals — "zero compile errors, zero runtime crashes" — are basically met: a new plugin now goes from confirmed requirements to first compiling build in one round; the only runtime crash in the last six months was the API-context bug from the previous post — fixed and in the skill the same day.

Distilled to three sentences:

  1. AI's errors are structural — not carelessness, missing project context. The antidote is not scolding; it is freezing context into rules
  2. Rules must be executable — "watch out for X" does nothing; "search X, confirm Y" does
  3. Rule assets are the most valuable accumulation — code gets refactored, plugins retire, but "how to make AI err less in this domain" carries over to the next project intact

The competitive edge in AI development is no longer "can make AI write code" — everyone can. The edge is the ever-evolving rulebook in your hand.