Iago
Generate a concise Mermaid diagram that explains the important logic in a PR diff, then either print an idempotent iago block locally or update the PR comment/body when the user explicitly wants it published.
Iago is for review communication, not for finding new review issues. Run a normal review first when the code has not been inspected.
Inputs
- Optional diagram type:
flow, sequence, class, or entity-relation.
- Optional PR number or URL. If absent, resolve the current branch PR with
gh pr view --json number,url,headRefName,baseRefName.
- Optional publish mode. If the user did not explicitly ask to post/update GitHub, output the block locally only.
Workflow
- Resolve PR context.
- Prefer
gh pr diff <pr> for the reviewed diff.
- Also read relevant changed files when the diff alone is not enough.
- Pick the diagram type.
flowchart TD for branching logic, save guards, validation paths, and state transitions.
sequenceDiagram for BE to FE contracts, request lifecycles, async calls, and event chains.
classDiagram for object/model relationships.
erDiagram for database entities.
- Honor an explicit type from
/iago <type> or /squawk <type>.
- Generate one small diagram.
- Show only review-relevant logic.
- Use stable node names and short labels.
- Avoid dumping every changed file into the diagram.
- Wrap the result in the idempotent block:
<!-- iago:begin -->
```mermaid
flowchart TD
A["Important change"] --> B["Review-relevant outcome"]
```
<!-- iago:end -->
- Validate the Mermaid syntax by inspection. Prefer simpler syntax over clever formatting.
- Publish only when requested.
Publishing
Use gh CLI, not GitHub MCP, for GitHub writes.
When publishing:
- Read existing PR body and issue comments.
- If an
<!-- iago:begin --> / <!-- iago:end --> block already exists, replace only that block.
- If no block exists, create a new top-level PR comment with the block.
- Do not create duplicate iago comments.
Suggested commands:
gh pr view <pr> --json number,url,body,comments
gh pr comment <pr> --body-file <file>
gh api repos/:owner/:repo/issues/comments/<comment_id> --method PATCH --field body=@<file>
Safety
- Do not post automatically to a team PR unless the user asked to publish.
- Do not use GitHub MCP comment tools for this skill.
- If repo instructions ban automated GitHub comments broadly, print the block locally and ask before publishing.
- Keep the diagram explanatory, not decorative.
1---2name: iago3description: Use when generating or updating a Mermaid diagram for a GitHub pull request review, especially after reviewing a diff and needing to explain control flow, sequence, classes, or entity relationships. Triggered by: iago, /iago, /squawk, generate PR diagram, add Mermaid diagram to PR, or visualize this review.4license: MIT5---67# Iago89Generate a concise Mermaid diagram that explains the important logic in a PR diff, then either print an idempotent `iago` block locally or update the PR comment/body when the user explicitly wants it published.1011Iago is for review communication, not for finding new review issues. Run a normal review first when the code has not been inspected.1213## Inputs1415- Optional diagram type: `flow`, `sequence`, `class`, or `entity-relation`.16- Optional PR number or URL. If absent, resolve the current branch PR with `gh pr view --json number,url,headRefName,baseRefName`.17- Optional publish mode. If the user did not explicitly ask to post/update GitHub, output the block locally only.1819## Workflow20211. Resolve PR context.22 - Prefer `gh pr diff <pr>` for the reviewed diff.23 - Also read relevant changed files when the diff alone is not enough.242. Pick the diagram type.25 - `flowchart TD` for branching logic, save guards, validation paths, and state transitions.26 - `sequenceDiagram` for BE to FE contracts, request lifecycles, async calls, and event chains.27 - `classDiagram` for object/model relationships.28 - `erDiagram` for database entities.29 - Honor an explicit type from `/iago <type>` or `/squawk <type>`.303. Generate one small diagram.31 - Show only review-relevant logic.32 - Use stable node names and short labels.33 - Avoid dumping every changed file into the diagram.344. Wrap the result in the idempotent block:3536````markdown37<!-- iago:begin -->38```mermaid39flowchart TD40 A["Important change"] --> B["Review-relevant outcome"]41```42<!-- iago:end -->43````44455. Validate the Mermaid syntax by inspection. Prefer simpler syntax over clever formatting.466. Publish only when requested.4748## Publishing4950Use `gh` CLI, not GitHub MCP, for GitHub writes.5152When publishing:53541. Read existing PR body and issue comments.552. If an `<!-- iago:begin -->` / `<!-- iago:end -->` block already exists, replace only that block.563. If no block exists, create a new top-level PR comment with the block.574. Do not create duplicate iago comments.5859Suggested commands:6061```bash62gh pr view <pr> --json number,url,body,comments63gh pr comment <pr> --body-file <file>64gh api repos/:owner/:repo/issues/comments/<comment_id> --method PATCH --field body=@<file>65```6667## Safety6869- Do not post automatically to a team PR unless the user asked to publish.70- Do not use GitHub MCP comment tools for this skill.71- If repo instructions ban automated GitHub comments broadly, print the block locally and ask before publishing.72- Keep the diagram explanatory, not decorative.