Skip to content

improve architecture skill writes mermaid diagrams that fail to parse when an arrow label contains a . #1256

Open

Description

@vladdu

Skill

improve-codebase-architecture

Harness and version

Claude Code 2.1.296, installed as plugin, version 1.3.1

Model and effort

Opus 5.5, medium efort

What happened

The HTML architecture review produced by the improve architecture skill had a diagram that would not draw. The first diagram in item 1 showed a mermaid syntax error. The other diagrams on the page drew fine.

Cause
The skill wrote a dotted arrow whose label contains a period:

S -.walks variable.pending.-> FV[(FormalVariable)]

In mermaid, the label on a dotted arrow (-. text .->) ends at the first .. Here it ends after variable, and mermaid can't read the rest of the line:

Lexical error on line 2. Unrecognized text.
...  S -.walks variable.pending.-> FV[(Form
-----------------------^

What you expected

Have the skill always write arrow labels as -->|"..."| / -.->|"..."|. Code reviews often put dotted names like obj.attr or module.func in labels, so the inline -. text .-> form will keep breaking. Better still, have the skill run its diagrams through mermaid.parse before writing the file.

Activity

  1. lab1207 commented on Oct 12, 2026

    @lab1207

    Confirmed from the source, and the skill itself teaches the fragile form. The fix belongs in one place: the "Mermaid graph" section of skills/engineering/improve-codebase-architecture/HTML-REPORT.md (checked at main 49dd158).

    Do this: in that section, after the flowchart example, add a label rule:

    Always quote edge labels with the pipe form (`-->|"..."|`, `-.->|"..."|`).
    Never use bare inline text (`-. text .->`) when the label contains a period.

    So the section's own example line 71, C -.leak.-> D[PricingClient], becomes C -.->|"leak"| D[PricingClient].

    Why this is the whole story: line 71 is the pattern agents copy, and it renders only because leak has no period in it. Mermaid ends an inline dotted label at the first period, so walks variable.pending. truncates the label and the rest of the line is unparseable, which is exactly the lexical error you pasted. Code-review labels are full of dotted names (obj.attr, module.func), so the inline form will keep breaking on every review that names one.

    Confirm: re-run the skill on the same repo and open the report HTML; the item 1 diagram should draw with no syntax error. If any other arrow form breaks, paste the line and I will look at that one too.

    Two caveats. The report pins Mermaid v11 (HTML-REPORT.md:15), so this is verified against that version's flowchart syntax; sequence-diagram messages (A->>B: text) use a different grammar and are unaffected. And your mermaid.parse pre-write idea would catch everything, but it needs Node plus Mermaid in the agent environment, so the quoting rule is the minimal fix that covers every label.

  2. mattpocock commented on Oct 12, 2026

    @mattpocock
    Owner

    This was generated by AI during triage.

    Agent brief: in skills/engineering/improve-codebase-architecture/HTML-REPORT.md, the Mermaid graph example uses the inline dotted-label form (C -.leak.-> D), which agents copy; Mermaid ends that label at the first period, so a dotted name like variable.pending breaks the diagram. Change the example to the pipe form (C -.->|"leak"| D) and add one rule: always write edge labels as -->|"..."| or -.->|"..."|.

  3. added
    ready-for-agentFully specified, ready for an AFK agent
    and removed
    needs-triageMaintainer needs to evaluate
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions