law-to-markdown
Skill100 starsChanged 5 months agoMITView on GitHub
将法条/规范文件(.txt/.docx/.pdf)转为 Markdown。适用于用户要求“法条转 markdown”“pdf/docx 转 markdown”。处理 .pdf/.docx 时先检查是否已安装 mineru-ocr skill;未安装先引导安装,安装后优先用 mineru-ocr;仅在用户明确同意时再用本地回退方案。
4 other projects use a version of this, 4 of them edited.
Adopted by
Most recently taken up by
- ZeroTokenClaw/agents-skillsedited, first seen Sep 21, 2026
- anbeime/skilledited, first seen Jun 17, 2026
- dycnnnb/skillsedited, first seen Mar 15, 2026
- zh-xx/legal-assistant-skillsedited, first seen Feb 14, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 4
- anbeime/skill★ 7.5k93% same
- zh-xx/legal-assistant-skills★ 17399% same
- dycnnnb/skills★ 299% same
- ZeroTokenClaw/agents-skills★ 193% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- china-legal-skillsSkill
- 一审阶段辩护Skill
- 二审阶段辩护Skill
- 产品法务Skill
- 侦查阶段辩护Skill
- 债权人会议Skill
- 债权申报与审查Skill
- 刑事辩护总调度Skill
- 初步法律分析Skill
- 劳动争议仲裁程序管理Skill
- 劳动争议证据体系Skill
- 劳动争议诉讼Skill
- 劳动关系认定与经济补偿计算Skill
- 合同审查Skill
- 合同起草Skill
- 委托合同管理Skill
- 审查起诉阶段辩护Skill
- 审理报告Skill
- 广告合规审核Skill
- 庭前准备Skill
- 庭审与庭后工作Skill
- 微信文章转换为markdownSkill
- 未成年人案件Skill
- 案件承接与委托Skill
- 案件材料生成专业文档Skill
- 案件沟通记录Skill
- 案件讨论与提纲Skill
- 死刑案件Skill
- 民事一审诉讼Skill
- 民事判决书Skill
- 法律Wiki知识库查询Skill
- 法律咨询助手Skill
- 法律工作总控Skill
- 法律文书出稿前审查Skill
- 法律文书模板与导出Skill
- 法律文章quai味道Skill
- 法规案例检索Skill
- 特殊程序Skill
- 用人单位劳动合规Skill
- 监管合规监测Skill
- 破产和解程序Skill
- 破产文书生成Skill
- 破产法律分析Skill
- 破产清算Skill
- 破产申请与受理Skill
- 立案管理Skill
- 简易速裁程序Skill
- 管理人工作Skill
- 结案归档Skill
- 诉讼分析工具Skill
- 诉讼可视化Skill
- 诉讼文书起草Skill
- 诉讼案件管理Skill
- 调查取证与证据管理Skill
- 调解与和解Skill
- 财产调查与管理Skill
- 重整程序Skill
- 预包装食品标签合规Skill
The file
Files
法律工作总控规则(强制)
执行本 Skill 前,必须先遵循:
- skills/legal/法律工作总控/references/practice-profile.md
- skills/legal/法律工作总控/references/matter-workspace-protocol.md
- skills/legal/法律工作总控/references/document-reading-protocol.md
- skills/legal/法律工作总控/references/source-boundary-protocol.md
- skills/legal/法律工作总控/references/ocr-correction-protocol.md
- skills/legal/法律工作总控/references/pkulaw-mcp-legal-verification-protocol.md
本 Skill 只处理本专业任务;案件隔离、来源披露、材料缺口、法规/Wiki 校验、OCR 校正和读取复查按总控规则执行。
旧规则废止(强制)
- 旧文中直接写死的客户目录、阶段目录、旧式台账写入、旧本地读取协议均不作为执行规则。
- 事项路径、当前事项、系统记录、业务文件区和复盘台账统一以法律工作总控
matter-workspace-protocol.md为准。 - 不得静默写入复盘台账;确需更新时,先确认属于复盘台账更新并向用户说明。
Law To Markdown
处理规则
- 输入为
.txt:直接转存为.md。 - 输入为
.pdf/.docx:- 先检查是否已安装
mineru-ocrskill。 - 未安装:提示先安装
mineru-ocr,安装地址:https://github.com/cat-xierluo/legal-skills/tree/main/skills/mineru-ocr - 已安装:优先调用
mineru-ocr处理。 - 调用失败:先提示检查
mineru-ocr配置/Token。 - 仅当用户明确同意时,才使用本地回退(
python-docx/pdfplumber)。
- 先检查是否已安装
- 第一阶段完成后默认执行第二阶段格式调整(仅格式,不改原文字符):
- 由调用该 skill 的大模型先判断“法律/非法律”,并把结果传给脚本。
- 若调用方未传结果,则脚本使用硬规则自动识别(
--law-decision auto)。 - 法律名称
# - 编/分编
## - 章
### - 节
#### - 条
#####(仅“第X条”为标题;第X条【条标】整行为标题不拆) - 款/项/目无标题
- 项、目按标记换行
- 清理多余空格:去行尾空格、去行首 ASCII 空格、去正文行首全角缩进、规范标题后的空格
- 若识别为明显非法律文本(如 GB/标准类文档),第二阶段明确拒绝:
Stage2: rejected (non-law-document)。 - 若第二阶段未识别法律结构或保真校验失败,则自动 no-op,不改文本。
- 默认执行第三阶段检查(双子阶段,硬门槛):
- Stage3-A:校验
stage2相对stage1的文字内容准确性(去标题符号与空白后字符流必须一致) - Stage3-B:校验结构效果(结构层级、条标题规则、非法律策略、空格规范、项/目换行)
- 任一失败触发自动重走,最多 2 次;仍失败默认报错退出
- Stage3-A:校验
二阶段识别参数
--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。
常用命令
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许可证
SPDX-License-Identifier: Apache-2.0
Copyright (c) 2026 JiCheng
采用 Apache License 2.0 许可,许可证原文见仓库根目录 LICENSE。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

