You are responsible for organizing the raw technical materials into a complete draft of a Chinese patent application. The core deliverables include:
- Abstract of the Description
- Claims
- Description
- Drawings / Mermaid diagrams
- Final merged document
Initialization
API Key requirements:
- Required:
SERPAPI_API_KEY- Purpose:
google-patents-mcp.search_patents, used for Google Patents search
- Purpose:
- Optional:
EXA_API_KEY- Purpose:
exa.web_search_exa/exa.crawling_exa - When not configured: does not affect the main workflow; product, paper, and web material searches fall back to the coding agent's built-in search/browsing capabilities
- Purpose:
Before starting, you must run:
bash <SKILL_DIR>/scripts/init.sh
If the check fails, stop execution and tell the user which command or environment variable is missing.
Record the output of SKILL_DIR=...。
Dependency files
- General writing guidelines:
<SKILL_DIR>/references/patent-writing-guide.md - mcporter configuration:
<SKILL_DIR>/references/mcporter.json - Sub-agent prompt:
<SKILL_DIR>/references/prompts/*.md
External tool conventions
Document conversion
For .pdf / .docx input, always use:
markitdown <input-file> -o <output-file>
Do not hand-write the "converted Markdown" yourself; you must perform a real conversion first.
Search
The search compatibility mechanism is as follows:
- Google Patents search must be performed through
mcporterCLI - Exa search is an optional enhancement
- If Exa is not configured or unavailable, product, paper, and web material searches fall back to the coding agent's built-in search/browsing capabilities
mcporter format for Google Patents / Exa:
mcporter call <server>.<tool> --config <SKILL_DIR>/references/mcporter.json key=value ...
Available mcporter services:
google-patents-mcp.search_patentsexa.web_search_exaexa.crawling_exa
Do not use WebSearch、WebFetch、mcp__... in prompts; this is an outdated form.
Working directory
After receiving the request, create:
uuid=$(python3 -c "import uuid;print(uuid.uuid4())")
WORK_DIR=output/temp_${uuid}
mkdir -p ${WORK_DIR}/{01_input,02_research,03_outline,04_content,05_diagrams,06_final,metadata}
If the user specifies a UUID, reuse that UUID.
Workflow
Execute in the following 8 stages in order, with acceptance checks at each stage.
Stage 1: Input parsing
Prompt:<SKILL_DIR>/references/prompts/input-parser.md
Input:
- The raw technical files provided by the user
Output:
${WORK_DIR}/01_input/source.md${WORK_DIR}/01_input/parsed-input.json
Acceptance:
source.mdexistsparsed-input.jsonis valid JSON, containing fields such as title, technical problem, technical solution, and keywords
Stage 2: Patent search
Prompt:<SKILL_DIR>/references/prompts/patent-searcher.md
Input:
${WORK_DIR}/01_input/parsed-input.json
Output:
${WORK_DIR}/02_research/search-report.md${WORK_DIR}/02_research/similar-patents-reference.md
Acceptance:
- Both files exist
- Search keywords, similar patents, and writing references are complete
Stage 3: Outline generation
Prompt:<SKILL_DIR>/references/prompts/outline-generator.md
Input:
${WORK_DIR}/01_input/parsed-input.json${WORK_DIR}/02_research/similar-patents-reference.md
Output:
${WORK_DIR}/03_outline/outline.json
Acceptance:
- Valid JSON
- Contains the abstract, claims, each section of the description, and word count requirements
Stage 4: Abstract writing
Prompt:<SKILL_DIR>/references/prompts/abstract-writer.md
Output:
${WORK_DIR}/04_content/abstract.md
Acceptance:
- Less than 300 characters
- Consistent with the technical solution and the independent claims
Stage 5: Claims writing
Prompt:<SKILL_DIR>/references/prompts/claims-writer.md
Output:
${WORK_DIR}/04_content/claims.md
Acceptance:
- Includes the method, apparatus/system, electronic device, and storage medium dimensions
- Structure and numbering conform to standards
Stage 6: Description writing
Prompt:<SKILL_DIR>/references/prompts/description-writer.md
Output:
${WORK_DIR}/04_content/description.md
Acceptance:
- Includes technical field, background technology, summary of the invention, description of the drawings, and specific embodiments
- The specific embodiments are the main part
Stage 7: Drawing generation
Prompt:<SKILL_DIR>/references/prompts/diagram-generator.md
Output:
${WORK_DIR}/05_diagrams/diagrams.md
Acceptance:
- Contains Mermaid code blocks
- Step/module numbering is consistent with the specification
Stage 8: Final merge
Prompt:<SKILL_DIR>/references/prompts/markdown-merger.md
Input:
${WORK_DIR}/04_content/abstract.md${WORK_DIR}/04_content/claims.md${WORK_DIR}/04_content/description.md${WORK_DIR}/05_diagrams/diagrams.md
Output:
${WORK_DIR}/06_final/final_patent.md${WORK_DIR}/metadata/quality-check.json
Acceptance:
final_patent.mdexists- Terminology is consistent throughout the text
quality-check.jsonexists
Sub-agent invocation template
The complete context must be passed to the sub-agent; do not just paste the prompt file path. Use the following template:
你正在执行 patent-writer-agent 的子任务:<agent-name>
第一步,完整阅读以下 prompt 文件:
<PROMPT_FILE_ABS_PATH>
固定上下文:
- skill 根目录:<SKILL_DIR_ABS_PATH>
- 专利写作规范:<SKILL_DIR_ABS_PATH>/references/patent-writing-guide.md
- 工作目录:<WORK_DIR_ABS_PATH>
本阶段允许读取的输入文件:
- <INPUT_FILE_1_ABS_PATH>
- <INPUT_FILE_2_ABS_PATH>
本阶段必须写入的输出文件:
- <OUTPUT_FILE_1_ABS_PATH>
- <OUTPUT_FILE_2_ABS_PATH>
如涉及文档转换:
- 必须执行:markitdown <input> -o <output>
如涉及检索:
- Google Patents 必须执行:mcporter call google-patents-mcp.search_patents --config <SKILL_DIR_ABS_PATH>/references/mcporter.json key=value ...
- Exa 可用时,优先执行 Exa 检索与抓取
- Exa 不可用时,回退到 coding agent 内置搜索/浏览能力完成非专利资料检索
- 先执行检索,再整理结果写入文件
约束:
- 不得修改未授权的文件
- 术语必须前后一致
- 最终回复只报告是否完成、输出路径、是否存在剩余风险
Writing principles
- Reasonable expansion of implementation details, parameter ranges, module relationships, and boundary handling is allowed
- Changing the user's core solution is not allowed
- Plagiarizing similar patents is strictly prohibited
- The terminology in the claims and the specification must be consistent
- The abstract, claims, and specification must mutually support one another
Quality standards
- The invention title must not exceed 25 characters
- The abstract must not exceed 300 characters
- The specification structure is complete
- The specific embodiments sufficiently support the claims
- The drawing numbering is consistent with the references in the text
- Unified terminology, self-consistent logic, and no promotional language