Skip to content

yuc16/PatentRadar / skills/patentradar

patentradar

Verified

专利侵权竞品分析 skill。输入专利公开号(CN/US/EP/JP 等),输出可人工复核的 markdown 竞品分析报告。工作流:拆解权利要求 → 搜索市场竞品 → 抓证据(含图像)→ 全部权利要求逐特征对比 → 生成报告。触发词:专利侵权分析、专利竞品、claim chart、专利公开号、CN/US/EP/JP 专利号、专利对比、技术特征对比、专利保护范围、侵权风险评估。不适用:专利申请文书撰写、专利无效宣告、知识产权法律咨询、专利诉讼策略。

schemas/validate.py

View on GitHub
"""Skill 内置的轻量 JSON Schema 校验器。

主 agent 在每个 subagent 跑完后调用这个脚本,把校验结果(成功 / 错误列表)
反馈给该 subagent,让它修正后重交。

用法:
    python skills/patentradar/schemas/validate.py <schema_name> <data_path>

schema_name 取值:task_package / top_competitor_report / full_claim_chart_report

成功:exit 0,stdout 打印 "OK <data_path>"
失败:exit 1,stdout 打印逐条错误(path + message)

依赖:jsonschema(pip install jsonschema 或项目 .venv 已装)
"""

from __future__ import annotations

import json
import sys
from pathlib import Path

SCHEMA_FILES = {
    "task_package": "task_package.schema.json",
    "top_competitor_report": "top_competitor_report.schema.json",
    "full_claim_chart_report": "full_claim_chart_report.schema.json",
}


def main() -> int:
    if len(sys.argv) != 3:
        print(f"usage: {sys.argv[0]} <schema_name> <data_path>", file=sys.stderr)
        print(f"schema_name ∈ {list(SCHEMA_FILES)}", file=sys.stderr)
        return 2

    schema_name = sys.argv[1]
    data_path = Path(sys.argv[2])

    if schema_name not in SCHEMA_FILES:
        print(f"unknown schema: {schema_name!r}; expected one of {list(SCHEMA_FILES)}", file=sys.stderr)
        return 2
    if not data_path.exists():
        print(f"data file not found: {data_path}", file=sys.stderr)
        return 2

    here = Path(__file__).resolve().parent
    schema_path = here / SCHEMA_FILES[schema_name]
    schema = json.loads(schema_path.read_text(encoding="utf-8"))
    data = json.loads(data_path.read_text(encoding="utf-8"))

    try:
        from jsonschema import Draft7Validator
    except ImportError:
        print("ERROR: jsonschema not installed. Run: pip install jsonschema", file=sys.stderr)
        return 2

    validator = Draft7Validator(schema)
    errors = sorted(validator.iter_errors(data), key=lambda e: list(e.path))
    business_errors: list[tuple[str, str]] = []
    if schema_name in {"top_competitor_report", "full_claim_chart_report"}:
        seen_companies: set[str] = set()
        for index, item in enumerate(data.get("top_competitors", [])):
            company = str(item.get("candidate", {}).get("company", "")).strip().lower()
            if company in seen_companies:
                business_errors.append(
                    (f"top_competitors.{index}.candidate.company", "TOP-N 中同公司只能保留最高分产品")
                )
            seen_companies.add(company)

    if not errors and not business_errors:
        print(f"OK {data_path}")
        return 0

    print(f"FAIL {data_path}: {len(errors) + len(business_errors)} error(s)")
    for err in errors:
        path = ".".join(str(p) for p in err.path) or "<root>"
        print(f"  [{path}] {err.message}")
    for path, message in business_errors:
        print(f"  [{path}] {message}")
    return 1


if __name__ == "__main__":
    sys.exit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall