google-deepmind/mujoco/gui

Claude Code and agent skill by google-deepmind/mujoco

Trust tier 2
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Dear ImGui and ImPlot user interface design for MuJoCo Studio and MuJoCo viewer plugins (C++ ux/ components and Python ViewerPlugin build_gui panels): immediate-mode widget layout, multi-row widget/column alignment (Tables API), tooltip length and aspect ratio, build_gui vs render separation, ID stack rules (## label disambiguation vs ### seed reset override), list virtualization (ImGuiListClipper), theming, and input capture (WantCaptureKeyboard). Use only when building, aligning, styling, or…

Install

npx vskill@latest install google-deepmind/mujoco/gui

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as google-deepmind/mujoco/gui.

Dear ImGui Development & Architecture Guide

[!TIP]
Official MuJoCo documentation (`doc/*.rst`) & related skills:
(.. _StudioUiPlugins:, .. _StudioImGuiTips:) and
(.. _StudioCppComponents:) — How Dear ImGui and ImPlot integrate into
MuJoCo Studio, UpdateEvent vs BuildGuiEvent, and C++ (ux/) vs Python
widget trade-offs. Read these short .rst chapters directly when present
locally or in pip install mujoco under
pathlib.Path(mujoco.__file__).parent / 'doc', or fetch
https://mujoco.readthedocs.io/en/latest/<path>.html (or /en/stable/
once released; Sphinx anchors lowercase the label, e.g.
#studioimguitips).
Legacy mjui C framework used only in classic simulate.cc (distinct
from Studio's Dear ImGui stack).
- mujoco-studio — Studio viewer launchers, decoupled
sim/viewer threads, plugins, hot reload, and WebViewer streaming.
[!NOTE]
Dear ImGui is an immediate-mode GUI framework designed for fast iterations,
minimal state overhead, and high responsiveness. This guide documents best
practices and conventions for writing maintainable, performant, and
testable UI code across MuJoCo, its Python bindings, and dependent targets
in C++, Python, and WebViewer.
Applies to both C++ and Python: All architectural guidelines, widget
patterns, Tables API usage, ID stack rules (## vs ###), and performance
principles apply equally whether authoring native C++ (ImGui::) or Python
(imgui.) code. While snippets frequently illustrate patterns in Python for
concise readability, the corresponding immediate-mode concepts, widget APIs,
ID stack mechanics, clipper usage, and styling rules translate directly 1-to-1
to C++. Guidelines apply both to core Dear ImGui and extension libraries, most
importantly ImPlot.
**Dear ImGui everywhere (C++ studio/ux/ for all viewers, Python for
Python-only — no HTML/JS overlays)**: Built-in Studio UI that must be shared
across every Studio viewer (desktop C++ Studio, MuJoCo Live WASM, and both
Python viewers) belongs in shared C++ Dear ImGui under studio/ux/. For
Python-only UIs (NativeViewer + WebViewer), use a Python Dear ImGui
ViewerPlugin—which is also a great way to iterate with --hot_reload before
porting to C++ studio/ux/ for all viewers. Do not replace or mirror Dear
ImGui panels with HTML/CSS/JS overlays or parallel JSON WebSocket UI channels
in WebViewer; WebViewer streams Dear ImGui draw lists over /ui so
built-in panels and custom ViewerPlugin UIs work uniformly in the browser.

1. Naming Conventions: build_gui vs render / draw

ImGui code does not render pixels to the screen directly. Instead, calling ImGui functions builds and records draw command lists (vertex buffers, index buffers, clip rects, and texture references) that are processed, rasterized, and rendered later in the frame pipeline (via OpenGL, Vulkan, or WebGL/WebViewer).

  • Use `build_gui()` or `build_xxx_gui()` (in Python) or BuildGui() /

BuildXxxGui() (in C++) for all functions and methods that submit ImGui widgets (e.g., build_control_panel_gui(), BuildControlPanelGui()).

  • Avoid `render()` or `draw()` for UI layout functions. Reserve render /

draw strictly for low-level graphics backend operations (such as ImGui_ImplOpenGL3_RenderDrawData).

python
# Good: Accurately describes building the frame's UI hierarchy
def build_gui(self) -> None:
self.build_header_gui()
self.build_table_gui()
# Avoid: Suggests immediate rasterization/rendering
def draw_ui(self):
...

2. Decoupling GUI from Application Logic

GUI code must strictly handle user layout, presentation, and input forwarding. The GUI is intended solely to glue the underlying logic together, and that glue layer should be as small and thin as possible. Never mix business logic, network/RPC queries, file operations, or simulation steps directly into frame build functions.

  • Minimal Glue Layer: The GUI component should do little more than bind

user inputs to underlying library calls and render current state.

  • Separate Libraries: Core business logic belongs in a standalone library

or module (e.g., inspector_lib.py vs inspector_gui.py).

  • Asynchronous Execution: Expensive operations (RPCs, subprocesses, large

searches) must run on worker threads/tasks, with GUI code reading cached state or progress flags.

  • Testability: Decoupled libraries can be thoroughly tested via standard

unit tests without requiring an active ImGui context or window.

3. Custom Widgets: Immediate Mode Pure Functions

Custom widgets should remain lightweight, immediate-mode pure functions:

  • Pure Immediate Mode: Pass inputs as arguments, return output or mutation

tuples (e.g., changed, new_val = dial_widget(...)). Avoid heavy stateful framework abstractions.

  • Avoid Per-Widget Persistent State: Storing state across frames inside a

widget incurs a maintenance burden and limits reusability across arbitrary contexts. Keep widgets stateless whenever possible; if state is essential, store it in the parent application state rather than inside the widget.

  • UX Customizations & Libraries: Tailored visual controls (e.g., dial

knobs, meters) are encouraged when they enhance UX. Instead of importing large external dependencies, copy and refactor small, focused snippets (must be MIT-licensed) into clean immediate-mode functions. In MuJoCo, shared custom ImGui widget functionality lives in the imgui_widgets.h/cc files in the Studio UX module.

  • Test Engine Readiness: Expose interaction endpoints and bounding boxes

using Dear ImGui Test Engine hooks/macros so automated test drivers can interact with custom controls.

  • Check Upstream & Changelog Before Implementing: Before writing a new

custom widget, layout behavior, or feature from scratch:

  • Check the latest upstream changelog for the docking branch at

https://github.com/ocornut/imgui/blob/docking/docs/CHANGELOG.txt and inspect what has changed relative to the vendored version in MuJoCo.

  • Search Dear ImGui GitHub issues

(https://github.com/ocornut/imgui/issues) and the Wiki (https://github.com/ocornut/imgui/wiki) for existing solutions, standard snippets, or discussions on the topic.

  • Check Local vs Upstream (Update Dependency): In general, check both

the local checked-out code and the latest code on GitHub. If the feature, widget, or bugfix already exists in a newer upstream release, the cleaner solution is often to update the vendored dependency rather than maintaining custom workarounds in application code.

4. Disallowing Obsolete Functions & Internal Headers

ImGui maintains a stable public API and clearly documents deprecations:

  • Ban Obsolete Functions: Always define IMGUI_DISABLE_OBSOLETE_FUNCTIONS

(and IMGUI_DISABLE_OBSOLETE_KEYIO) during builds and framework updates to prevent deprecated patterns from lingering in the codebase.

  • Public API Stability: Rely on the official public API (imgui.h). Avoid

including internal headers (imgui_internal.h) in application and tool code unless implementing foundational backend extensions.

5. Performance & Virtualization: ImGuiListClipper

When rendering lists, tables, or log views that may contain many items (e.g., 100+ bodies, simulation trajectories, log buffers):

  • Always Virtualize with `ImGuiListClipper` / `imgui.ListClipper`:

Without clipping, ImGui generates vertices and text layouts for every item in the list even when offscreen. In remote streaming backends (WebViewer), unclipped tables saturate the WebSocket stream. In C++, use ImGuiListClipper clipper; clipper.Begin(...); in Python, use clipper = imgui.ListClipper(); clipper.Begin(...).

  • Clipper Usage: The clipper calculates the visible range and only submits

the items currently in view.

python
if imgui.BeginTable('ItemsTable', 1):
clipper = imgui.ListClipper()
clipper.Begin(len(items))
while clipper.Step():
for i in range(clipper.DisplayStart, clipper.DisplayEnd):
imgui.TableNextRow()
imgui.TableNextColumn()
imgui.TextUnformatted(items[i].name)
imgui.EndTable()
  • Memory & Lifetime (`imgui.TextUnformatted`): Use imgui.TextUnformatted

when displaying large or read-only text strings to avoid string copy and formatting overhead in Python bindings.

6. Runtime IDs, the ID Stack, and Test Automation (## vs ###)

Dear ImGui identifies widgets by hashing their label text against the current ID stack seed (ImGuiWindow::GetID calling ImHashStr in imgui.cpp). Understanding the string operators ## and ### is critical for avoiding ID collisions, maintaining state across dynamic label changes, and writing automatable UIs.

Technical Mechanics: ## vs ###

Both operators rely on Dear ImGui's internal text-rendering and hashing routines:

  • Display Boundary (`FindRenderedTextEnd`): Text rendering stops at the

first occurrence of ##. Because ### also begins with ##, any characters following either `##` or `###` are hidden from the user.

  • Hidden Disambiguator (`##`):
  • ImHashStr hashes the entire string ("Label##Suffix"), including

both the visible label and the hidden suffix.

  • Purpose: Disambiguating widgets that share the same visible label

within the same ID scope (e.g., multiple "Delete" buttons or repeating row entries).

  • Why `Selectable(f'{body_name}##body_row_{i}')` uses `##`: The

visible label is body_name, but lists may contain duplicate body names or repeating entries. Appending ##body_row_{i} hashes the full string "{body_name}##body_row_{i}", producing a unique ID while keeping only body_name visible on screen. (Alternatively, wrap row rendering in imgui.PushID(i) / imgui.PopID()). If ### were used here instead, body_name would be discarded completely from the hash.

  • ID Override / Seed Reset (`###`):
  • ImHashStr specifically detects three # characters (###). When

encountered, it resets the hash seed back to the initial seed (crc = seed) and hashes only the substring following ###. Any preceding visible text is completely discarded from the hash.

  • Dynamic Labels: When visible text changes across frames (e.g.,

f'Items ({count})###ItemCounterBtn' or animated frame titles), ### guarantees that the widget's internal ID remains constant. This preserves active focus, hover state, window docking positions, and collapse states.

  • Semantically Meaningful Names for Automation: For icon-only buttons

(e.g., f'{ICON_FA_PLAY}###PlayButton', where ICON_FA_PLAY = '\uf04b'), the icon glyph itself is constant across frames and would technically produce a stable hash even without ###. However, without ###PlayButton, the resulting ID is derived from an opaque unicode codepoint. Using ###PlayButton assigns a human-readable, semantically meaningful identifier that facilitates agent-driven Dear ImGui Test Engine UI automation and computer control to reliably locate, inspect, and click the control by name ("PlayButton").

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
17,981
Repository forks
2,200
7-day trend score
48

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/google-deepmind/mujoco/gui/badge)](https://verified-skill.com/skills/google-deepmind/mujoco/gui)

Something wrong with this skill or its page? Tell us.