Figma Layer Rename (Lite)
Ver: ver.202608081524
Detect auto-generated layer names and undifferentiated duplicate sibling names anywhere in the selected frame's tree, and propose semantic replacements. This is a read-only check-and-report skill — it never renames anything in the file.
Output language: Respond in the same language the user is using in this conversation.
Environment: This edition runs inside Figma's agent environment. The target comes from the current canvas selection, and all reads go through the Plugin API script execution tool (e.g. evaluate_script). No URLs, no external tools.
Why this exists
The value of figma-layer-rename is visible the moment the proposal table appears — a Frame 12 next to its proposed HeroSection makes the case for itself, before anything is actually renamed. This lite edition stops right there: it runs both detection passes and shows the full proposal table, but never touches the file. For confirmation-gated apply (and to actually clean up the file), use the full figma-layer-rename skill.
Scope
Two categories of issue, both always run — since nothing is written, there's no reason to gate either behind a confirmation question:
- Auto-generated layer names —
Frame N,Group N,Rectangle N, etc. (Step 2). - Duplicate generic sibling names — e.g. four different sections all literally named
Section. Real names, but useless for telling siblings apart (Step 2.5).
Nothing else. No variable binding, no auto-layout changes, no property changes, no renaming.
Target node types: FRAME or SECTION only. If the selection is a COMPONENT, COMPONENT_SET, or anything else, tell the user this skill only handles frames and sections, and ask them to select one.
Skip INSTANCE subtrees entirely. An override proposal inside an instance would only ever apply as a local override diverging from the main component — not useful even as a suggestion. When walking the tree, if a node's type is INSTANCE, skip it and all descendants.
Treat icon-glyph containers as a single leaf — don't descend into their vector paths. A container whose children are all primitive path/shape nodes (VECTOR, BOOLEAN_OPERATION, STAR, ELLIPSE, RECTANGLE, LINE), with no text nodes and no further nested containers, is almost always one icon glyph assembled from multiple paths. Propose a name for the container itself if its name is auto-generated (per Step 2's regex), then stop there: don't inspect or propose names for its child paths individually.
Step 1: Resolve the target
Use the current canvas selection — its id and type are typically provided directly. If nothing is selected, ask the user to select the target frame or section on the canvas.
Check the type: FRAME or SECTION → continue; anything else → ask for a frame/section selection (see Scope).
Step 2: Detect auto-generated layer names
Fetch the tree via the script tool (walk children recursively from the root, collecting id, type, name; do not descend into INSTANCE nodes). Then check each node's name against:
/^(Frame|Group|Rectangle|Ellipse|Vector|Polygon|Star|Line|Arrow|Boolean|Component|Instance)(\s+\d+)?$/iThe trailing number is optional: files often contain bare default names like Frame or Ellipse with no number — typically zero-size spacer frames or plain ellipses used as bullet dots. These should be proposed too (e.g. a 10px-wide empty frame between two text nodes → Spacer; a small ellipse next to a list item → BulletDot).
For each match, infer a semantic name from:
- Node type and its position in the tree (root container, header, icon slot, divider, footer, ...)
- Sibling and parent context (a
Rectangleright below aCard→Divider; aGroupnext to aNavat the top →Logo) - Children content (a
Groupcontaining only text nodes →LabelGroup; aFramewith an image and a heading →HeroContent)
Naming convention: Don't invent a casing style — match the prevailing convention of the semantic layer names already in the file (hero-section → kebab-case, Hero Section → spaced Title Case, ...). If there's no clear precedent, default to PascalCase (HeroSection).
Populate a proposal list: { nodeId, currentName, proposedName, reason: "Auto-generated name" }.
Step 2.5: Duplicate generic sibling names
A name like Section or Container is real and semantic, so Step 2 leaves it alone — but when the same name repeats across siblings that are actually different things, it stops being useful. Always run this at a fixed depth of 4 (down 4 levels from the root) — shallow depths like 1–2 miss most real duplicates in a typical multi-section page, since Container/Section collisions are just as common 3–4 levels down as at the top (a wrapper for padding, a wrapper for a grid, then the actual repeated siblings). The full figma-layer-rename skill lets you choose this depth; the lite edition fixes it at 4 so the pass runs with no question asked.
Wrapper collapse (Code to Canvas files only): if any node name matches /:(margin|padding)$/ and has exactly one child, treat that wrapper as transparent when counting depth and grouping siblings (recursively). If no such names exist in the tree, skip this rule.
At depth 4, group nodes by parent, then by name; any name shared by 2+ siblings under the same parent is a candidate. At this depth, scrutinize before flagging: repeated card/list/icon-slot patterns get more common the deeper you go, and renaming those would hurt rather than help. Only flag duplicates where the siblings represent structurally or contextually different content that happens to share a generic name — leave intentional repetition (same-shaped cards, rows, icon slots) alone. Infer semantic names using the same reasoning as Step 2, and tag the reason as "Duplicate-name disambiguation" so the report can distinguish the two categories.
If none are found at this depth, this pass simply contributes nothing to the table — no need to say so explicitly.
Step 3: Report
If no candidates at all from either pass:
✅ No auto-generated layer names or hard-to-distinguish duplicate names were found.
All layers already have meaningful names.Then stop.
Otherwise, present everything in one table, sorted by tree order:
| # | Node ID | Current name | Proposed name | Reason |
|---|---|---|---|---|
| 1 | 123:456 | Frame 12 | HeroSection | Auto-generated name |
| 2 | 123:789 | Group 4 | LabelGroup | Auto-generated name |
| 3 | 234:111 | Section | PricingSection | Duplicate-name disambiguation |
| 4 | 234:222 | Section | FaqSection | Duplicate-name disambiguation |
Total: N suggestion(s) (N auto-generated name / N duplicate-name disambiguation)
This is a proposal only — no changes have been made to the file. If you'd like to actually apply these renames, run the full figma-layer-rename skill.
Error handling
- No selection, or selection is not FRAME/SECTION: ask the user to select a frame or section
- Script execution error: report it and ask the user to retry (the file may have been edited mid-scan)
- Very large trees: if a single walk is too slow or errors, walk top-level sections one at a time and merge results before reporting