/blender:extensionsfrom blender
Use when writing or reviewing a Blender extension's registration, preferences, or manifest, covering lifecycle and packaging
Ships in blender. 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.
Covers what an extension acquires and releases across its lifecycle, and what its package holds.
[REFERENCES]:
Registration runs:
register() run under RestrictBlend: bpy.context holds window_manager and preferences alone, bpy.data raises AttributeErrorfrom bpy import context, data binds the restricted stand-ins permanently, and code reads bpy.context and bpy.data per callregister() gets no unregister(), its classes, handlers, and timers staying registeredregister_class raising ValueError and a second unregister_class RuntimeErrorregister classmethod raises stay registered with bl_rna in their own namespaceAcquisitions follow Blender dependency order and releases reverse it, an attachment naming an unregistered group crashing Blender at its next read:
| [INDEX] | [FIRST] | [THEN] | [OTHERWISE] |
|---|---|---|---|
| [01] | PropertyGroup | Class or attachment naming it in a pointer or collection | ValueError, class registered without it |
| [02] | Parent panel | Panel naming it in bl_parent_id | RuntimeError at registration |
| [03] | Operator | Keymap item calling it | Item property writes raising AttributeError |
register acquires in table order and pushes each release onto one stack, unregister closing it in reverse. Acquisitions sit in an extension module, the package __init__.py re-exporting register and unregister:
class Settings(bpy.types.PropertyGroup):
"""Amount the item runs by."""
amount: Annotated[int, bpy.props.IntProperty(name="Amount", min=1, default=1)]
class RunItem(bpy.types.Operator):
"""Run the item by its amount."""
bl_idname = "object.run_item"
bl_label = "Run Item"
amount: Annotated[int, bpy.props.IntProperty(name="Amount", min=1, default=1)]
@override
def execute(self, context: bpy.types.Context) -> Returns:
self.report({"INFO"}, f"Ran {self.amount} times")
return {"FINISHED"}
HELD = ExitStack()
def registered(stack: ExitStack, form: type, /, **namespace: object) -> type:
kind = type(form.__name__, (form,), {"__annotations__": annotated(form), **namespace})
bpy.utils.register_class(kind)
stack.callback(bpy.utils.unregister_class, kind)
return kind
def register() -> None:
with ExitStack() as stack:
setattr(bpy.types.Scene, "<id>_item", bpy.props.PointerProperty(type=registered(stack, Settings)))
stack.callback(delattr, bpy.types.Scene, "<id>_item")
operator = registered(stack, RunItem, bl_options={"UNDO", "INTERNAL"})
for addon in option.of_optional(bpy.context.window_manager).bind(lambda manager: option.of_optional(manager.keyconfigs.addon)).to_list():
keymap = addon.keymaps.new(name="Object Mode")
stack.callback(keymap.keymap_items.remove, keymap.keymap_items.new(operator.bl_idname, type="J", value="PRESS", ctrl=1))
bpy.app.handlers.load_post.append(loaded)
stack.callback(bpy.app.handlers.load_post.remove, loaded)
HELD.push(stack.pop_all())
def unregister() -> None:
HELD.close()
for manager in option.of_optional(bpy.context.window_manager).to_list():
manager.keyconfigs.update(keep_properties=True)
annotated and Returns come from blender:coding typing, and loaded is a persistent load_post handler. A raise inside the with block leaves the stack unpopped, releasing every earlier acquisition before the raise reaches Blender.
Attachments:
setattr(<host type>, "<id>_<key>", bpy.props.PointerProperty(type=<group>)) attaches a registered group, delattr releasing itrender, frame_current) refuse an attachment with ValueError, and name, RNA functions, and bl_rna take a shadowing one<host type>.bl_rna.properties lists is a built-in member or an earlier attachmentRegistered classes take the forms Blender checks at register_class and at each call:
bl_idname is <category>.<name> within 60 lowercase letters, digits, and underscores, else registration raises RuntimeError_PT_, _MT_, _HT_, _UL_, _AST_, _FH_ mid-name, else registration warnsInfo lineValueError at registration, *args counting none (Panel draw takes 2)bl_idname register under the __name__ they hold at register_classtype(f"{base.__name__}_{space.lower()}", (base,), {"bl_space_type": space}) per spacedraw and other bl_* membersCallback kinds pair one acquisition with one release on the same object, pushed onto the registration stack after it, members named under bpy:
| [INDEX] | [KIND] | [ACQUIRE] | [RELEASE] |
|---|---|---|---|
| [01] | App handler | app.handlers.<list>.append(fn), fn decorated @persistent | app.handlers.<list>.remove(fn) |
| [02] | Timer | app.timers.register(fn, first_interval=<delay>, persistent=True) | app.timers.unregister(fn) when is_registered(fn) |
| [03] | Message bus | msgbus.subscribe_rna(key=<key>, owner=owner, args=(), notify=fn) | msgbus.clear_by_owner(owner) |
| [04] | Draw handler | handle = <Space>.draw_handler_add(fn, args, <region>, <type>) | <Space>.draw_handler_remove(handle, <region>) |
| [05] | UI extension | <Menu>.append(fn) or prepend(fn), panels and headers alike | <Menu>.remove(fn) |
| [06] | Previews | previews = utils.previews.new() | utils.previews.remove(previews) |
| [07] | Translations | app.translations.register(<package>, <table>) | app.translations.unregister(<package>) |
| [08] | Command | handle = utils.register_cli_command(<id>, fn) | utils.unregister_cli_command(handle) |
| [09] | Manual links | utils.register_manual_map(fn) | utils.unregister_manual_map(fn) |
| [10] | Presets | utils.register_preset_path(<folder holding presets/>) | utils.unregister_preset_path(<same path>) |
Acquisitions follow Blender identity rules:
bpy.app.timers.unregister raises ValueError for a function no longer registered, a timer that stopped itself includedpersistent(fn) marks and returns plain functions and lambdas, and raises ValueError on a bound method, functools.partial, or callable instancepersistent function across file loads<Menu>.remove drops the first equal entry, a fresh bound method of one object included, and ignores an absent oneobject() owner per extensionPresets resolve through Blenders paths:
script.execute_preset runspresets/<extension id>/<key> of each utils.preset_paths folderutils.user_resource('SCRIPTS', path="presets/<extension id>/<key>"), which uninstall leavesPRESET in bl_options read presets from presets/operator/<category>.<name>, each holding every property without SKIP_PRESETAddPresetBase adds under a name any preset path holds cancel with a warningblender --command <id> <args> calls the registered fn(argv):
argv holds every argument after the id unparsed, --, --python-expr, and -c included, and Blender acts on none of themsys.exit(<n>) and argparse exit <n>, and raises and non-integer returns print their error and exit 1bpy.data, the startup file's window and scene, and no area--command (.blend, --python) run first, a .blend leaving context.window None beside one window_manager.windows entry--addons placed before --command, and --factory-startup alone drops themunregister() runs after fn returns, sys.exit includedextension included, abort that command with exit 1 until either handle releasesTables take the form {<locale>: {(<context>, <msgid>): <text>}}, one per package:
None, "", and "*" name the default context pgettext readscontexts.default and contexts.operator_default translate one text as a button label and an operator labelbpy.app.translations.locales code or a shorter formlanguage_country, language@variant, then languagept_BR beside pt) answering from the shorter form after an earlier table missesen_US entries relabel built-in English textValueError_bl_i18n_utils.bl_extract_messages.dump_addon_messages(<package>, False, <settings>) returns a .pot keyed by (context, msgid)SOURCE_DIR to bpy.utils.resource_path("LOCAL")text= and report strings, manifest name and tagline, and built-in definition stringsbl_label and bl_categoryOnline Manual lookups call manual map functions returning (<url prefix>, ((<pattern>, <url suffix>), ...)):
fnmatchcase, and patterns are lowercasebpy.ops.<category>.<name>AddonPreferences property buttons resolve to bpy.types.<class name>.<property>, a pattern on the attachment missing thembpy.types.<declaring struct>.<property>Patterns derive from the registered classes, an operator's bl_idname and a group's class name each keying one pattern and one anchor:
def manual(root: str, classes: Iterable[type[Struct]], /) -> tuple[str, tuple[tuple[str, str], ...]]:
return root, tuple(
(f"bpy.ops.{cls.bl_idname}", f"#{cls.bl_idname}") if issubclass(cls, bpy.types.Operator) else (f"bpy.types.{cls.__name__.lower()}.*", f"#{cls.__name__.lower()}")
for cls in classes
if issubclass(cls, (bpy.types.Operator, bpy.types.PropertyGroup, bpy.types.AddonPreferences))
)
register_manual_map and unregister_manual_map take one held partial(manual, "<url>", <classes>), called at each lookup.
__package__ of top-level __init__.py names the extension package host APIs key on:
__package__ of a subpackage module names the subpackagefrom .. import __package__ as package one level down)AddonPreferences.bl_idname takes that packagebl_idname, bpy.types attachments, commands) open with the manifest idbl_ext.<repo>.<id>, another repository or changed manifest id installing a separate extension at defaultsLifecycle events treat extension state by host rule, disable and enable naming addon_utils calls:
| [INDEX] | [EVENT] | [VALUES] | [CODE] | [WHEELS] | [USER_FILES] |
|---|---|---|---|---|---|
| [01] | Upgrade install | Kept | Package and submodules reimported | Synced | Kept |
| [02] | Reload Scripts | Kept | Top module rerun, submodules stale | Unchanged | Kept |
| [03] | Checkbox off, then on | Deleted | Modules kept, top rerun on new mtime | Removed, restored | Kept |
| [04] | disable, then enable | Kept, None when disabled | Modules kept, top rerun on new mtime | Unchanged | Kept |
| [05] | register() raises | Deleted on checkbox enable | Top module dropped, submodules kept | Removed on checkbox enable | Kept |
| [06] | Uninstall | Deleted | Package and submodules dropped | Removed | Deleted |
Code reloads follow host rules:
__init__.py twice, and module bodies hold declarations aloneimportlib.reload of an enabled package rebinds its module-level HELD stack, and the next unregister() releases nothing acquired beforeRuntimeError at each enable without importing and keep their preference rowCode changes reach a running session through bpy.ops.extensions.package_install_files(filepath=<archive>, repo=<repository>, enable_on_install=True) or a disable and enable cycle:
package_install_files disables the extension, drops its sys.modules entries, installs, and enables, so register() runs on fresh modulesinstall-file from another process replaces the files, and the session runs its loaded modules until the cycledisable or a raising register() load changed submodules once every sys.modules entry at or under the package leaveshandle_error collects release and registration faultsenable returns None when the extension stays disabledAddonPreferences values sit on the package's preferences.addons row, and reads derive the package from the class's bl_idname:
def preferred[P: bpy.types.AddonPreferences](kind: type[P], preferences: bpy.types.Preferences, /) -> Option[P]:
addon: bpy.types.Addon | None = preferences.addons.get(kind.bl_idname)
stored = addon and addon.preferences
return Some(stored) if isinstance(stored, kind) else NOTHING
preferred returns NOTHING while the class is unregistered and where --addons or a first default_set=False enable created no row. Stored values follow host rules:
bool, int, and enum values reading as each otheroptions={'HIDDEN'} beside a new oneregister() copies an old value is_property_set reports to the new identifier, then calls property_unset(<old>)preferences.is_dirty, and script writes leave it falseis_dirty after a write it keepsexit_pre handlers, then a save of dirty preferences, then every unregister()bpy.ops.wm.save_userpref() alonebpy.ops.preferences.addon_show(module=<package>) opens Preferences at the extension's expanded rowexit_pre writes to filepaths.asset_libraries hang Blender while a remote listing job runsfilepaths.asset_libraries.new() rows set is_dirty and save at quit, next registration taking the saved row and unregister() removing itWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub bsamiee/rasm --plugin blender7 skills in this plugin
/codingUse when writing or reviewing Python that runs inside Blender, covering bpy code from data references to host boundaries/debuggingUse when Python or native code inside Blender gives a wrong value, raises, hangs, crashes, or never stops at a breakpoint, covering debug endpoints, stops by code kind, extension reloads, stack dumps, crash reports, native frames, and GPU captures/hostUse when driving Blender or reading bpy members from the installed build, covering host control and installed-extension workflows/interfaceUse when writing or reviewing Python that builds Blender's interface or draws in editors, covering interface elements and redraw/nodesUse when writing or reviewing Python over a Blender node tree, covering tree structure and reconciliation/renderUse when writing or reviewing Python that sets Blender render, compositor, or sequencer state or defines a render engine, covering the output pipeline