kdl-to-python-schematic
Skill553 starsChanged 5 months agoApache-2.0View on GitHub
Migrate Elodin KDL schematics to typed Python elodin.ui builders, validate model and visual parity, and refactor generated scaffolds safely. Use when converting .kdl files, adopting Python-authored schematics, or troubleshooting elodin schematic to-python output.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bevySkill
- branch-regressionSkill
- elodin-alephSkill
- elodin-craneliftSkill
- elodin-dbSkill
- elodin-devSkill
- elodin-editor-devSkill
- elodin-headless-captureSkill
- elodin-monte-carloSkill
- elodin-nixSkill
- elodin-simulationSkill
- elodin-tracySkill
- gltf-asset-optimizationSkill
- nox-py-devSkill
- qa-test-planSkill
- rustSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 9 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Read the migration guide before making changes.
- Very specific: line 21
Use uv for every Python command.
- Very specific: line 22
Run just install before testing so the CLI and Python extension match.
- Very specific: line 24
Keep build() deterministic and side-effect-light.
- Distinctive: line 27
Do not redesign and migrate in the same step.
- Very specific: line 28
Do not replace generated builders with embedded KDL or ui.from_kdl.
- Very specific: line 29
Prefer --schematic; --kdl is deprecated.
- Distinctive: line 39
Check whether the schematic contains display kernels or whether the migration is expected to introduce them.
- Distinctive: line 44
Keep the Python file beside the KDL initially:
- Distinctive: line 57
Run the entry point:
- Distinctive: line 81
When equality fails, isolate top-level sections in this order:
- Distinctive: line 114
If the entry point imports sibling modules, verify imports and touch the watched entry point after changing a sibling if the watcher does …
- Very specific: line 124
Use ui.Schema when tensor shape and type matter.
- Very specific: line 125
Add @ui.kernel only when a display transformation needs typed JAX math.
- Distinctive: line 142
Update launch commands, examples, and documentation to use the Python path.
- Distinctive: line 143
Verify relative assets from the real launch environment.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
KDL to Python schematic migration
Convert an existing KDL schematic without silently changing its model or visual behavior. Establish parity before improving the generated Python.
Read the migration guide
before making changes. Use
examples/ball/schematic.py for basic
builders and
examples/display-kernels/schematic.py
for expressions, schemas, and display kernels.
Rules
- Work from the repository root in
nix develop. - Use
uvfor every Python command. - Run
just installbefore testing so the CLI and Python extension match. - Preserve the source KDL until the user explicitly approves deletion.
- Keep
build()deterministic and side-effect-light. - Preserve asset paths, ordering, names, queries, colors, and layout structure during the initial conversion.
- Do not redesign and migrate in the same step.
- Do not replace generated builders with embedded KDL or
ui.from_kdl. - Prefer
--schematic;--kdlis deprecated.
Workflow
1. Inventory
Locate the root KDL, referenced KDL documents, relative assets, launch commands, and saved layout behavior. Record which database or simulation target can exercise representative live data.
Check whether the schematic contains display kernels or whether the migration is expected to introduce them. Kernel validation requires more than emitted KDL.
2. Generate
Keep the Python file beside the KDL initially:
elodin schematic to-python path/to/schematic.kdl \
--output path/to/schematic.pyInspect the generated module. It must import elodin.ui, define
build() -> ui.Schematic, return ui.schematic(...), and retain its executable
emit_kdl() block.
3. Validate the scaffold
Run the entry point:
uv run python path/to/schematic.py > /tmp/schematic.generated.kdlCompare canonical models in Python:
from pathlib import Path
import elodin.ui as ui
from schematic import build
def canonical(schematic: ui.Schematic) -> ui.Schematic:
return ui.from_kdl(schematic.emit_kdl())
source = ui.from_kdl(Path("schematic.kdl").read_text())
assert canonical(build()) == canonical(source)When equality fails, isolate top-level sections in this order:
- Root options.
- Layout and tabs.
- Views and their properties.
- Scene objects.
- Styling and colors.
Compare parsed models, not only raw KDL text.
4. Validate runtime behavior
Preload the schematic:
elodin editor <target> --schematic path/to/schematic.pyThen exercise live updates:
elodin ui watch path/to/schematic.py --db 127.0.0.1:2240Capture the same representative state with the KDL and Python versions. Compare:
- Tabs, splits, active view, and panel sizing.
- Graph series, ranges, labels, and colors.
- Viewport objects, transforms, visibility, and assets.
- Lines, trails, arrows, coordinates, and world geometry.
- Runtime queries, warnings, and build diagnostics.
- Saved layout overlay behavior.
If the entry point imports sibling modules, verify imports and touch the watched entry point after changing a sibling if the watcher does not rebuild.
5. Refactor incrementally
Only after parity:
- Extract small helpers.
- Replace repeated builders with comprehensions or loops.
- Compose query strings with
ui.Expr. - Use
ui.Schemawhen tensor shape and type matter. - Add
@ui.kernelonly when a display transformation needs typed JAX math.
Re-run canonical and visual comparisons after each logical refactor. Keep intentional redesigns separate and document their expected differences.
6. Validate kernels and overlays
Plain emit_kdl() parity does not validate display-kernel sidecars. Test kernels
through elodin ui watch or an explicit Python publish/write flow using the
actual component shapes and primitive types.
The editor's Save Layout action writes an overlay KDL; it does not edit Python. Confirm that the watcher reapplies the active overlay. Copy desired default layout changes into Python manually.
7. Cut over
Update launch commands, examples, and documentation to use the Python path. Verify relative assets from the real launch environment. Retain the KDL as a rollback until all consumers have switched and the user approves removal.
Completion report
Report:
- Files converted and files intentionally retained.
- Canonical equality result and any intentional model differences.
- Runtime target and visual states tested.
- Asset, overlay, watcher, and kernel results.
- Refactors performed after parity.
- Commands run and remaining risks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

