law-to-markdown

law-to-markdown is a skill for Codex from pa1nrui1/legal-skills. It costs 90 tokens per session (1,578 once invoked), scanned A, original, MIT.

A skill that converts legal provisions and regulatory documents from plain text, PDF, or Word format into Markdown. Markdown is a plain-text format commonly used for structured documents.

In plain words
What is it for?
Use it to convert .txt files directly, process .pdf or .docx files through the required OCR tool when available, and format legal headings such as laws, chapters, sections, and articles.
Why use it?
It gives legal text a consistent, readable format while keeping the original wording unchanged during formatting. PDF and Word files may require OCR, which is text recognition from document images.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Use it to convert .txt files directly, process .pdf or .docx files through the required OCR tool when available, and format legal headings such as laws, chapters, sections, and articles.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pa1nrui1/legal-skills/law-to-markdown
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add pa1nrui1/legal-skills --skill law-to-markdown
Clone the repo
git clone --depth 1 https://github.com/pa1nrui1/legal-skills

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for law-to-markdown

README.md
[![agentmods](https://agentmods.dev/badge/skills/pa1nrui1/legal-skills/law-to-markdown/github.svg)](https://agentmods.dev/skills/pa1nrui1/legal-skills/law-to-markdown)
Your own site
<a href="https://agentmods.dev/skills/pa1nrui1/legal-skills/law-to-markdown"><img src="https://agentmods.dev/badge/skills/pa1nrui1/legal-skills/law-to-markdown/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for law-to-markdown

Your own site · 80×15
<a href="https://agentmods.dev/skills/pa1nrui1/legal-skills/law-to-markdown"><img src="https://agentmods.dev/badge/skills/pa1nrui1/legal-skills/law-to-markdown.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,578 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00090 $0.01578
Opus 5 $0.00045 $0.00789
Sonnet 5 $0.00018 $0.00316
Haiku 4.5 $0.00009 $0.00158

Measured 12d ago against content hash ab4b27ef5c16, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

law-to-markdown scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/cn_law_normalizer.py, scripts/law_to_markdown.py, scripts/stage3_checker.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/legal/law-to-markdown/SKILL.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

法律工作总控规则(强制)

执行本 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

处理规则

  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:保留全部过程产物(包含调试信息)

Read the full file on GitHub · 117 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 117 lines · 90 tokens per session scan A ab4b27ef5c16

Subscribe to this mod's changes

law-to-markdown is a skill published in the GitHub repository pa1nrui1/legal-skills (85 stars, last pushed 2mo ago), licensed MIT. It adds 90 tokens to every session and 1,578 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

eu-ai-act-report-oliver-schmidt-prietz

Generates a formal, structured AI Act compliance assessment report suitable for legal files, audit trails, and regulatory inquiries. This skill should be used when the user asks to "generate an AI Act report", "create a compliance assessment report", "document the AI Act analysis", "create a Prüfbericht", "export as…

lawve-ai/awesome-legal-skills · 94 tokens

gdpr-privacy-notice-eu-oliver-schmidt-prietz

Draft GDPR/DSGVO-compliant privacy notices as .docx for any EU/EEA jurisdiction and audience. Use when user asks to create a privacy policy/notice, mentions "Datenschutzerklärung", "politique de confidentialité", "privacy notice", needs Art. 13/14 disclosures, AI Act transparency, cookie policy, or notices for…

lawve-ai/awesome-legal-skills · 177 tokens

litigation-deadline-calendar

Calendar litigation and arbitration deadlines from a scheduling order. Parses a PDF scheduling order, identifies key dates, computes backward deadlines using the applicable rules (Colorado CRCP, Federal FRCP, or arbitration forum rules for AAA/JAMS), and generates an .ics calendar file for Outlook or Google Calendar…

lawve-ai/awesome-legal-skills · 131 tokens

patent-reader

A plain-language reader for Chinese patents that turns a publication number or PDF into notes, diagrams, and an Obsidian entry. Obsidian is a note-taking app that stores linked Markdown files.

handsomestWei/patent-disclosure-skill · 31 tokens

meta-pdf-reformat-pipeline

Modernize a legacy PDF: structural extraction → natural-language rewrite of problem pages → audit summary → re-merge into the final PDF.

opensquilla/opensquilla · 35 tokens

software-copyright-materials

A workflow for creating Chinese application materials for software copyright registration from a real software project.

Fokkyp/SoftwareCopyright-Skill · 97 tokens