AI Power Tools for Sparx EA Docs Release 3.6.4

Tidy and style a diagram

Goal

Take a diagram that already exists, whether auto-laid-out or hand-placed, and make it read as deliberate: align and size it, route its connectors, set its colors and line styles, control what labels show, collapse parallel connectors for a summary view, and fix stacking. For an architect. You end with the same diagram, with the same model content, redrawn so that it reads clearly, an executive version if wanted, and every change confirmed by a render.

Where it runs

This scenario needs the MCP server. Computer use covers its UI steps.

Surface How it runs
Claude Code Fully
Claude Cowork Fully
Claude Desktop chat Fully, except the UI steps, which you perform: starting EA and opening the model, and dismissing any dialog EA raises (you paste a screenshot of it into the conversation first).
VS Code with GitHub Copilot Fully, except the UI steps, which you perform: starting EA and opening the model, and dismissing any dialog EA raises (you paste a screenshot of it into the conversation first).

Before you start

  • The start-of-session check done.
  • The diagram's id. The AI finds it by name or by listing the package.
  • Agreement on what "better" means: align, resize, route, color, summarize, or all of these.
  • Optionally, a baseline of the package. These edits are per diagram and reversible, and a baseline is cheap insurance.

Compose a diagram builds a diagram from nothing. This scenario starts from a diagram that exists. It uses the diagram operations directly, with the judgment from ea-diagram-composition and the build conventions of ea-modeling. Everything here is per diagram: other diagrams that show the same elements are untouched. The exception is one operation, set_element_appearance, which is model-wide, and the scenario flags it.

The thing to say first: tidying does not invent an arrangement. Elements that are nowhere near aligned stay where they are, because guessing which of them were meant to line up is the judgment these operations refuse to make.

Steps

  1. AI with computer use; otherwise you If EA is not running or the model is not open, start EA and open it. AI Power Tools ea-diagram-composition inspects the diagram as it is (verify_diagram, get_diagram_display).
  2. You Decide the target size, then ea-diagram-composition gives each role one size (resize_diagram_objects). Uniform sizing within a role is not cosmetic: a reader takes a bigger box to mean a more important thing, so peers at four sizes make a claim nobody intended. The size matched is the one most elements already are by default, the largest (nothing has to shrink) or the smallest (the most compact, at the risk of clipping). Each element keeps its top-left corner, so a row stays a row. A selection narrows it: elements outside it are never moved.
  3. AI Power Tools ea-diagram-composition aligns near-aligned elements (neaten_diagram_objects). A tolerance (default 12 units) is how far apart two edges may be and still count as one intended line. Raise it for a diagram that drifted badly, and lower it if it pulls together things you meant apart. An option also evens the gaps within each aligned row, off by default because evening a row someone spaced deliberately is a larger change. Neither operation resizes anything, and connectors follow their elements. These two are AI Power Tools' own implementations, not calls into EA's Neaten and Box menu commands: EA's automation does not expose those.
  4. AI Power Tools ea-diagram-composition routes the connectors (set_diagram_link, set_diagram_links_bulk, after adding the missing ones to the link layer). The routes are EA's own line styles: Direct, Auto Routing, Custom Line, Bezier, Tree Vertical, Tree Horizontal, Lateral Vertical, Lateral Horizontal, Orthogonal Square and Orthogonal Rounded. Color, width, hidden labels and similar settings are also accepted, and anything omitted is left alone. A connector EA merely draws, with no stored link, is reported as not stored. Add it to the link layer first. Where a line is genuinely missing, look at whether both endpoints are on the diagram.
  5. You Decide the palette, then ea-diagram-composition sets colors, borders and fonts for this diagram (set_diagram_object_appearance and its bulk form). It affects one placement on one diagram. set_element_appearance changes the element on every diagram it appears on. Ask before using it to fix one view. If an element was colored through EA's own dialog, color rules are reported not to see it.
  6. AI Power Tools ea-diagram-composition sets shape, opacity and text alignment (set_custom_style and its bulk form). Custom Style sets how a placement is drawn: shape, opacity, text alignment, rotation, border style and stacking. A value EA does not recognize is refused, and passing default resets a lever. It works only on placements that already carry a drawing identifier, and placements created by AI Power Tools carry none, so expect a refusal on placements the AI made.
  7. AI Power Tools ea-diagram-composition fixes stacking (set_diagram_object, sequence). Lower is nearer the front. A filled container needs a higher number than its contents.
  8. You For an executive view, decide what the diagram shows, then ea-diagram-composition sets it (set_diagram_display): connector labels, element and connector stereotypes, relationships, hand-drawn style, attribute and operation detail, element notes, canvas size, scale, orientation, visibility of private, protected and public members, package contents and imports. Every named flag was verified by rendering. Omitted settings are left alone, and passing false turns one off. Compartments cannot be removed from a drawn element, only reduced to names.
  9. You Review the dry run. For a summary or executive view, collapse_parallel_connectors hides duplicate connectors between the same pair of elements, so the relationship reads as one line. It is a dry run by default: it reports exactly what would be hidden and changes nothing.
  10. You Approve applying the collapse, which hides things from the reader, and place the annotation (collapse_parallel_connectors with apply on).
  11. You Look at the render. ea-diagram-composition re-verifies with the SVG, to check what EA actually drew.

The collapse rules exist to keep the result honest.

  • It groups by unordered pair, so A to B and B to A are one group.
  • It collapses only when direction agrees. A group with both directions is left alone and reported as kept bidirectional, because hiding one would say the relationship runs one way when it runs both.
  • Where connector types differ, it keeps one representative and names every type in the group.
  • It always returns the annotation text the caller must place, because a collapse without that annotation is a misleading diagram. The operation does not draw it: you decide where it belongs.

Nothing in the model changes. The collapse hides the diagram's link rows only. expand_parallel_connectors reverses it, as does setting a connector's hidden option off.

Prompts to use

Opening

Follow-ups

Steps 2 and 3, with the row-evening option on.

Model Fit Why
Claude Fable 5.1 Recommended Judging what reads well, and what to leave out
Claude Opus 5.5 Recommended The same
Claude Sonnet 5.5 Capable Applies the operations reliably. Review the result visually
Claude Haiku 4.5 Capable Suited to applying a fully specified set of changes. Not for deciding them

Ratings are guidance based on the kind of reasoning the skill needs, not measured benchmarks.

Checking the result

  • Accurate. After each change, the render shows what was asked: sizes equal within a role, edges on common lines, the requested routes, the colors in the SVG, and the labels hidden or shown as asked. A collapsed pair shows one line, and the annotation is on the canvas.
  • Complete. The same elements and connectors are on the diagram as before. The report lists connectors that could not be styled, placements that refused Custom Style, and everything the collapse hid, including the types in each group and any kept bidirectional pairs.
  • Nothing unintended changed. The model is unchanged: comparing it with the baseline shows no difference in content. Other diagrams that show the same elements look as they did. In particular, set_element_appearance was not used without your agreement.

Variations

  • An executive or summary view. Steps 8 to 10 only, on a copy of the diagram.
  • After an EA automatic layout. Run steps 2 and 3 first, then route.
  • After composition. Compose a diagram already sets most of this. Use this scenario to fix what the lint pass found.
  • A consistent palette across diagrams. Use the bulk appearance operation per diagram, with one agreed palette and a legend if color carries meaning.

Limitations

  • Compartments cannot be removed, only reduced to names. The suppressed-compartments setting does not work.
  • Radial diagrams use straight or Bezier lines.
  • A color you set through EA's own dialog is reported to be invisible to color rules.
  • Reading a connector and writing it back can change the line EA draws. Re-render after any connector write.
  • Custom Style needs a drawing identifier. Placements created by AI Power Tools have none.
  • A color read back proves nothing. Render, and read the SVG.
  • Collapsing hides information from the reader. Place the annotation, and keep the dry-run output with the diagram's notes.
  • EA grows a box to fit an unbreakable name while the stored rectangle keeps its size. Resize and neaten act on stored rectangles.