elements-complaint-generator

Convert conventional Chinese legal complaints into official element-style Word documents.

636|91|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/cat-xierluo/legal-skills --skill elements-complaint-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: elements-complaint-generator
Source: https://github.com/cat-xierluo/legal-skills/tree/main/skills/elements-complaint-generator
Command: npx skills add https://github.com/cat-xierluo/legal-skills --skill elements-complaint-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires lxml, pymupdf, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Chinese courts now require complaints filed in the Supreme Court's official element-style format (法〔2025〕82 号), and manually reformatting an existing complaint into these rigid templates is slow and error-prone. This Skill converts a lawyer's existing complaint (Markdown, docx, or conversational description) into a court-ready element-style Word document with pixel-level format fidelity.

Core Features & Use Cases

  • Three-stage pipeline: case-cause matching against 113 official template trees, LLM-based element extraction into a reviewable elements.json, then deterministic lxml-based OOXML rendering that preserves fonts, tables, and checkboxes.
  • Full coverage of 68 case causes: 26 finely-tuned causes (divorce, private lending, IP infringement, labor disputes, enforcement applications, etc.) plus generic-level rendering for the rest, with automatic party blocks, mediation sections, and signature dates.
  • Layout gate with fail-safe publishing: candidate DOCX files are validated via LibreOffice real PDF rendering (A4 geometry, table centering, continuous page numbers, blank-page detection) before atomically replacing any existing output.
  • Use Case: A lawyer has a conventional complaint for a private lending dispute. The Skill matches cause 09-private-lending, extracts parties/claims/facts into elements.json for human review, then renders a court-submittable 要素式起诉状.docx.

Quick Start

Convert my attached conventional complaint markdown into an official element-style complaint Word document for a private lending dispute.

Frequently Asked Questions about elements-complaint-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an element-style complaint (要素式起诉状) from an existing complaint?

Run the three-stage pipeline: match the case cause against the routing table, extract elements into elements.json (LLM-led with regex fallback), then render with fill_template.py using the case-type key. Human review of elements.json is required before rendering.

What case causes does this Chinese legal complaint generator support?

It covers all 68 numbered case causes from the Supreme Court's 法〔2025〕82 号 templates, with 26 finely-tuned causes (divorce, private lending, copyright, trademark, patent, labor, traffic accidents, enforcement applications) and generic-level rendering for the remainder.

What dependencies are required to render the Word documents?

Rendering requires Python 3.11+, lxml for OOXML editing, PyMuPDF for PDF geometry checks, and LibreOffice for real DOCX-to-PDF rendering. Missing LibreOffice or PyMuPDF causes explicit failure rather than silent downgrade.

Does it support answer statements (答辩状) or third-party statements?

No. The 45 answer-statement and third-party-opinion template trees are intentionally not integrated; the Skill focuses on complaint generation only, per its stated scope.

Why does the rendered PDF show missing Chinese glyphs?

Templates reference fonts like 方正书宋_GBK and 方正小标宋_GBK; if these are unavailable on the machine, the PDF text layer remains intact but glyphs may not display. Verify fonts in actual Word/WPS before court submission.

Can I batch-generate complaints for multiple cases?

Yes, fill_template.py supports --batch mode: each *-elements.json in a directory is routed by its internal case_type and rendered into a corresponding element-style docx in isolated subprocesses.