Agent skill · AI & Agents

law-to-markdown

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

anbeimegithub.com/anbeimeGitHub ↗
claude-codeships scripts
Install
npx skills add anbeime/skill --skill law-to-markdown --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 8
SKILL.md size: 2 KB
Bundled scripts: yes
Path: skills/legal-assistant-skills-main/law-to-markdown/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 4,714
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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`: - 默认严格模式(失败即报错退出) - 非严格模式仅输出报

What's inside
Steps it walks through
  1. 处理规则
  2. 二阶段识别参数
  3. 三阶段参数
  4. 输出规则
  5. 常用命令
Ships with 7 files
  • .gitignore
  • LICENSE.txt
  • agents/openai.yaml
  • scripts/cn_law_normalizer.py
  • scripts/law_to_markdown.py
  • scripts/requirements.txt
  • scripts/stage3_checker.py
Commands it runs
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"
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
More from skill
All skills →
About this skill
What does the law-to-markdown skill do?

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

How do I install it?

Run `npx skills add anbeime/skill --skill law-to-markdown --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From anbeime/skill, a repository with 4,714 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going