Convert raw Chinese legal texts — statutes or court cases — into clean, structured Markdown, stripping promotional noise while preserving every word of substance.
npx clawhub@latest install legal-text-formatLegal Text Format is a formatting and cleanup skill purpose-built for Chinese legal documents. It accepts raw statutory text (e.g. Civil Code, Criminal Law) or case documents (e.g. Supreme Court model cases, judicial decisions) and outputs well-structured Markdown with correct heading hierarchy, unified punctuation, and all promotional or irrelevant content removed.
The skill handles two distinct document types automatically: legal statutes (章/条 structure with bolded article numbers) and legal cases (case title, docket number, facts, ruling, and significance). Every formatting result is archived locally alongside the original input, giving you a verifiable before/after record.
Important: This skill is a formatter only — it does not fetch content from URLs. Web or WeChat article retrieval should be handled by a dedicated fetch skill (e.g. wechat-article-fetch), which can chain directly into this skill.
wechat-article-fetch) has retrieved a WeChat legal article and needs to hand it off for formatting — this skill accepts that file path directly.The skill uses an LLM prompt to classify incoming text as either a legal statute or a legal case before applying the appropriate formatting ruleset. This means you don't need to specify the type — the skill adapts automatically based on structural signals like chapter headings, article numbers, or case docket patterns.
For statutory text, chapters receive ## headings, each article (第X条) is bolded, blank lines are added between articles, and any trailing line-breaks without a closing punctuation mark are cleaned up. All substantive content is preserved verbatim — no clause is ever truncated.
For case documents, each case title or sequence number gets a ## heading, sub-sections (facts, ruling, significance) get ### headings, English punctuation is replaced with Chinese equivalents, and numbers are normalized to half-width. Introductory text, author bios, footers, QR-code promotions, and recommended-article blocks are automatically stripped.
Every run saves both the raw input and the formatted output into a timestamped subdirectory under archive/. Files follow a predictable naming convention (YYYYMMDD_主题_raw.md / _formatted.md), making it easy to audit changes or recover the original text. An optional meta.json captures run metadata.
When wechat-article-fetch (or another fetch skill) detects legal content and this skill is installed, it can pass a file path directly as input. The skill reads the saved Markdown, runs the full format pipeline, and writes results to its own archive/ directory — no manual handoff required.
Formatting changes are strictly cosmetic: punctuation normalization, heading levels, and whitespace. Case numbers, court names, party names, article text, and all substantive legal content are preserved exactly as received. The original file is always kept as a reference.
A user copies several chapters of the 民法典 into the chat. The skill detects statute structure, wraps each chapter in ##, bolds every 第X条, normalizes spacing, and saves raw.md plus formatted.md to a timestamped archive folder — ready to import into a knowledge base.
A legal researcher fetches a WeChat article containing 10 Supreme Court model cases. The skill strips the article intro, author bio, and trailing promotional content, then applies consistent ##/### heading hierarchy and Chinese punctuation across all 10 cases, producing a clean reference document.
A law student regularly processes judicial decisions for study. Each formatted file lands in its own dated archive directory with a metadata header that includes the source URL (when provided by a fetch skill), processing timestamp, and document type — making the library easy to search and cite.
With wechat-article-fetch installed, a user provides a WeChat public-account link. The fetch skill retrieves the article and automatically triggers legal-text-format, which formats and archives the result without any additional user input — the entire pipeline runs as a single request.
npx clawhub@latest install legal-text-formatnpx clawhub@latest install legal-text-formatLog in to write a review
No reviews yet. Be the first to share your experience!