Legal Citation Automator logo

Legal Citation Automator

Community
NEU-ZHA
legal-citation-automator

法学脚注 DOCX 执行器。用于把已经由 legal-citation-comprehensive 诊断、补全或确认过的法学引注插入 Word 文档,并进行 Word/WPS 脚注结构兼容性检查。适用于自动添加脚注、批量脚注修复、DOCX footnotes.xml 处理、脚注编号检查、脚注引用标记插入。不要把它当作引注规则大脑;复杂引注规则必须先交给 legal-citation-comprehensive。

Overview

PublisherNEU-ZHA
Repositorylegal-ai-skills
Skill namelegal-citation-automator
Stars
70
Forks
7
Bundled files
10
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 10 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by NEU-ZHA on GitHub. Read the source before you install it.

Installation

Install the Legal Citation Automator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/NEU-ZHA/legal-ai-skills/tree/main/skills/legal-citation-automator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/NEU-ZHA/legal-ai-skills.git /tmp/legal-ai-skills
mkdir -p .claude/skills
cp -r /tmp/legal-ai-skills/skills/legal-citation-automator .claude/skills/legal-citation-automator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Legal Citation Automator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Legal Citation Automator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Legal Citation Automator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Legal Citation Automator

Role

This skill is the DOCX execution layer. It inserts or repairs footnotes only after citation text has been diagnosed and approved by legal-citation-comprehensive.

Do not invent citation content here. Do not rely on this skill to decide legal citation format. Use the comprehensive skill first for source type, missing elements, and final footnote wording.

Weak-agent guardrail: if any required fact is uncertain, stop. Output a repair checklist. Do not edit the DOCX just because the user asked for automation.

Safe Workflow

  1. Run legal-citation-comprehensive.
    • Diagnose each messy footnote or citation candidate.
    • Search the full handbook index for non-trivial or unusual sources.
    • Produce either final citation text or a [待补] checklist.
  2. Prepare a citation insertion plan.
    • Each item must include the exact body text anchor or paragraph/run location.
    • Each item must include final footnote text.
    • If multiple sources support the same anchor, combine them into one footnote_text separated by semicolons. Do not create two insertion items for the same sentence-final anchor.
    • If source facts are missing, stop and return a report instead of editing the DOCX.
  3. Insert footnotes using OOXML, preserving the existing document structure.
  4. Verify:
    • every w:footnoteReference has a matching w:footnote;
    • separator IDs remain -1 and 0;
    • generated replacement notes may start at 4+ as a conservative repair convention;
    • footnote text style matches the target document/template;
    • DOCX zip, content types, and relationships are valid.

Input Contract

The safe input to an insertion script is a JSON array:

json
[
  {
    "anchor_text": "依《民法典》第153条第1款",
    "placement": "after_anchor",
    "footnote_text": "《中华人民共和国民法典》第153条:“……”",
    "source_status": "verified"
  }
]

Required fields:

  • anchor_text: exact text in the body, or an equivalent precise location object.
  • placement: after_anchor, after_sentence, or a precise custom instruction.
  • footnote_text: final text from legal-citation-comprehensive.
  • source_status: must be verified; if needs_user_input, do not edit.

When to Refuse Editing

Do not modify the DOCX when:

  • the footnote text contains [待补: ...];
  • the comprehensive skill has not supplied handbook rule numbers;
  • the citation source has not been verified;
  • the anchor appears multiple times and the user has not clarified which instance;
  • two or more insertion items target the same anchor/placement and would create adjacent footnote references; merge them first unless the body text has distinct citation anchors;
  • the source is a PDF/book/article but required bibliographic facts are absent;
  • the requested citation format conflicts with the handbook and no user override is explicit.

Instead, produce a citation repair report using the comprehensive skill output.

Scripts

  • scripts/diagnose_with_comprehensive.py: wrapper that calls the comprehensive skill diagnostic script when available.
  • scripts/add_footnotes.py: legacy OOXML insertion utility. Use only after reviewing its target-location behavior for the current task.
  • scripts/docx_compat_check.py: final DOCX compatibility gate.
  • scripts/fix_footnote_conflict.py: repair mismatched or unsafe footnote IDs.
  • scripts/identify_citations.py: first-pass candidate detector; always review candidates manually.

Important DOCX Rules

  • The clean template pattern is separator footnotes -1 and 0; a regular note ID 1 is valid.
  • Starting generated replacement notes at 4+ is a conservative repair convention, not a universal rule.
  • Never create a body footnoteReference without a matching footnote definition.
  • Never add footnote definitions without confirming the body reference was actually inserted.
  • If multiple anchors match, pause and ask for clarification.
  • Strip leading/trailing whitespace from every footnote_text before writing it to footnotes.xml. Keep at most the normal single delimiter space after the footnote number; do not let the citation text itself start with a blank.
  • Do not emit adjacent footnote references after the same punctuation. If a sentence needs two supporting sources, put them in the same footnote separated by ;.
  • For Civil Law homework, combine with legal-homework-formatter so footnote style remains 小五、左对齐、单倍行距、段前后 0、首行不缩进.

Relationship to Comprehensive Skill

Use legal-citation-comprehensive as the authoritative source for:

  • source classification;
  • missing element diagnosis;
  • full handbook rule lookup;
  • standard footnote wording;
  • direct/indirect quotation analysis;
  • repeat citation forms.

This skill is successful only when the final DOCX structure is valid and the citation content has already been validated.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Legal Citation Automator AI skill do?

法学脚注 DOCX 执行器。用于把已经由 legal-citation-comprehensive 诊断、补全或确认过的法学引注插入 Word 文档,并进行 Word/WPS 脚注结构兼容性检查。适用于自动添加脚注、批量脚注修复、DOCX footnotes.xml 处理、脚注编号检查、脚注引用标记插入。不要把它当作引注规则大脑;复杂引注规则必须先交给 legal-citation-comprehensive。

Why use Legal Citation Automator on TypingMind?

Because you install it once and use it with any model. Legal Citation Automator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Legal Citation Automator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/NEU-ZHA/legal-ai-skills/tree/main/skills/legal-citation-automator. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Legal Citation Automator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Legal Citation Automator?

As many as you like. As long as a model supports skills, you can use Legal Citation Automator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Legal Citation Automator AI skill free?

Yes. It is published on GitHub by NEU-ZHA under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇