# How to Use the Patent-Disclosure Skill for Drafting Patent Disclosure Documents

> Automate patent disclosure document drafting with the patent-disclosure skill. This tool scans, mines, searches prior art, and generates formatted output efficiently.

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

---

**The patent-disclosure skill automates the transformation of raw project artefacts into complete patent disclosure documents through a four-stage pipeline that scans directories, mines inventive points, searches prior art, and generates formatted output.**

The **patent-disclosure skill** is a modular component of the **Instagit AgentSkills** suite designed to streamline intellectual property workflows. Hosted in the `handsomestWei/patent-disclosure-skill` repository, this tool converts raw project artefacts—including source code, design files, and Office documents—into structured patent disclosure documents (交底书) suitable for invention, utility-model, or design patent applications in the Chinese patent system.

## Core Architecture and Pipeline Stages

The skill implements a **stateless**, four-stage pipeline orchestrated by the **skill entry point** defined in [`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md). Each stage is implemented by distinct Python modules that process data sequentially from raw input to finalized documentation.

### Stage 1: Project Scanning and Document Conversion

The pipeline begins by recursively scanning the supplied project directory. The system automatically converts Word and PowerPoint files to Markdown format and extracts textual and visual information from all supported artefacts. This stage is documented in the capability table within [`skills/patent-disclosure/README.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/README.md).

### Stage 2: Patent-Point Mining

Following extraction, the **patent-point mining** module analyzes the converted content to identify candidate inventive points. The algorithm merges overlapping ideas and prepares a curated shortlist of technical innovations for inclusion in the final disclosure document. Configuration details for this stage appear in the "专利点" row of the capability matrix in the skill's README.

### Stage 3: Prior-Art Search via CNIPA

The third stage initiates an automated prior-art search against the China National Intellectual Property Administration (CNIPA) database. Using [`skills/patent-search/tools/cnipa_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/cnipa_search.py), the skill constructs a targeted search query and launches a Playwright browser instance to fetch the latest published patents relevant to the identified inventive points.

### Stage 4: Disclosure Generation and Output Formatting

In the final stage, the system renders a Markdown template incorporating the mined patent points and prior-art results. For utility-model and design cases, the skill automatically generates schematic line-drawings. The [`skills/patent-application/tools/md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-application/tools/md_to_docx.py) module then optionally converts the Markdown output to a Word document, depositing timestamped files in the `outputs/` directory.

## Prerequisites and Environment Setup

Before invoking the skill, you must configure the runtime environment to support web automation and document processing. The skill requires Python 3.9 or higher and specific browser drivers.

Install the required dependencies and browser binaries:

```bash
pip install -r requirements.txt
playwright install

```

These commands install the Python packages listed in [`requirements.txt`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/requirements.txt) and download the browser binaries required for the CNIPA search automation implemented in [`skills/patent-search/tools/cnipa_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/cnipa_search.py).

## Usage Examples

You can invoke the patent-disclosure skill through either the AgentSkills Python API or the command-line interface. Both methods accept a project directory path and execute the complete four-stage pipeline.

### Programmatic Invocation via Python API

The `agentskills` module provides a clean interface for loading and executing skills programmatically according to the specification in [`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md):

```python
from agentskills import Skill

# Load the skill by its internal name

disclosure = Skill.load("patent-disclosure")

# Run it on a local project directory

result = disclosure.run({"project_path": "/home/user/my-project"})

# `result` contains the paths of the generated files

print("Markdown:", result["markdown_path"])
print("Word:", result["word_path"])

```

This approach returns a dictionary containing file paths to the generated Markdown and Word documents stored in the stateless `outputs/` directory.

### Command-Line Execution

For automation scripts or manual execution, use the provided wrapper module:

```bash

# Run the skill, giving the project folder as argument

python -m skills.patent_disclosure.run /home/user/my-project

```

Alternatively, within an AgentSkills session, select the skill **"专利交底书编写"** or type the trigger phrase **「交底书」** to initiate the interactive workflow. Both methods assume execution from the repository's top-level directory with the root folder present on the Python import path.

## Key Source Files and Their Roles

Understanding the repository structure helps with customization and debugging:

- **[`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md)**: The formal skill definition used by the AgentSkills runtime. This file declares the entry point and configuration schema for the patent-disclosure module.
- **[`skills/patent-disclosure/README.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/README.md)**: Contains the detailed capability matrix documenting the four-stage pipeline, including the "查新" (prior-art search) and "交底书成稿" (disclosure generation) specifications.
- **[`skills/patent-search/tools/cnipa_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/cnipa_search.py)**: Implements the Playwright-based browser automation for retrieving CNIPA patent publications.
- **[`skills/patent-application/tools/md_to_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-application/tools/md_to_docx.py)**: Handles conversion of the generated Markdown disclosure into formatted Word documents suitable for legal review.
- **[`requirements.txt`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/requirements.txt)**: Lists all Python dependencies including `playwright`, `markdown`, and document processing libraries.

## Summary

- The **patent-disclosure skill** processes raw project directories through scanning, mining, searching, and generation stages defined in [`skills/patent-disclosure/README.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/README.md).
- Configuration resides in [`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md) while the runtime loads modules from `skills/patent-disclosure/` and related tool directories.
- Prior-art search requires Playwright browser automation targeting the CNIPA database via [`skills/patent-search/tools/cnipa_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/cnipa_search.py).
- Output includes timestamped Markdown and Word documents, along with automatically generated line-drawings, stored in the stateless `outputs/` directory.
- Invocation supports both the AgentSkills Python API (`Skill.load("patent-disclosure")`) and direct command-line execution.

## Frequently Asked Questions

### What file formats does the patent-disclosure skill support?

The skill recursively processes directories containing source code files, design images, and Office documents. It specifically converts Word and PowerPoint files to Markdown format during the initial project scanning stage, enabling extraction of textual and visual information from these proprietary formats for inclusion in the final disclosure document.

### Is the patent-disclosure skill suitable for international patent applications?

The skill is optimized for the Chinese patent system, particularly through its integration with the CNIPA (China National Intellectual Property Administration) database for prior-art searches. While the generated disclosure documents follow standard patent drafting conventions suitable for adaptation, the automated prior-art search functionality specifically targets Chinese patent publications via [`skills/patent-search/tools/cnipa_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/cnipa_search.py).

### How does the skill handle data persistence and versioning?

The architecture is deliberately stateless; each execution creates a fresh timestamped output directory under `outputs/`. This design preserves the full revision history and audit trail for each patent disclosure document generated, preventing overwrites and maintaining clear lineages between iterations without requiring external database configuration.

### What are the system requirements for running the prior-art search?

The CNIPA search functionality requires Python 3.9 or higher and Playwright browser automation tools. You must execute `playwright install` after installing Python dependencies to download the necessary browser binaries before running the skill, as the web scraping implementation in [`skills/patent-search/tools/cnipa_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/cnipa_search.py) relies on these components to interact with the CNIPA website.