/atopile-dev:layout-relinkingfrom atopile-dev
Rewrites atopile_address properties in KiCad PCB files to preserve footprint placements after renaming or refactoring components in .ato source files. Prevents lost placements and orphaned layouts.
Ships in atopile-dev. 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.
None: SKILL.md is the whole skill.
When you rename a component in .ato code, its atopile_address in the .kicad_pcb becomes stale. On the next build, atopile can no longer match the placed footprint to the renamed component, so the component loses its placement (moved to origin, unrouted).
Critical: relink BEFORE building. If you build with stale addresses, atopile orphans the old placements and creates new unplaced footprints. Relinking after that means recovering from backups.
Each footprint in the .kicad_pcb carries an atopile_address property — the dot-path of instance names from the build entry point down to that component. If Board has charger = new BQ25756Charger and BQ25756Charger has _richg = new Resistor, the address is charger._richg. Renaming any instance in that chain changes the address; relinking rewrites the stored address to match the new path so the placement is preserved.
This workflow relies on two small scripts that operate on the .kicad_pcb. Many projects vendor them under tools/; if yours doesn't, they're trivial to write (parse the s-expression / KiCad file, read or rewrite the atopile_address property on each footprint):
atopile_address in a .kicad_pcb (optionally with the footprint each maps to).The commands below assume tools/layout-list-addresses.py and tools/layout-rename-address.py. Substitute your project's equivalents.
Make your .ato changes (renames, submodule extraction, etc.) — do NOT build yet.
Examine what changed:
git diff -- "*.ato"
List current PCB addresses:
python tools/layout-list-addresses.py <pcb_file>
Figure out the mapping. Construct new paths from the module hierarchy in the .ato source. The address path is the chain of instance names from the build entry point down.
Note: the LSP tools (get_hover, get_definition, get_references) do NOT provide atopile_address paths. Use git diff and the .ato source to determine mappings.
Relink each renamed component:
python tools/layout-rename-address.py <pcb_file> "old.path" "new.path"
A prefix-aware tool renames all children of a renamed parent in one call.
Now run ato build — addresses match, placements preserved.
Verify:
python tools/layout-list-addresses.py <pcb_file>
Extracting a submodule — moving charger.richg into charger._sense._shunt:
python tools/layout-rename-address.py <pcb> "charger.richg" "charger._sense._shunt"
Renaming a parent module (catches all children):
python tools/layout-rename-address.py <pcb> "charger.acov_div" "charger._acov_divider"
# Renames charger.acov_div.chain.resistors[0], [1], etc. automatically
.kicad_pcb (or rely on a tool that writes a .bak on first modification) before bulk renames — restore with cp file.bak file.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
layout-relinking, pcb-placement, atopile, kicad, component-rename, refactoring
8 skills in this plugin
/ato-languageUse when writing, reading, or reviewing .ato files. Triggers on "what interface for X", "how to connect Y", choosing between interface types, parameter constraints, tolerance syntax, or atopile design patterns./board-designUse when designing a new board or modifying board-level architecture in atopile. Triggers on new board creation, connector wiring, power rail routing, MCU peripheral assignment, or composing packages into a board./build-and-testUse when building, validating, or debugging atopile projects. Triggers on build errors, "ato build", solver failures, "no parts found", package management, creating parts from JLCPCB, or debugging connectivity issues.npx claudepluginhub mawildoer/atopile-agent-skill --plugin atopile-devOther plugins' skills for the same job