How to Integrate handsomestWei/patent-disclosure-skill with AI Coding Assistants Like Claude Code or Cursor
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 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:
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:
# 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.
For example, to generate a patent disclosure, invoke run_step_to_views.py from the patent-disclosure skill:
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 in the repository root:
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:
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:
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.
-
Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P). -
Select Run Shell Command.
-
Enter the Python module execution string:
python -m skills.patent-disclosure.tools.run_step_to_views --project ./src --output ./patents -
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_viewsto analyze a codebase and generate a disclosure document. - Convert disclosure to application: Invoke
skills.patent-application.tools.emit_application_docxto transform an existing disclosure into claims, specification, abstract, and drawings. - Search CNIPA records: Execute
skills.patent-search.tools.cnipa_searchto query Chinese patent bibliographic data. - Parse patent PDFs: Run
skills.patent-reader.tools.browserto extract text from PDFs and create Obsidian-compatible notes.
Summary
- Clone
handsomestWei/patent-disclosure-skilland install dependencies fromrequirements.txtand sub-skill requirement files. - Use CLI-based execution by calling Python modules like
skills.patent-disclosure.tools.run_step_to_viewsdirectly 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 and the type hints used across the sub-skill modules.
How does the AgentSkills protocol work?
According to the 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 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.pyfor disclosure generationskills/patent-application/tools/emit_application_docx.pyfor application draftingskills/patent-search/tools/cnipa_search.pyfor CNIPA database queriesskills/patent-reader/tools/browser.pyfor document ingestion
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →