# How to Integrate handsomestWei/patent-disclosure-skill with AI Coding Assistants Like Claude Code or Cursor

> Integrate handsomestWei/patent-disclosure-skill with Claude Code or Cursor. Use Python CLI or a FastAPI server to connect this powerful patent disclosure tool with your AI coding assistant.

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

---

**You can integrate the Patent Disclosure Skill with Claude Code or Cursor by executing its Python CLI entry points (e.g., `python -m skills.patent-disclosure.tools.run_step_to_views`) from the assistant’s terminal, or by wrapping the skill in a FastAPI server that handles HTTP requests from the AI.**

The `handsomestWei/patent-disclosure-skill` repository provides an AgentSkills-compliant collection of Python tools for patent automation. Each sub-skill—including `patent-disclosure`, `patent-application`, and `patent-search`—ships with its own [`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md) descriptor and command-line entry points that consume JSON input and emit machine-readable output. This architecture allows AI coding assistants to invoke complex patent drafting and analysis workflows directly from your development environment.

## Prerequisites and Installation

Before integrating with any AI assistant, clone the repository and install the required dependencies. The project requires **Python 3.9+** and uses isolated requirement files for each sub-skill.

Clone the repository and install core dependencies:

```bash
git clone https://github.com/handsomestWei/patent-disclosure-skill.git
cd patent-disclosure-skill
pip install -r requirements.txt

```

Install sub-skill dependencies based on the tools you plan to use:

```bash

# For disclosure generation

pip install -r skills/patent-disclosure/tools/requirements.txt

# For CNIPA patent searching (requires Playwright)

pip install -r skills/patent-search/tools/requirements-cnipa.txt

```

## Method 1: CLI-Based Integration

The primary integration method uses direct shell execution. Each sub-skill exposes a Python module that follows the AgentSkills protocol defined in the root [`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md).

For example, to generate a patent disclosure, invoke [`run_step_to_views.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/run_step_to_views.py) from the `patent-disclosure` skill:

```bash
python -m skills.patent-disclosure.tools.run_step_to_views \
    --project ./my-project \
    --output ./outputs/patent-disclosure

```

The script writes a JSON payload to STDOUT prefixed with `DOCX:`, which Claude Code or Cursor can parse to locate the generated document. This protocol allows the assistant to distinguish between status messages and deliverable file paths.

## Method 2: HTTP Service Integration

For persistent access without spawning new processes per request, wrap the CLI in a lightweight FastAPI server. Create a [`server.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/server.py) in the repository root:

```python
from fastapi import FastAPI, Request
import json
import subprocess

app = FastAPI()

@app.post("/run/patent-disclosure")
async def run_disclosure(req: Request):
    data = await req.json()
    proj = data.get("project")
    out_dir = data.get("output", "./outputs")
    cmd = [
        "python", "-m", "skills.patent-disclosure.tools.run_step_to_views",
        "--project", proj,
        "--output", out_dir,
    ]
    proc = subprocess.run(cmd, capture_output=True, text=True)
    return json.loads(proc.stdout)

```

Start the server:

```bash
uvicorn server:app --port 8000

```

Now the AI assistant can POST to `http://localhost:8000/run/patent-disclosure` with a JSON body containing the project path and output directory.

## Configuring Claude Code

Claude Code can execute shell commands directly in its environment. To enable patent disclosure generation, reference the CLI command in your prompt or project configuration.

Example prompt instruction:

```text
To draft a patent disclosure for the current project, execute:
python -m skills.patent-disclosure.tools.run_step_to_views --project /path/to/project --output /tmp/out

```

Claude Code will run the command, capture the JSON response from STDOUT, and import the resulting `.docx` file into your workspace.

## Configuring Cursor

Cursor integrates via the **Run Shell Command** action available in the Command Palette.

1. Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`).
2. Select **Run Shell Command**.
3. Enter the Python module execution string:
   ```bash
   python -m skills.patent-disclosure.tools.run_step_to_views --project ./src --output ./patents
   ```

4. Cursor displays the JSON response in the Terminal tab, which you can pipe to a file or parse automatically.

## Practical Usage Scenarios

Once integrated, you can invoke specific workflows by referencing the appropriate entry points:

- **Draft a new invention disclosure**: Use `skills.patent-disclosure.tools.run_step_to_views` to analyze a codebase and generate a disclosure document.
- **Convert disclosure to application**: Invoke `skills.patent-application.tools.emit_application_docx` to transform an existing disclosure into claims, specification, abstract, and drawings.
- **Search CNIPA records**: Execute `skills.patent-search.tools.cnipa_search` to query Chinese patent bibliographic data.
- **Parse patent PDFs**: Run `skills.patent-reader.tools.browser` to extract text from PDFs and create Obsidian-compatible notes.

## Summary

- Clone `handsomestWei/patent-disclosure-skill` and install dependencies from [`requirements.txt`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/requirements.txt) and sub-skill requirement files.
- Use **CLI-based execution** by calling Python modules like `skills.patent-disclosure.tools.run_step_to_views` directly from the AI assistant’s terminal.
- Implement an **HTTP service wrapper** using FastAPI to expose the skills as a local REST API for persistent connections.
- Configure **Claude Code** by embedding the shell command in prompts or project settings.
- Configure **Cursor** using the Run Shell Command action to execute skill modules and capture JSON output.

## Frequently Asked Questions

### What Python version is required for handsomestWei/patent-disclosure-skill?

The repository requires **Python 3.9 or higher**. This is enforced by the dependency specifications in [`requirements.txt`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/requirements.txt) and the type hints used across the sub-skill modules.

### How does the AgentSkills protocol work?

According to the [`SKILL.md`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/SKILL.md) specification in the repository root, the AgentSkills protocol requires tools to accept input via command-line arguments or JSON on STDIN, and to return structured results as JSON on STDOUT. The `patent-disclosure` skill specifically prefixes deliverable paths with `DOCX:` to signal document generation completion.

### Can I integrate this with AI assistants other than Claude Code or Cursor?

Yes. Any AI assistant capable of executing shell commands or making HTTP requests can invoke the skill. The CLI entry points in [`skills/patent-disclosure/tools/run_step_to_views.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/run_step_to_views.py) and sibling modules use standard POSIX interfaces, making them compatible with GitHub Copilot, GPT-4 Code Interpreter, or custom agent frameworks.

### Where are the main entry point scripts located?

The primary automation scripts reside in each sub-skill’s `tools` directory. Key files include:
- [`skills/patent-disclosure/tools/run_step_to_views.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-disclosure/tools/run_step_to_views.py) for disclosure generation
- [`skills/patent-application/tools/emit_application_docx.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-application/tools/emit_application_docx.py) for application drafting
- [`skills/patent-search/tools/cnipa_search.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-search/tools/cnipa_search.py) for CNIPA database queries
- [`skills/patent-reader/tools/browser.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/browser.py) for document ingestion