Agent skill

Law To Markdown

by zh-xx in zh-xx/legal-assistant-skills

将法条/规范文件(.txt/.docx/.pdf)转为 Markdown。适用于用户要求“法条转 markdown”“pdf/docx 转 markdown”。处理 .pdf/.docx 时先检查是否已安装 mineru-ocr skill;未安装先引导安装,安装后优先用 mineru-ocr;仅在用户明确同意时再用本地回退方案。

Apache-2.0Auto-check passedDocuments & Office

Install Law To Markdown

skills CLI
$ npx skills add zh-xx/legal-assistant-skills --skill law-to-markdown -a claude-code

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

GitHub CLI
$ gh skill install zh-xx/legal-assistant-skills law-to-markdown --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/zh-xx/legal-assistant-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/law-to-markdown .claude/skills/law-to-markdown && 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
law-to-markdown
GitHub stars
174
Used in
1 other repo
Token cost
~669 tokens
SKILL.md length
128 words
Files
7 (incl. scripts)
Skills in repo
8
Repo updated
First seen
Licence
Apache-2.0

At a glance

将法条/规范文件(.txt/.docx/.pdf)转为 Markdown。适用于用户要求“法条转 markdown”“pdf/docx 转 markdown”。处理 .pdf/.docx 时先检查是否已安装 mineru-ocr skill;未安装先引导安装,安装后优先用 mineru-ocr;仅在用户明确同意时再用本地回退方案。

  • Works in 6 steps: 输入为 .txt:直接转存为 .md。 → 输入为 .pdf / .docx → 第一阶段完成后默认执行第二阶段格式调整(仅格式,不改原文字符) → …
  • Tasks that involve Word documents
  • SKILL.md covers 处理规则, 二阶段识别参数, 三阶段参数 and 输出规则, plus 2 more sections
  • Runs Python scripts from its folder; calls python3; reaches github.com

What it does

Law To Markdown is an agent skill from zh-xx/legal-assistant-skills. 将法条/规范文件(.txt/.docx/.pdf)转为 Markdown。适用于用户要求“法条转 markdown”“pdf/docx 转 markdown”。处理 .pdf/.docx 时先检查是否已安装 mineru-ocr skill;未安装先引导安装,安装后优先用 mineru-ocr;仅在用户明确同意时再用本地回退方案。

Its SKILL.md is about 670 tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts (for example `agents/openai.yaml`, `scripts/cn_law_normalizer.py` and `scripts/law_to_markdown.py`).

It sits in Documents & Office, covering Word documents, Markdown and PDF. It works with Microsoft Word. The repository describes itself as: AI assistant skills for legal work. Compatible with Claude Code, Codex, and other platforms. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Word documents
  • Tasks that involve Markdown
  • Tasks that involve PDF

Example prompts

  • “法条转 markdown”
  • “pdf/docx 转 markdown”
  • “/law-to-markdown”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. 输入为 .txt:直接转存为 .md。
  2. 输入为 .pdf / .docx
  3. 第一阶段完成后默认执行第二阶段格式调整(仅格式,不改原文字符)
  4. 若识别为明显非法律文本(如 GB/标准类文档),第二阶段明确拒绝:Stage2: rejected (non-law-document)。
  5. 若第二阶段未识别法律结构或保真校验失败,则自动 no-op,不改文本。
  6. 默认执行第三阶段检查(双子阶段,硬门槛)

What it can do on your machine

Read from SKILL.md and the folder at commit 3094afd. 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 4 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

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

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    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

Law To Markdown loads about 669 tokens when it runs. Until then it costs about 46 tokens; SKILL.md has 128 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
When it runs · the whole SKILL.md, loaded when a task matches
~669

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 zh-xx/legal-assistant-skills at commit 3094afd, republished under its Apache-2.0 licence (© zh-xx). 128 words, ~669 tokens.

Download SKILL.mdSave it as .claude/skills/law-to-markdown/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
law-to-markdown
description
将法条/规范文件(.txt/.docx/.pdf)转为 Markdown。适用于用户要求“法条转 markdown”“pdf/docx 转 markdown”。处理 .pdf/.docx 时先检查是否已安装 mineru-ocr skill;未安装先引导安装,安装后优先用 mineru-ocr;仅在用户明确同意时再用本地回退方案。

Law To Markdown

处理规则

  1. 输入为 .txt:直接转存为 .md。
  2. 输入为 .pdf / .docx:
    • 先检查是否已安装 mineru-ocr skill。
    • 未安装:提示先安装 mineru-ocr,安装地址: https://github.com/cat-xierluo/legal-skills/tree/main/skills/mineru-ocr
    • 已安装:优先调用 mineru-ocr 处理。
    • 调用失败:先提示检查 mineru-ocr 配置/Token。
    • 仅当用户明确同意时,才使用本地回退(python-docx / pdfplumber)。
  3. 第一阶段完成后默认执行第二阶段格式调整(仅格式,不改原文字符):
    • 由调用该 skill 的大模型先判断“法律/非法律”,并把结果传给脚本。
    • 若调用方未传结果,则脚本使用硬规则自动识别(--law-decision auto)。
    • 法律名称 #
    • 编/分编 ##
    • 章 ###
    • 节 ####
    • 条 #####(仅“第X条”为标题;第X条【条标】整行为标题不拆)
    • 款/项/目无标题
    • 项、目按标记换行
    • 清理多余空格:去行尾空格、去行首 ASCII 空格、去正文行首全角缩进、规范标题后的空格
  4. 若识别为明显非法律文本(如 GB/标准类文档),第二阶段明确拒绝:Stage2: rejected (non-law-document)。
  5. 若第二阶段未识别法律结构或保真校验失败,则自动 no-op,不改文本。
  6. 默认执行第三阶段检查(双子阶段,硬门槛):
    • Stage3-A:校验 stage2 相对 stage1 的文字内容准确性(去标题符号与空白后字符流必须一致)
    • Stage3-B:校验结构效果(结构层级、条标题规则、非法律策略、空格规范、项/目换行)
    • 任一失败触发自动重走,最多 2 次;仍失败默认报错退出

二阶段识别参数

  • --law-decision law:调用方已判定为法律文本,直接按法律结构优化。
  • --law-decision non-law:调用方已判定为非法律文本,阶段二直接拒绝。
  • --law-decision auto:不传判定时的默认模式,使用脚本内硬规则。

三阶段参数

  • --skip-stage3-check:跳过第三阶段检查(默认不跳过)。
  • --stage3-max-retries:失败后自动重走次数,默认 2。
  • --stage3-strict / --no-stage3-strict:
    • 默认严格模式(失败即报错退出)
    • 非严格模式仅输出报告,不阻断流程
  • --artifact-level minimal|standard|debug:
    • minimal(默认):面向交付,输出最少
    • standard:保留过程文件(stage1/stage2/stage3-check)便于排查
    • debug:保留全部过程产物(包含调试信息)

输出规则

  • 默认输出到输入文件同目录的 markdown/ 子目录,并按输入文件名创建独立目录:
    • markdown/<文件名>/
  • 默认(--artifact-level minimal)输出:
    • <原文件名>+审核报告.md(详细过程和结论)
    • <原文件名>+最终成果.md(仅法律文本且审核通过时生成)
  • 非法律文档(如 GB/标准类):
    • 结论为“拒绝处理”
    • 仅输出 <原文件名>+审核报告.md
    • 不输出 <原文件名>+最终成果.md
  • 审核未通过时会自动保留过程文件用于排查:
    • <文件名>.stage1.md
    • <文件名>.stage2.md
    • <文件名>.stage3-check.md
  • 若需更多产物可切换:
    • --artifact-level standard:保留 stage1/stage2/stage3-check
    • --artifact-level debug:保留全部调试产物
  • 可通过命令参数指定 --out 或 --out-dir。

常用命令

bash
python3 law-to-markdown/scripts/law_to_markdown.py "input.txt"
python3 law-to-markdown/scripts/law_to_markdown.py "input.docx"
python3 law-to-markdown/scripts/law_to_markdown.py "input.pdf"

用户明确同意回退时:

bash
python3 law-to-markdown/scripts/law_to_markdown.py "input.docx" --allow-fallback
python3 law-to-markdown/scripts/law_to_markdown.py "input.pdf" --allow-fallback

许可证

SPDX-License-Identifier: Apache-2.0

Copyright (c) 2026 JiCheng

采用 Apache License 2.0 许可,许可证原文见仓库根目录 LICENSE。

© zh-xx, Apache-2.0. 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 6 other files (scripts) in law-to-markdown of zh-xx/legal-assistant-skills.

  • SKILL.md
  • .gitignore
  • agents/openai.yaml
  • scripts/cn_law_normalizer.py
  • scripts/law_to_markdown.py
  • scripts/requirements.txt
  • scripts/stage3_checker.py

Open the folder on GitHubat commit 3094afd

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in zh-xx/legal-assistant-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Law To Markdown 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.

Law To Markdown compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Law To Markdown this skillzh-xx/legal-assistant-skills1741 repos~669Automated safety check: PassApache-2.0
MarkitdownImCa0/just-laws78114 repos~3.2kAutomated safety check: NotesMIT
Gzh Designisjiamu/gzh-design-skill4k—~2.2kAutomated safety check: PassAGPL-3.0
Gzh DesignZJU-REAL/Easel3.4k—~2.1kAutomated safety check: PassAGPL-3.0
Doc Cleanernotoriouslab/doc-cleaner309—~712Automated safety check: PassMIT
MineruNebutra/MinerU-Skill123—~504Automated safety check: PassMIT

Similar skills

  • Markitdown

    ImCa0/just-laws

    Convert files and office documents to Markdown. An agent skill from ImCa0/just-laws.

    781 GitHub starsUsed in 14 repos~3.2k tokens
    Documents & OfficeAuto-check: notes
  • Gzh Design

    isjiamu/gzh-design-skill

    微信公众号文章排版引擎,将 Markdown 转换为可直接粘贴到公众号编辑器的 HTML。主题风格从 references/theme-index.md 注册的自定义主题库中选取,自动章节编号、关键词下划线标记、引言卡片、目录导航、代码块、图片/GIF、作者签名。支持 Markdown / Word(.docx) / PDF / 纯文本输入(非 Markdown…

    4k GitHub stars~2.2k tokensUpdated 2 days ago
    Documents & OfficeAuto-check passed
  • Gzh Design

    ZJU-REAL/Easel

    微信公众号文章排版引擎:把 Markdown / Word(.docx) / PDF / 纯文本转成可直接粘贴进公众号编辑器的 HTML,自动章节编号、关键词标记、引言卡、目录、代码块、图片/GIF、作者签名;主题从 references/theme-index.md…

    3.4k GitHub stars~2.1k tokensUpdated today
    Documents & OfficeAuto-check passed
  • Doc Cleaner

    notoriouslab/doc-cleaner

    Convert PDF, DOCX, XLSX, and text files to clean, structured Markdown.

    309 GitHub stars~712 tokensUpdated 1 mo ago
    Documents & OfficeAuto-check passed
  • Mineru

    Nebutra/MinerU-Skill

    An AI-Native skill for parsing PDF / Office / image files into Markdown with MinerU — a fast, zero-config document parser for AI agents.

    123 GitHub stars~504 tokensUpdated 17 days ago
    Documents & OfficeAuto-check passed
  • Pandic Office

    Team-Commonly/commonly

    Convert Markdown to PDF (or DOCX/EPUB/HTML) using the pandoc CLI.

    1.4k GitHub stars~642 tokensUpdated yesterday
    Documents & OfficeAuto-check passed

More from zh-xx/legal-assistant-skills

All 8 skills in this repo
  • Legal Risk Visualization

    zh-xx/legal-assistant-skills

    法律风险结构化分析与可视化。基于法律分析文本,执行五步风险抽取模型, 生成四层可视化输出(雷达图数据、风险矩阵、影响路径图、决策树)。

    174 GitHub stars~2.4k tokensUpdated 5 mo ago
    Auto-check passed
  • Ad Compliance Review

    zh-xx/legal-assistant-skills

    广告合规审核技能,用于审核广告素材是否符合中国广告法及相关法规。适用场景:(1) 用户提交广告文案、广告素材要求合规审核时;(2) 用户提到"广告审核""广告合规""广告法审查"等关键词时;(3) 用户要求检查广告内容是否存在违法违规风险时;(4) 用户提交房地产、食品、医疗、药品、互联网等行业广告要求专项审核时。审核依据涵盖《广告法》《反不正当竞争法》及行业专项法规。

    174 GitHub stars~1.2k tokensUpdated 5 mo ago
    Auto-check passed
  • Contract Gen

    zh-xx/legal-assistant-skills

    合同生成技能,以资深法律专家身份生成完整合同。适用场景:(1) 用户要求'起草合同''生成合同''拟定协议''写合同''草拟合同'时;(2) 用户提供合同类型和交易信息,要求生成完整合同文本时;(3) 用户要求根据特定立场(甲方/乙方/买方/卖方/出租方/承租方)起草倾斜性合同时;(4) 用户要求将已有合同要点或业务条件生成为正式合同文本时。输出 Markdown 格式,可选导出 .docx。

    174 GitHub stars~897 tokensUpdated 5 mo ago
    Auto-check passed
  • Contract Review

    zh-xx/legal-assistant-skills

    Contract review skill that adds comment-based issue annotations without changing original text.

    174 GitHub stars~1.6k tokensUpdated 5 mo ago
    Auto-check passed
  • Food Label Review

    zh-xx/legal-assistant-skills

    预包装食品标签合规审核技能,用于审核食品标签是否符合 GB 7718(预包装食品标签通则)和 GB 28050(预包装食品营养标签通则)。适用场景:(1) 用户提交食品标签图片、文字或文档要求合规审核时;(2) 用户提到"食品标签审核""标签合规""营养标签审查""GB 7718""GB 28050"等关键词时;(3) 用户要求检查食品标签是否存在缺项、错误或违规风险时。支持 2011 版和…

    174 GitHub stars~1.7k tokensUpdated 5 mo ago
    Auto-check passed
  • Legal Job Search

    zh-xx/legal-assistant-skills

    法律AI求职助手 - 帮助法律人(法务/律师)使用AI辅助求职。支持公司/律所调研、法律风险分析、网页简历生成、针对性材料准备、面试备忘录生成。具备MCP工具级降级能力,无MCP时自动使用Web Search。

    174 GitHub stars~1.7k tokensUpdated 5 mo ago
    Auto-check passed

Works with

Questions about Law To Markdown

What does Law To Markdown do?

将法条/规范文件(.txt/.docx/.pdf)转为 Markdown。适用于用户要求“法条转 markdown”“pdf/docx 转 markdown”。处理 .pdf/.docx 时先检查是否已安装 mineru-ocr skill;未安装先引导安装,安装后优先用 mineru-ocr;仅在用户明确同意时再用本地回退方案。. Law To Markdown is an agent skill from zh-xx/legal-assistant-skills.

When should I use Law To Markdown?

Law To Markdown fits situations like: tasks that involve Word documents; tasks that involve Markdown; tasks that involve PDF.

How do I install Law To Markdown in Claude Code?

Run `npx skills add zh-xx/legal-assistant-skills --skill law-to-markdown -a claude-code`. Or copy the skill folder (law-to-markdown in zh-xx/legal-assistant-skills) into .claude/skills/law-to-markdown in your project. Claude Code loads it when a task matches its description.

How do I install Law To Markdown in Codex?

Run `npx skills add zh-xx/legal-assistant-skills --skill law-to-markdown -a codex`. Or copy the skill folder (law-to-markdown in zh-xx/legal-assistant-skills) into .agents/skills/law-to-markdown in your project. Codex loads it when a task matches its description.

Can I use Law To Markdown 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 zh-xx/legal-assistant-skills --skill law-to-markdown -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/law-to-markdown, .gemini/skills/law-to-markdown, .github/skills/law-to-markdown and .opencode/skills/law-to-markdown in your project.

What does Law To Markdown need to run?

Going by SKILL.md and its folder, Law To Markdown needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Law To Markdown access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Law To Markdown 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 Law To Markdown use?

Law To Markdown is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Law To Markdown use?

About 669 tokens (SKILL.md is roughly 2.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Law To Markdown?

Skills that share tags, products or a category with Law To Markdown: Markitdown (ImCa0/just-laws, 781 stars), Gzh Design (isjiamu/gzh-design-skill, 4k stars), Gzh Design (ZJU-REAL/Easel, 3.4k stars) and Doc Cleaner (notoriouslab/doc-cleaner, 309 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Law To Markdown?

zh-xx (a GitHub user) maintains it in zh-xx/legal-assistant-skills, which has 174 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on April 18, 2026.

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