本文へ移動
cccskills
無料GitHub で公開

legal-diagram

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.

インストール方法を見る

含まれるファイル(167)

  • SKILL.md10.3 KB
  • assets/html_template.html55.8 KB
  • constraints.txt308 B
  • LICENSE.txt1.0 KB
  • PORTABILITY.md4.8 KB
  • README.md31.0 KB
  • references/extraction-schema.md4.6 KB
  • requirements.txt177 B
  • scripts/check_setup.py1.6 KB
  • scripts/diagram_selector.py33.6 KB
  • scripts/eval_pass2.py2.8 KB
  • scripts/extract_entities.py5.3 KB
  • scripts/extraction/__init__.py388 B
  • scripts/extraction/context.py3.5 KB
  • scripts/extraction/domain.py10.6 KB
  • scripts/extraction/domain/__init__.py1.7 KB
  • scripts/extraction/domain/compliance.py610 B
  • scripts/extraction/domain/core.py5.2 KB
  • scripts/extraction/domain/corporate.py431 B
  • scripts/extraction/domain/litigation.py759 B
  • scripts/extraction/domain/result.py4.9 KB
  • scripts/extraction/engine.py1.2 KB
  • scripts/extraction/evaluation.py18.8 KB
  • scripts/extraction/handoff.py8.4 KB
  • scripts/extraction/harvesters/__init__.py71 B
  • scripts/extraction/harvesters/_patterns.py2.2 KB
  • scripts/extraction/harvesters/base.py12.9 KB
  • scripts/extraction/harvesters/citations.py28.4 KB
  • scripts/extraction/harvesters/conditions.py720 B
  • scripts/extraction/harvesters/consent.py2.4 KB
  • scripts/extraction/harvesters/controls.py5.9 KB
  • scripts/extraction/harvesters/deadlines.py8.2 KB
  • scripts/extraction/harvesters/documents.py2.2 KB
  • scripts/extraction/harvesters/entities.py7.8 KB
  • scripts/extraction/harvesters/events.py7.2 KB
  • scripts/extraction/harvesters/notices.py1.2 KB
  • scripts/extraction/harvesters/obligations.py39.2 KB
  • scripts/extraction/harvesters/ownership.py1.4 KB
  • scripts/extraction/harvesters/parties.py14.3 KB
  • scripts/extraction/harvesters/party_mentions.py6.3 KB
  • scripts/extraction/harvesters/payments.py4.0 KB
  • scripts/extraction/harvesters/remedies.py821 B
  • scripts/extraction/harvesters/reps.py792 B
  • scripts/extraction/harvesters/tables.py5.6 KB
  • scripts/extraction/helpers/__init__.py1.2 KB
  • scripts/extraction/helpers/dates.py1.4 KB
  • scripts/extraction/helpers/money.py2.0 KB
  • scripts/extraction/helpers/scoring.py1.2 KB
  • scripts/extraction/helpers/subjects.py2.5 KB
  • scripts/extraction/language.py4.6 KB
  • scripts/extraction/lexicon.py3.3 KB
  • scripts/extraction/lexicon/__init__.py5.9 KB
  • scripts/extraction/lexicon/base.py6.6 KB
  • scripts/extraction/lexicon/en.py18.7 KB
  • scripts/extraction/lexicon/fr.py23.1 KB
  • scripts/extraction/manifest.py6.1 KB
  • scripts/extraction/materialize.py10.1 KB
  • scripts/extraction/patching.py21.9 KB
  • scripts/extraction/resolver.py11.7 KB
  • scripts/extraction/schema.py1.7 KB
  • scripts/extraction/utils.py13.9 KB
  • scripts/fetch_mermaid.py4.2 KB
  • scripts/first_run.py3.1 KB
  • scripts/normalize/__init__.py3.8 KB
  • scripts/normalize/docx_adapter.py3.9 KB
  • scripts/normalize/md_adapter.py7.3 KB
  • scripts/normalize/pdf_adapter.py5.2 KB
  • scripts/normalize/pptx_adapter.py2.8 KB
  • scripts/normalize/text_adapter.py1.7 KB
  • scripts/normalize/xlsx_adapter.py2.6 KB
  • scripts/patch_gate.py2.2 KB
  • scripts/render_html.py18.1 KB
  • scripts/tests/calibrate.py61.6 KB
  • scripts/tests/conftest.py1.4 KB
  • scripts/tests/eval/labels/bilingual_contract.pass2-labels.json356 B
  • scripts/tests/eval/labels/en_corp_structure.pass2-labels.json355 B
  • scripts/tests/eval/labels/en_employment.pass2-labels.json351 B
  • scripts/tests/eval/labels/en_judgment.pass2-labels.json349 B
  • scripts/tests/eval/labels/en_obligation_schedule.pass2-labels.json360 B
  • scripts/tests/eval/labels/en_privacy_policy.pass2-labels.json355 B
  • scripts/tests/eval/labels/en_spa_contract.pass2-labels.json680 B
  • scripts/tests/eval/labels/fr_contract.pass2-labels.json349 B
  • scripts/tests/eval/labels/fr_judgment.pass2-labels.json349 B
  • scripts/tests/eval/manifests/bilingual_contract.frozen.json120.4 KB
  • scripts/tests/eval/manifests/en_corp_structure.frozen.json68.3 KB
  • scripts/tests/eval/manifests/en_employment.frozen.json171.5 KB
  • scripts/tests/eval/manifests/en_judgment.frozen.json231.0 KB
  • scripts/tests/eval/manifests/en_obligation_schedule.frozen.json234.2 KB
  • scripts/tests/eval/manifests/en_privacy_policy.frozen.json143.4 KB
  • scripts/tests/eval/manifests/en_spa_contract.frozen.json223.9 KB
  • scripts/tests/eval/manifests/fr_contract.frozen.json186.5 KB
  • scripts/tests/eval/manifests/fr_judgment.frozen.json156.5 KB
  • scripts/tests/fixtures/bilingual_contract.md3.2 KB
  • scripts/tests/fixtures/bilingual_contract.md.labels.json2.3 KB
  • scripts/tests/fixtures/en_corp_structure.md3.8 KB
  • scripts/tests/fixtures/en_corp_structure.md.labels.json1.6 KB
  • scripts/tests/fixtures/en_employment.md5.0 KB
  • scripts/tests/fixtures/en_employment.md.labels.json3.3 KB
  • scripts/tests/fixtures/en_judgment.md4.6 KB
  • scripts/tests/fixtures/en_judgment.md.labels.json1.3 KB
  • scripts/tests/fixtures/en_obligation_schedule.md4.4 KB
  • scripts/tests/fixtures/en_obligation_schedule.md.labels.json4.5 KB
  • scripts/tests/fixtures/en_privacy_policy.md5.0 KB
  • scripts/tests/fixtures/en_privacy_policy.md.labels.json2.2 KB
  • scripts/tests/fixtures/en_spa_contract.md5.2 KB
  • scripts/tests/fixtures/en_spa_contract.md.labels.json2.9 KB
  • scripts/tests/fixtures/fr_contract.md4.1 KB
  • scripts/tests/fixtures/fr_contract.md.labels.json3.3 KB
  • scripts/tests/fixtures/fr_judgment.md3.8 KB
  • scripts/tests/fixtures/fr_judgment.md.labels.json1.1 KB
  • scripts/tests/golden/bilingual_contract.manifest.json120.4 KB
  • scripts/tests/golden/bilingual_contract.selector.json671 B
  • scripts/tests/golden/en_corp_structure.manifest.json68.3 KB
  • scripts/tests/golden/en_corp_structure.selector.json679 B
  • scripts/tests/golden/en_employment.manifest.json171.5 KB
  • scripts/tests/golden/en_employment.selector.json706 B
  • scripts/tests/golden/en_judgment.manifest.json231.0 KB
  • scripts/tests/golden/en_judgment.selector.json725 B
  • scripts/tests/golden/en_obligation_schedule.manifest.json234.2 KB
  • scripts/tests/golden/en_obligation_schedule.selector.json719 B
  • scripts/tests/golden/en_privacy_policy.manifest.json143.4 KB
  • scripts/tests/golden/en_privacy_policy.selector.json713 B
  • scripts/tests/golden/en_spa_contract.manifest.json223.9 KB
  • scripts/tests/golden/en_spa_contract.selector.json731 B
  • scripts/tests/golden/fr_contract.manifest.json186.5 KB
  • scripts/tests/golden/fr_contract.selector.json724 B
  • scripts/tests/golden/fr_judgment.manifest.json156.5 KB
  • scripts/tests/golden/fr_judgment.selector.json745 B
  • scripts/tests/run_golden.py16.9 KB
  • scripts/tests/test_calibrate_matching.py35.3 KB
  • scripts/tests/test_density_signal.py13.6 KB
  • scripts/tests/test_e2e_smoke.py7.3 KB
  • scripts/tests/test_eval_pass2.py32.8 KB
  • scripts/tests/test_extraction.py129.3 KB
  • scripts/tests/test_fetch_mermaid.py8.3 KB
  • scripts/tests/test_first_run.py8.8 KB
  • scripts/tests/test_fr_integration.py15.1 KB
  • scripts/tests/test_geometry_signal.py21.6 KB
  • scripts/tests/test_language.py7.7 KB
  • scripts/tests/test_lexicon_contract.py15.0 KB
  • scripts/tests/test_party_mentions.py14.7 KB
  • scripts/tests/test_patch_gate.py27.4 KB
  • scripts/tests/test_patterns.py2.5 KB
  • scripts/tests/test_pdf_tables.py10.4 KB
  • scripts/tests/test_render_classdef.py6.8 KB
  • scripts/tests/test_render_mmdc_golden.py2.8 KB
  • scripts/tests/test_render_ui_strings.py3.9 KB
  • scripts/tests/test_render_ux.py77.4 KB
  • scripts/tests/test_selector.py40.1 KB
  • scripts/tests/test_verify_render.py5.7 KB
  • scripts/tests/test_w6t3.py17.3 KB
  • scripts/tests/test_w6t4.py30.4 KB
  • scripts/verify_render.py10.6 KB
  • shared/diagram-type-map.md6.9 KB
  • shared/elicitation.md3.0 KB
  • shared/figure-description-schema.md3.4 KB
  • shared/node-styles.md5.2 KB
  • shared/note-template.md619 B
  • shared/parser-guards.md10.7 KB
  • shared/setup-check.md1.4 KB
  • workflows/direct.md1.9 KB
  • workflows/eval-pass2.md10.6 KB
  • workflows/extract.md7.0 KB
  • workflows/generation.md13.2 KB
  • workflows/guided.md4.5 KB
  • workflows/html-export.md9.3 KB
  • workflows/tutorial.md4.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

/legal-diagram

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.

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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Creates an Agent Authority Charter for enterprise or regulated AI agents before deployment. Use this Skill when a user needs to define what an AI agent is allowed to do, who delegated authority to it, what actions are permitted or prohibited, when human approval is required, what evidence must be preserved, and how the agent can be suspended, revoked, or escalated.

日本語の概要は準備中です。原文の説明を表示しています。

lawve-ai/awesome-legal-skills8632026年10月3日 更新

EU AI Act Knowledge Engine — authoritative regulatory Q&A grounded in 70 official EU source documents (including the 2026 Commission draft guidelines on Art. 6 high-risk classification — general principles, Annex I, Annex III). Answers any question about the AI Act with article-level citations from the full regulation text, Commission guidelines, EDPB/EDPS opinions, codes of practice, harmonised standards, FRIA guides, incident templates, and sector-specific guidance. This skill should be used when the user asks about the "EU AI Act", "AI Act regulation", "Regulation 2024/1689", "KI-Verordnung", asks to "explain an AI Act article", "what does Article X say", "AI Act requirements", "AI Act penalties", "AI Act timeline", "GPAI obligations", "high-risk AI", "prohibited AI practices", "AI Act and GDPR", "fundamental rights impact assessment", "AI Act standards", "AI Act national implementation", "AI literacy", "serious incident reporting", "Digital Omnibus", "AI regulatory sandbox", or any question about EU artificial intelligence regulation. Also triggers on German terms: "KI-Gesetz", "KI-Verordnung", "Hochrisiko-KI", "KI-Kompetenz", "Grundrechte-Folgenabschaetzung", "GPAI-Verhaltenskodex". For assessment workflows that produce a classification decision rather than a knowledge answer, offer to run a structured risk-tier classification in-session.

日本語の概要は準備中です。原文の説明を表示しています。

lawve-ai/awesome-legal-skills8632026年10月3日 更新

This skill builds a structured audit trail of an AI-assisted task: what the tool was asked to do, what materials it was given, what it produced, how the output was verified, and what was ultimately relied upon. It documents the workflow for supervision and later review without ruling on privilege or disclosure, so the record stays accurate rather than self-serving.

日本語の概要は準備中です。原文の説明を表示しています。

lawve-ai/awesome-legal-skills8632026年10月3日 更新

Use this skill when the user wants an AI governance, legal-risk, privacy, compliance, procurement, or vendor-risk review of an internal AI use case, an AI product feature, an LLM workflow, or a third-party AI vendor. The skill asks intake and clarifying questions first when facts or evidence are missing, identifies required documentation and missing evidence, maps the use case to AI governance frameworks and applicable legal domains, and produces a preliminary or final governance review with scorecards, findings, owners, remediation actions, and follow-up questions.

日本語の概要は準備中です。原文の説明を表示しています。

lawve-ai/awesome-legal-skills8632026年10月3日 更新

Turn an interpretive-ambiguity audit of a legal text — contract, statute, regulation, or judicial opinion — into a polished deliverable. Produces a multi-page website (default), a single-page interactive site, a Microsoft Word document, a PowerPoint deck, or a LaTeX/PDF. Use whenever a user has a stress-test result, ambiguity audit, or "where will this be litigated" scenarios and wants to publish, present, or share them. Triggers on "publish the audit," "make a report from this," "turn this into a website / deck / brief / Word doc," "make a Netlify site," "build slides of these ambiguities," "render the scenarios," "package this stress test," "produce a LaTeX version," and similar. Pairs with the ambiguity-stress-test skill (the underlying analysis) but works on any structured or semi-structured ambiguity analysis. Visual design is opinionated but the user can override colors, fonts, and brand label. Most formats need Python and a writable filesystem; single-file HTML works where the host has neither.

日本語の概要は準備中です。原文の説明を表示しています。

lawve-ai/awesome-legal-skills8632026年10月3日 更新

Adversarially stress-tests a legal text — a contract, statute, regulation, or judicial opinion — for interpretive ambiguity: it finds the seams where the people governed by it will later disagree about what it means and turns each into a concrete dispute scenario with both sides' arguments, the likely outcome, and a fix. Use it whenever someone wants to pressure-test, red-team, audit, or find weak spots, loopholes, gaps, ambiguities, or drafting problems in a legal document; whenever a drafter wants to tighten a contract, statute, regulation, or opinion before it issues; whenever a litigator wants to mine an opinion or contract for arguments; or whenever someone hands over a legal text and asks where it will be fought over or for issue-spotting. Trigger it for contract review, statutory-ambiguity analysis, judicial-opinion scope analysis, and drafting QA — even if the user never says "stress-test" or "ambiguity."

日本語の概要は準備中です。原文の説明を表示しています。

lawve-ai/awesome-legal-skills8632026年10月3日 更新

lawve-ai のスキルをすべて見る

このスキルの問題を報告する