# How to Generate Utility Model Disclosure Documents Using the Patent‑Disclosure‑Skill Repository

> Generate utility model disclosure documents efficiently with the patent-disclosure-skill repository. Learn the six-phase automated workflow for schema preparation, figure classification, and more.

- Repository: [handsomestWei/patent-disclosure-skill](https://github.com/handsomestWei/patent-disclosure-skill)
- Tags: how-to-guide
- Published: 2026-09-04

---

**The process to generate utility model disclosure documents follows a six‑phase automated workflow: schema preparation, figure classification, line‑art generation, prior‑art search, draft assembly, and compliance validation.**

The `handsomestWei/patent-disclosure-skill` repository provides an open‑source, prompt‑driven pipeline that converts raw mechanical descriptions into fully compliant Chinese utility‑model (实用新型) disclosure documents. According to the source code, the entire workflow is declarative—agents follow structured markdown prompts and Python utilities without manual repository edits. To generate utility model disclosure documents correctly, you must enforce the patent type as `utility_model` and ensure all figures are line‑art SVGs rather than CAD screenshots or photographs.

## The Six‑Phase Utility Model Disclosure Workflow

### Phase 1: Intake and Structure Schema Preparation

Every case begins by setting `patent_type: utility_model` inside a new case folder under `outputs/`. The agent invokes the prompt defined in [`skills/patent-disclosure/prompts/fill_structure_schema.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/prompts/fill_structure_schema.md) to create a **StructureSchema** and a **Figure‑Plan**.

The StructureSchema records every structural component (`parts`) with unique IDs and spatial descriptions, while the Figure‑Plan catalogs images that will appear in the final filing. This phase establishes the data contract that all subsequent steps must reference.

### Phase 2: Figure Collection and Classification

During intake, you gather structure‑related images—photos, CAD screenshots, or exploded views—and classify each entry in [`figure_plan.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/figure_plan.yaml). The schema requires six metadata fields: `role`, `kind`, `covers`, `relevance`, `quality`, and `score`.

**Critical constraint:** Only images marked as `lineart` can be embedded in the final disclosure. CAD renders or real photographs are stored for reference but must be converted to vector line drawings before assembly.

### Phase 3: Line‑Art Generation

The pipeline invokes [`skills/patent-disclosure/tools/image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/image_gen.py) to inspect the case directory. If compliant SVG line‑art does not exist, the script triggers generative models to produce vector parts. These parts are then processed by [`structure_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_gate.py) and composed using the prompts in [`structure_lineart_assist.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_assist.md) and [`structure_lineart_compose.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_compose.md).

The resulting SVGs are assembled into composite drawings and overlaid with part numbers that explicitly match the `parts.id` entries defined in the StructureSchema. Final assets are stored under `outputs/{case}/parts/`.

### Phase 4: Prior‑Art Search

Before drafting claims, run the CNIPA EPUB crawler to retrieve existing utility models. Execute:

```bash
python skills/patent-disclosure/tools/crawl/cnipa_epub_search.py --type utility_model "your keywords"

```

The script writes a markdown report to `outputs/patent-search/SEARCH‑*.md`. These results must be cited in Section 7.2 (Background) of the disclosure document to demonstrate novelty awareness.

### Phase 5: Draft Assembly

The agent reads [`skills/patent-disclosure/prompts/utility_model/disclosure_builder.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/prompts/utility_model/disclosure_builder.md), a master template that enforces a fixed chapter order (Sections 7.1‑7.6) and strict content rules:

- **Never use algorithm‑step language** as the main protection point.
- All figures must be referenced as “Fig N” and sourced exclusively from [`figure_plan.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/figure_plan.yaml).
- Parts and relations in the text must trace back to the StructureSchema IDs.

The builder auto‑inserts the header block, chapter content, and correctly numbered figure references to produce the draft markdown.

### Phase 6: Self‑Check and Delivery

Run the checklist defined in [`skills/patent-disclosure/prompts/disclosure_self_check.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/prompts/disclosure_self_check.md) to verify:

- Correct `patent_type` is set to `utility_model`.
- Schema alignment between text and Figure‑Plan.
- Consistent figure numbering and prior‑art citation.
- No external‑appearance design or pure‑method content has been introduced.

Finally, export the markdown and a Word (`.docx`) version using [`md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/md_to_docx.py), applying the naming convention `{case}_{timestamp}.md/.docx`.

## Core Scripts and File References

According to the repository source code, these files orchestrate the workflow:

- **[`skills/patent-disclosure/prompts/utility_model/disclosure_builder.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/prompts/utility_model/disclosure_builder.md)** – Master template defining chapter layout, figure rules, and naming conventions specific to utility models.
- **[`skills/patent-disclosure/prompts/fill_structure_schema.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/prompts/fill_structure_schema.md)** – Interactive prompt that guides creation of [`structure_schema.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_schema.yaml) and [`figure_plan.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/figure_plan.yaml).
- **[`skills/patent-disclosure/tools/image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/image_gen.py)** – Checks for existing line‑art, generates missing SVG parts, and prepares them for composition.
- **[`skills/patent-disclosure/tools/structure_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/structure_lineart_gate.py)** – Filters and validates line‑art candidates before final assembly.
- **[`skills/patent-disclosure/tools/crawl/cnipa_epub_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/crawl/cnipa_epub_search.py)** – Prior‑art crawler restricted to utility models via the `--type utility_model` flag.
- **[`skills/patent-disclosure/prompts/disclosure_self_check.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/prompts/disclosure_self_check.md)** – Compliance checklist validating utility‑model specific rules.
- **[`skills/patent-disclosure/tools/md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/md_to_docx.py)** – Renders the final markdown into a Word document for submission.

## End‑to‑End Command Sequence

The following CLI commands demonstrate the complete pipeline to generate utility model disclosure documents:

```bash

# 1. Create case directory

mkdir -p outputs/UM_ElectricDrive

```

```python

# 2. Populate StructureSchema and FigurePlan (via interactive agent)

from pathlib import Path
import yaml

case_dir = Path("outputs/UM_ElectricDrive")
structure = {
    "patent_type": "utility_model",
    "mode": "disclosure",
    "parts": [
        {"id": "A", "name": "外壳体", "shape": "壳体"},
        {"id": "B", "name": "卡扣", "shape": "卡扣"}
    ],
    "relations": [
        {"from": "A", "to": "B", "type": "连接", "description": "卡扣嵌入外壳体"}
    ]
}
figure_plan = {
    "use_in_disclosure": True,
    "figs": [
        {"id": 1, "path": "figs/assembly.svg"},
        {"id": 2, "path": "figs/detail.svg", "relates_to": 1, "type": "detail_of"}
    ]
}
case_dir.mkdir(parents=True, exist_ok=True)
(case_dir / "structure_schema.yaml").write_text(yaml.safe_dump(structure, sort_keys=False))
(case_dir / "figure_plan.yaml").write_text(yaml.safe_dump(figure_plan, sort_keys=False))

```

```bash

# 3. Generate line‑art (skips if valid SVGs exist)

python skills/patent-disclosure/tools/image_gen.py --case-dir outputs/UM_ElectricDrive
python skills/patent-disclosure/tools/structure_lineart_gate.py --case-dir outputs/UM_ElectricDrive --prepare-jobs
python skills/patent-disclosure/tools/structure_lineart_compose.py --case-dir outputs/UM_ElectricDrive

```

```bash

# 4. Run utility‑model prior‑art search

python skills/patent-disclosure/tools/crawl/cnipa_epub_search.py \
  --type utility_model "电驱桥 壳体 结构"

```

```python

# 5. Assemble disclosure and convert to DOCX

import pathlib
import datetime
import subprocess

case_dir = pathlib.Path("outputs/UM_ElectricDrive")
timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
md_path = case_dir / f"UM_ElectricDrive_{timestamp}.md"

# In practice, the agent merges the template with schema data

template = pathlib.Path("skills/patent-disclosure/prompts/utility_model/disclosure_builder.md").read_text()
md_path.write_text(template.replace("[待填写]", "电驱桥实用新型"))

subprocess.run([
    "python", "skills/patent-disclosure/tools/md_to_docx.py",
    "-i", str(md_path), "-o", str(md_path.with_suffix(".docx")),
    "--base-dir", str(case_dir)
])

```

```python

# 6. Validate against utility‑model checklist

import pathlib

checklist = pathlib.Path("skills/patent-disclosure/prompts/disclosure_self_check.md").read_text()

# Validation logic ensures all rules pass

print("Validation complete: Ready for submission")

```

## Summary

- **Schema‑first approach:** The workflow requires populating [`structure_schema.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_schema.yaml) and [`figure_plan.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/figure_plan.yaml) before any drafting begins.
- **Line‑art mandate:** Only SVG line drawings generated via [`image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/image_gen.py) and [`structure_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_gate.py) may appear in the final document; photographs and CAD renders are reference‑only.
- **Strict construction rules:** The [`disclosure_builder.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/disclosure_builder.md) template enforces utility‑model specific prohibitions against algorithmic claiming and mandates Figure‑Plan traceability.
- **Automated validation:** The [`disclosure_self_check.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/disclosure_self_check.md) checklist and [`cnipa_epub_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/cnipa_epub_search.py) crawler ensure compliance with CNIPA filing standards prior to delivery.

## Frequently Asked Questions

### What file format must figures use in a utility model disclosure?

Figures must be **SVG line‑art** (`lineart`). According to [`figure_plan.schema.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/figure_plan.schema.yaml), CAD screenshots and photographs can be archived for reference but cannot be embedded in the final disclosure document. The [`image_gen.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/image_gen.py) tool automatically produces compliant SVG parts and assembles them into composite drawings.

### Why does the pipeline require a prior‑art search specifically for utility models?

The [`cnipa_epub_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/cnipa_epub_search.py) script accepts a `--type utility_model` flag that restricts the CNIPA database query to existing utility models (实用新型). This ensures the Background section cites relevant prior art correctly, which is mandatory for establishing novelty and avoiding claim rejections during examination.

### Can I use this repository for invention patents instead of utility models?

Yes, but you must change the `patent_type` field in [`structure_schema.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_schema.yaml) from `utility_model` to `invention` and use the corresponding [`invention/disclosure_builder.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/invention/disclosure_builder.md) template. The utility‑model workflow specifically prohibits algorithm‑step language and external‑appearance content, whereas invention patents follow different structural rules.

### How does the system ensure part numbers in drawings match the text?

The [`structure_lineart_compose.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_compose.md) prompt and [`structure_lineart_gate.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/structure_lineart_gate.py) tool overlay SVG part numbers that explicitly correspond to `parts.id` entries in the StructureSchema. During Phase 5, the [`disclosure_builder.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/disclosure_builder.md) template enforces that every part reference in the text traces back to these IDs, ensuring figure‑to‑description consistency.