How to Generate an Invention Patent Disclosure Document Using patent-disclosure-skill

The patent-disclosure-skill automates the creation of Chinese invention patent disclosure documents through an eight-step pipeline that scans project files, generates line-art, performs prior-art searches, and outputs timestamped Markdown and Word files.

The handsomestWei/patent-disclosure-skill repository provides an open-source framework for generating comprehensive invention patent disclosure documents (交底书) for the Chinese patent system. This skill organizes complex patent workflows into modular sub-skills, with the patent-disclosure sub-skill specifically handling the end-to-end creation of technical disclosure documents from raw project materials.

Understanding the Patent-Disclosure-Skill Architecture

The system implements a three-layer architecture that separates routing, orchestration, and execution concerns.

Entry Point and Routing

The process begins at SKILL.md in the repository root, which parses user intents such as "交底书" (disclosure document) and routes requests to skills/patent-disclosure/SKILL.md. This entry point validates the patent type—invention, utility model, or design—and initializes the appropriate pipeline context.

The Orchestration Layer

skills/patent-disclosure/README.md drives the eight-step workflow through a series of prompt files stored in skills/patent-disclosure/prompts/. The orchestrator manages:

  • Project scanning and technical material ingestion
  • Structure and appearance line-art generation
  • Patent point extraction from source code
  • Prior-art search against CNIPA databases
  • Drafting using standardized templates
  • Self-check and iterative refinement
  • Timestamped output generation

Implementation Tools

Python utilities in skills/patent-disclosure/tools/ handle specific technical operations:

Step-by-Step Document Generation Workflow

The invention disclosure pipeline follows a strict sequence defined in the orchestrator prompts:

  1. Project Scanning – The tool scans the target directory, converting proprietary formats to Markdown and identifying candidate technical features.

  2. Line-Art Generation – Based on detected project structure, the system invokes structure_lineart_gate.py or design_lineart_gate.py to produce technical drawings required for the disclosure.

  3. Patent-Point Extraction – The system analyzes source code and documentation to identify novel technical features eligible for patent protection.

  4. Prior-Art Search – Optional CNIPA EPUB queries retrieve existing patents to inform the novelty analysis and background section drafting.

  5. Drafting – The orchestrator loads skills/patent-disclosure/prompts/invention/disclosure_builder.md, which defines the exact chapter layout including headers for 案件名称 (case name), 技术联系人 (technical contact), and 专利类型 (patent type).

  6. Self-Check – Internal validators such as check_formula_plan.py and lint_patent_note.py verify claim structure and technical consistency without modifying the output document.

  7. Iteration – The pipeline supports revision cycles to refine technical descriptions based on initial outputs.

  8. Output Generation – Final Markdown and Word documents are written with timestamped filenames to prevent version conflicts.

Running the Disclosure Pipeline

Execute the complete workflow using the main orchestration script from the repository root:


# Run the full disclosure pipeline on a project folder

python -m skills.patent-disclosure.tools.run_step_to_views \
  --project-path /path/to/your/project \
  --output-dir outputs/patent_disclosure \
  --patent-type invention

This command automatically handles project scanning, diagram generation, prior-art research, and document compilation. The script generates both Markdown and Word outputs with synchronized timestamps.

For manual diagram rendering after pipeline completion:


# Convert mermaid diagrams to PNG embeddings

python -m skills.patent-disclosure.tools.mermaid_render \
  -i outputs/patent_disclosure/Your_Invention_Name_20231215094530.md \
  -o outputs/patent_disclosure/Your_Invention_Name_20231215094530.md

To separately convert Markdown to Word format:


# Transform Markdown to Word document

python -m skills.patent-disclosure.tools.md_to_docx \
  -i outputs/patent_disclosure/Your_Invention_Name_20231215094530.md \
  -o outputs/patent_disclosure/Your_Invention_Name_20231215094530.docx

Output Files and Naming Conventions

Upon completion, the skill writes files to the outputs/patent_disclosure/ directory following the naming convention specified in § 7.3‑7.5 of the template:


{案件名称}_{YYYYMMDDHHmmss}.md
{案件名称}_{YYYYMMDDHHmmss}.docx

The timestamp format ensures each iteration produces distinct versions, maintaining full revision history without overwriting previous drafts. The Markdown version preserves mermaid source blocks for reproducibility, while the Word document embeds the rendered PNG diagrams for attorney submission.

Summary

  • The patent-disclosure-skill implements an eight-step pipeline for automated generation of Chinese invention patent disclosure documents.
  • Entry routing occurs through SKILL.md (root) → skills/patent-disclosure/SKILL.md based on user intent analysis.
  • Technical tools including structure_lineart_gate.py, mermaid_render.py, and md_to_docx.py handle diagram generation and document conversion.
  • Template compliance is enforced through skills/patent-disclosure/prompts/invention/disclosure_builder.md, ensuring proper chapter ordering and metadata fields.
  • Output files follow strict timestamped naming conventions ({案件名称}_{YYYYMMDDHHmmss}) in both Markdown and Word formats.
  • The system operates locally without external service dependencies except for optional CNIPA database queries during prior-art search.

Frequently Asked Questions

What is the patent-disclosure-skill?

The patent-disclosure-skill is a sub-skill within the handsomestWei/patent-disclosure-skill repository that automates the drafting of technical disclosure documents (交底书) required for Chinese patent applications. It processes project source files, technical documentation, and diagrams to produce standardized Markdown and Word outputs suitable for patent attorney review.

How does the skill handle technical diagrams?

The skill automatically generates and renders technical diagrams through structure_lineart_gate.py for mechanical structures and design_lineart_gate.py for appearance designs. System flowcharts defined in mermaid syntax are rendered to PNG via mermaid_render.py using Playwright, then embedded into the final Word document by md_to_docx.py.

Can I customize the disclosure template?

Yes. The template structure is defined in skills/patent-disclosure/prompts/invention/disclosure_builder.md, which specifies the chapter order (Section 7.1) and required header fields. Users can modify this prompt file to adjust section layouts, add custom technical fields, or adapt the document structure for specific technical domains while maintaining compliance with Chinese patent office requirements.

Where are the generated files saved?

Completed disclosure documents are written to outputs/patent_disclosure/ relative to the execution directory. Files follow the pattern {案件名称}_{YYYYMMDDHHmmss}.md and corresponding .docx extensions, where the timestamp ensures version control and prevents accidental overwrites during iterative refinement cycles.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →