Agent skill

Legal Diagram

by lawve-ai in lawve-ai/awesome-legal-skills

A skill your agent uses when a user needs a legal or legal-adjacent Mermaid diagram from a document, pasted text, matter description, process, timeline, party map, obligation map, corporate…

MITAuto-check passedDevelopment

Install Legal Diagram

skills CLI
$ npx skills add lawve-ai/awesome-legal-skills --skill legal-diagram -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install lawve-ai/awesome-legal-skills legal-diagram --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/lawve-ai/awesome-legal-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/legal-diagram-sam-zhai .claude/skills/legal-diagram && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
legal-diagram
GitHub stars
847
Token cost
~2.6k tokens
SKILL.md length
1,117 words
Files
179 (incl. scripts, references, assets)
Skills in repo
154
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when a user needs a legal or legal-adjacent Mermaid diagram from a document, pasted text, matter description, process, timeline, party map, obligation map, corporate…

  • Works in 3 steps: Intent and first-run → Ingest before choosing a lane → GATE A: build mode (after ingestion) ⛔…
  • A user needs a legal
  • SKILL.md covers Routing gate, Scripts, Workflow loading map and Reference loading map, plus 2 more sections
  • Runs Python scripts from its folder; calls python and pip

What it does

Legal Diagram is an agent skill from lawve-ai/awesome-legal-skills. Use when a user needs a legal or legal-adjacent Mermaid diagram from a document, pasted text, matter description, process, timeline, party map, obligation map, corporate structure, funds flow, or compliance workflow. Trigger on: "diagram this contract", "visualise this deal/matter", "map the parties", "create a timeline of events", "make an org chart", "obligation checklist", "export as HTML diagram". Not for general-purpose non-legal diagrams, pure graphic design, image generation, or legal advice.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 183 other files, including scripts, reference files and assets (for example `PORTABILITY.md`, `README.md` and `references/extraction-schema.md`).

It sits in Development, covering Diagrams and Image generation. It works with Mermaid. The repository describes itself as: A curated list of awesome Agent Skills for automating legal work. The licence is MIT.

When your agent uses it

  • A user needs a legal
  • Legal-adjacent Mermaid diagram from a document
  • Matter description
  • Corporate structure

Example prompts

  • “diagram this contract”
  • “visualise this deal/matter”
  • “map the parties”
  • “/legal-diagram”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Intent and first-run
  2. Ingest before choosing a lane
  3. GATE A: build mode (after ingestion) ⛔ BLOCKING

What it can do on your machine

Read from SKILL.md and the folder at commit 045f738. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 8 files in scripts/ (Python, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • python
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Legal Diagram loads about 2.6k tokens when it runs, and up to ~3.8k if it reads all its reference files. Until then it costs about 130 tokens; SKILL.md has 1,117 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~130
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from lawve-ai/awesome-legal-skills at commit 045f738, republished under its MIT licence (© lawve-ai). 1,117 words, ~2,614 tokens.

Download SKILL.mdSave it as .claude/skills/legal-diagram/SKILL.md (or your agent's skills folder). This skill also uses 178 other files; get the full folder from GitHub.
name
legal-diagram
description
Use when a user needs a legal or legal-adjacent Mermaid diagram from a document, pasted text, matter description, process, timeline, party map, obligation map, corporate structure, funds flow, or compliance workflow. Trigger on: "diagram this contract", "visualise this deal/matter", "map the parties", "create a timeline of events", "make an org chart", "obligation checklist", "export as HTML diagram". Not for general-purpose non-legal diagrams, pure graphic design, image generation, or legal advice.
version
1.2.0
argument-hint
[file path | "pasted text" | matter description] [diagram type] [--guided] [--direct] [--html] [--tutorial]

Standalone skill: turn legal material into a context-appropriate Mermaid diagram, with an optional downloadable HTML figure. A structure-preserving Python engine extracts a typed ground truth; directive-driven LLM enrichment fills the gaps; a selector picks the diagram type; the diagram is generated natively.

Routing gate

Every real diagram request runs in this fixed order: first-run check, ingest, build-mode gate, generate, report gate. Non-diagram intents short-circuit at Step 0.

Three human gates = mandatory hard stops: GATE 0 (tutorial offer), GATE A (build mode), GATE B (HTML report). Gate discipline, no exceptions:

  • Present each as structured choice (the question tool). No such tool → numbered plain-text list. Either way, STOP, wait for reply.
  • Never skip a gate. Never infer its answer from wording. Never generate past an unanswered gate. Detailed, specific, or named-diagram request = still a request, not a gate answer.
  • Only a literal typed flag may pre-answer: --direct/--guided (GATE A), --html (GATE B), --tutorial (tutorial). Nothing else counts.
Step 0 — Intent and first-run

Check explicit short-circuits first:

  1. Tutorial signals: "tutorial", "show me how", "first time", "demo", "walk me through", --tutorial. → Load workflows/tutorial.md. Stop here.
  2. Setup signals: "check setup", "install deps", "is setup ready". → Load shared/setup-check.md, run check_setup.py, report. Stop here.

Otherwise this is a real diagram request (a file, pasted text, or a matter description). Detect first-run:

Run python scripts/first_run.py. Parse {state}: returning, first_run, or unknown. Script absent, non-zero exit, or no JSON → treat as unknown.

  • returning (confirmed) → no offer; user ran skill before. Continue to Step 1.
  • first_run, unknown, or anything not a confirmed returning → GATE 0 (hard stop): "First time here. Want a quick tutorial, or go straight to your diagram?" Options: Start tutorial (recommended, list first) / Skip, straight to my diagram. Present as structured choice, or numbered plain-text list if host has no choice tool, then STOP, wait for reply. After answer, run python scripts/first_run.py --mark to record offer (best-effort; on unknown state with no writable disk, mark may not persist, fine). Then: tutorial → load workflows/tutorial.md, stop; skip → continue to Step 1.

unknown defaults to offering, not suppressing: surface the choice, do not decide for user. Suppress only on confirmed returning. Tutorial stays reachable any time by keyword.

Step 1 — Ingest before choosing a lane

Detect input: file path, pasted text, or conversation/matter description. Load shared/setup-check.md (session-cached).

Multi-file scope gate (2+ files) ⛔: mandatory hard stop unless user already stated scope. Present as structured choice, or numbered plain-text list if host has no choice tool, then STOP, wait for reply. Options: One combined diagram / One per document. Never infer scope from wording. Store diagram_scope. Single file, or scope user explicitly stated → skip.

Run Pass 1 only (deterministic manifest, no LLM): workflows/extract.md Steps 0-2. Store the result as manifest_cache and pass it to the chosen lane so Pass 1 never re-runs. Matter-description-only input (no docs) has no Pass 1 counts; proceed without them.

Step 2 — GATE A: build mode (after ingestion) ⛔ BLOCKING

GATE A = mandatory hard stop. ALWAYS fires unless user typed a literal --direct or --guided flag. Do not load a lane and do not generate any diagram until GATE A answered.

Only a literal flag pre-answers. Sole answer-carrier = exact token --direct or --guided in user's message. Present → state resolved mode in one line ("Build mode: direct (flag)") and load the lane. User's own recorded choice, not a model decision.

Everything else → present the gate and STOP. Detailed, specific, or named-diagram request ("comprehensive diagram of this exact case", "make an org chart") = a request, NOT a gate answer. Never infer build mode from wording. Lead with what Pass 1 found, plain language: "Found [N parties, M events, ...]. How should I build it?" (omit counts for no-docs input). Present as structured choice, or numbered plain-text list if host has no choice tool, then wait for reply. Options, fixed order:

  • Guided, step by step
  • Direct, just make it

Do not reorder options, do not mark one implied from wording. Order fixed; choice is user's.

On choice: load workflows/direct.md or workflows/guided.md, passing manifest_cache, input_source, and diagram_scope. Both lanes share workflows/generation.md for the build; GATE B (HTML report) fires there.

User-facing language (casual-friendly). Never show Mermaid-internal type names to user. Use the plain-language names in shared/diagram-type-map.md § Plain-language names — "timeline", "org chart", "flowchart", "obligation checklist", and so on. Accept plain-word requests too ("make me an org chart") and map them through the same glossary. Legal vocabulary is fine; technical diagram vocabulary stays internal.

Output language (EN/FR). Gates, digest, elicitation, and rationale render in the user's prompt language (EN or FR; FR diagram names per the glossary's FR column). Extracted evidence and diagram labels stay verbatim source language, never translated. HTML export chrome follows via render_html.py --ui-lang en|fr.

Show full SKILL.md (343 more words)Show less

Scripts

All script commands run from the skill root (the folder containing this SKILL.md). Resolve the skill root once, then invoke scripts as python scripts/<name>.py.

ScriptRole
scripts/check_setup.pyDependency check → {ok, missing[], installed[], optional{}}
scripts/first_run.pyFirst-run state → {state} (returning/first_run/unknown); --mark consumes flag
scripts/extract_entities.pyOrchestrator: normalize → detect → manifest JSON
scripts/diagram_selector.pyEnriched extraction + intent → recommended type
scripts/patch_gate.pyPass 2 patch gate: validates and applies LLM JSON Patch → {ok, findings[], enriched_extraction_result}
scripts/eval_pass2.pyPass 2 eval grader: scores LLM patch against label expectations → {ok, results[], score}
scripts/render_html.pyMermaid + FigureDescription → standalone HTML

scripts/normalize/ (format adapters) and scripts/extraction/ (candidate harvesters, resolver, and materializer) are libraries used by the orchestrator. Install deps once: pip install -r requirements.txt -c constraints.txt for release-verified versions, or omit -c constraints.txt for broad compatibility testing.

Workflow loading map

Intent/NeedFile
First-run walkthrough + setup gateworkflows/tutorial.md
Interactive default lane (digest/elicit → menu)workflows/guided.md
Power-user lane (read all signals, hard cap 1)workflows/direct.md
Shared generation core (select → guard → generate → deliver)workflows/generation.md
Two-pass extraction (called by both lanes)workflows/extract.md
Pass 2 quality eval (execute enrichment, grade against labels)workflows/eval-pass2.md
No-docs intake sets + delivery patternshared/elicitation.md
Standalone HTML figure exportworkflows/html-export.md

Reference loading map

Intent/NeedFile
Dependency-check procedureshared/setup-check.md
Per-type guards, entity normalization, parser bugsshared/parser-guards.md
FigureDescription fields, captions, legends, risk rubric, caveatsshared/figure-description-schema.md
30 legal categories → Mermaid typeshared/diagram-type-map.md
Semantic node categories, palette, CSS class namingshared/node-styles.md
Field catalogue + detection tiers + signalsreferences/extraction-schema.md

Output

Output is CLI display only: the fenced Mermaid block renders as an artifact in the Claude web app and as syntax-highlighted code in the CLI. No note file is written. After the block, GATE B offers an HTML report as a selectable choice; the export escapes matter text, runs Mermaid in strict mode, uses vendored Mermaid when present, and loads the pinned CDN fallback only when explicitly enabled. Full output rules: workflows/generation.md § Step 5.

Boundaries

Mermaid is for thinking, planning, explaining, and generating structure. It is not legal advice, not a court-ready exhibit, and not a substitute for legal writing. Every diagram carries a caveat line. Confidential material stays in tools approved for that matter.

© lawve-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 178 other files (scripts, references, assets) in skills/legal-diagram-sam-zhai of lawve-ai/awesome-legal-skills.

  • SKILL.md
  • LICENSE.txt
  • PORTABILITY.md
  • README.md
  • assets/html_template.html
  • constraints.txt
  • references/extraction-schema.md
  • requirements.txt
  • scripts/check_setup.py
  • scripts/diagram_selector.py
  • scripts/eval_pass2.py
  • scripts/extract_entities.py
  • scripts/extraction/__init__.py
  • scripts/extraction/context.py
  • scripts/extraction/domain.py
  • scripts/extraction/domain/__init__.py
  • … and 163 more

Open the folder on GitHubat commit 045f738

Compare with similar skills

Legal Diagram next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Legal Diagram compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Legal Diagram this skilllawve-ai/awesome-legal-skills847—~2.6kAutomated safety check: PassMIT
Diagram to Image Convertersugarforever/01coder-agent-skills137—~1.9kAutomated safety check: PassMIT
Sf Diagram NanobananaproJaganpro/sf-skills424—~1.6kAutomated safety check: PassMIT
Gpt Image Skillfeiskyer/claude-code-settings1.7k—~1.4kAutomated safety check: PassMIT
Nanobanana Skillfeiskyer/claude-code-settings1.7k—~1.1kAutomated safety check: PassMIT
Draw.io Diagram StudioAgents365-ai/drawio-skill10k—~2.4kAutomated safety check: NotesMIT

Similar skills

  • Diagram to Image Converter

    sugarforever/01coder-agent-skills

    Converts Mermaid diagrams and markdown tables into PNG images through a hosted rendering API, for platforms without rich formatting.

    137 GitHub stars~1.9k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Sf Diagram Nanobananapro

    Jaganpro/sf-skills

    AI-powered image generation for Salesforce visuals via Nano Banana Pro.

    424 GitHub stars~1.6k tokensUpdated 5 mo ago
    Media & CreativeAuto-check passed
  • Gpt Image Skill

    feiskyer/claude-code-settings

    Generate or edit images using OpenAI GPT Image API (gpt-image-2, gpt-image-1, etc).

    1.7k GitHub stars~1.4k tokensUpdated 13 days ago
    Media & CreativeAuto-check passed
  • Nanobanana Skill

    feiskyer/claude-code-settings

    Generate or edit images via Google Gemini (nanobanana). An agent skill from feiskyer/claude-code-settings.

    1.7k GitHub stars~1.1k tokensUpdated 13 days ago
    Media & CreativeAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check: notes
  • Scientific Schematics

    spacering-net/codeg

    Create publication-quality scientific diagrams using Nano Banana 2 AI with smart iterative refinement.

    3.9k GitHub starsUsed in 11 repos~5.9k tokens
    DevelopmentAuto-check: notes

More from lawve-ai/awesome-legal-skills

All 154 skills in this repo
  • Customs Trade Law Onur Kafkas

    lawve-ai/awesome-legal-skills

    U.S. An agent skill from lawve-ai/awesome-legal-skills.

    847 GitHub stars~4.1k tokensUpdated 8 days ago
    Auto-check passed
  • Eu Data Act Oliver Schmidt Prietz

    lawve-ai/awesome-legal-skills

    Practitioner skill for advising on EU Regulation 2023/2854 (Data Act).

    847 GitHub stars~3.9k tokensUpdated 8 days ago
    Auto-check passed
  • Litigation Deadline Calendar

    lawve-ai/awesome-legal-skills

    Calendar litigation and arbitration deadlines from a scheduling order.

    847 GitHub stars~4.3k tokensUpdated 8 days ago
    Auto-check passed
  • Outlook Emails Lawvable

    lawve-ai/awesome-legal-skills

    Read, search, and download emails and attachments from Microsoft Outlook via OAuth2.

    847 GitHub stars~672 tokensUpdated 8 days ago
    Auto-check passed
  • Ambiguity Report

    lawve-ai/awesome-legal-skills

    Turn an interpretive-ambiguity audit of a legal text — contract, statute, regulation, or judicial opinion — into a polished deliverable.

    847 GitHub stars~4.6k tokensUpdated 8 days ago
    Auto-check passed
  • Az Eu Website Privacy Audit

    lawve-ai/awesome-legal-skills

    Audits a website for compliance with Azerbaijan's Law on Personal Data No.

    847 GitHub stars~3.8k tokensUpdated 8 days ago
    Auto-check passed

Works with

Questions about Legal Diagram

What does Legal Diagram do?

A skill your agent uses when a user needs a legal or legal-adjacent Mermaid diagram from a document, pasted text, matter description, process, timeline, party map, obligation map, corporate…. Legal Diagram is an agent skill from lawve-ai/awesome-legal-skills. Use when a user needs a legal or legal-adjacent Mermaid diagram from a document, pasted text, matter description, process, timeline, party map, obligation map, corporate structure, funds flow, or compliance workflow.

When should I use Legal Diagram?

Legal Diagram fits situations like: A user needs a legal; legal-adjacent Mermaid diagram from a document; matter description; corporate structure.

How do I install Legal Diagram in Claude Code?

Run `npx skills add lawve-ai/awesome-legal-skills --skill legal-diagram -a claude-code`. Or copy the skill folder (skills/legal-diagram-sam-zhai in lawve-ai/awesome-legal-skills) into .claude/skills/legal-diagram in your project. Claude Code loads it when a task matches its description.

How do I install Legal Diagram in Codex?

Run `npx skills add lawve-ai/awesome-legal-skills --skill legal-diagram -a codex`. Or copy the skill folder (skills/legal-diagram-sam-zhai in lawve-ai/awesome-legal-skills) into .agents/skills/legal-diagram in your project. Codex loads it when a task matches its description.

Can I use Legal Diagram in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add lawve-ai/awesome-legal-skills --skill legal-diagram -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/legal-diagram, .gemini/skills/legal-diagram, .github/skills/legal-diagram and .opencode/skills/legal-diagram in your project.

What does Legal Diagram need to run?

Going by SKILL.md and its folder, Legal Diagram needs Python for the scripts in its folder and the command-line tools its instructions call (python and pip). Our summary lists: Python 3.

Does Legal Diagram access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Legal Diagram safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Legal Diagram use?

Legal Diagram is published under the MIT licence (from the LICENSE file in the skill folder). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Legal Diagram use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.2k tokens, read only when the agent opens those files.

What are the alternatives to Legal Diagram?

Skills that share tags, products or a category with Legal Diagram: Diagram to Image Converter (sugarforever/01coder-agent-skills, 137 stars), Sf Diagram Nanobananapro (Jaganpro/sf-skills, 424 stars), Gpt Image Skill (feiskyer/claude-code-settings, 1.7k stars) and Nanobanana Skill (feiskyer/claude-code-settings, 1.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Legal Diagram?

lawve-ai (a GitHub organization) maintains it in lawve-ai/awesome-legal-skills, which has 847 GitHub stars. The repository holds 154 skills in this directory. The repository was last updated on October 2, 2026.

Source: lawve-ai/awesome-legal-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.