How the Main Router in SKILL.md Directs Patent-Disclosure Skill Requests

The main router in SKILL.md acts as a policy gatekeeper that inspects user commands, validates explicit sub-skill targeting, enforces package isolation, and dispatches requests to the appropriate sub-skill's own SKILL.md file.

The SKILL.md file at the root of the handsomestWei/patent-disclosure-skill repository serves as the central routing engine for the entire patent-disclosure skill suite. Understanding how this main router in SKILL.md works is essential for extending the system or integrating it with client applications. The router implements a strict six-step verification flow that guarantees predictable behavior and prevents cross-skill contamination.

Intent Recognition and Capability Matching

The router begins by inspecting the user's intent against a capability table defined in the root SKILL.md (lines 16-22). Each row in this table maps a specific trigger phrase to a target sub-skill entry file.

When a request arrives with the Read intent, the router matches the command string against trigger phrases such as /patent-disclosure, /patent-application, /patent-search, /patent-docket, /patent-oa, or /patent-exam-policy. Upon finding a match, the router identifies the corresponding entry SKILL.md path (e.g., skills/patent-disclosure/SKILL.md) that should handle the request.

Explicit Naming Requirements for High-Level Workflows

For complex workflows including application file generation, docket orchestration, policy brief creation, and Office Action (OA) responses, the router enforces a strict explicit naming rule (lines 27-33 in SKILL.md).

If the user invokes a high-level command without explicitly naming the target sub-skill, the router aborts the flow immediately. Instead of proceeding with ambiguous context, it returns a prompt requiring the user to specify which sub-skill they intend to invoke. This prevents accidental execution of resource-intensive workflows like full patent application generation.

Read-Only Shortcuts for Patent Documents

The router implements a priority shortcut for read-only flows (lines 28-30). When the input consists of a patent number (e.g., CN1234567A) or a PDF file reference, and the intent is classified as "read", the router bypasses the standard disclosure workflow entirely.

In this scenario, the request is immediately forwarded to skills/patent-reader/SKILL.md without traversing the disclosure steps. This optimization ensures that document summarization and analysis tasks execute with minimal latency and without triggering unnecessary disclosure protocols.

Cross-Package Isolation Guards

To maintain clean architectural boundaries, the router enforces a cross-package call prohibition (lines 26-27). The system bans any import of tools or utilities from sibling sub-skill packages. Each sub-skill must rely exclusively on its own local copies of prompts, tools, and helper functions.

This isolation guard prevents side effects where one sub-skill's configuration might inadvertently alter another's behavior. When the router dispatches to skills/patent-application/SKILL.md, that sub-skill operates in a sealed environment using only its bundled resources.

Dispatch and Post-Routing Validation

Once the router validates the command and confirms explicit naming (where required), it performs a Read operation on the selected sub-skill's SKILL.md file. Control then transfers completely to that sub-skill, which manages its own detailed workflow—whether that involves the eight-step disclosure process, four-document application bundle generation, or docket orchestration.

After the sub-skill completes execution, the router performs post-routing checks (lines 48-53). It verifies that all required outputs are written to the designated outputs/ subdirectory (e.g., outputs/patent-application/, outputs/docket/) and confirms that no prohibited side-effects have occurred outside the skill's sandbox.

Practical Routing Examples

The following Python examples demonstrate how client applications interact with the router's decision flow:


# Triggering the full Disclosure workflow

request = {
    "intent": "Read",
    "command": "/patent-disclosure",
    "args": {"project_path": "/my/patent_project"}
}
router.handle(request)  # Dispatches to skills/patent-disclosure/SKILL.md

# Direct read of a patent PDF bypasses disclosure steps

request = {
    "intent": "Read",
    "command": "CN1234567A",
    "args": {}
}
router.handle(request)  # Shortcuts directly to skills/patent-reader/SKILL.md

# Blocked request due to missing explicit naming

request = {
    "intent": "Read",
    "command": "/policy-brief"
}
router.handle(request)  # Router aborts and prompts for explicit skill name

Sub-Skill Architecture and File Structure

The router manages dispatch to seven specialized sub-skills, each contained in its own directory under skills/:

Each sub-skill maintains its own isolated SKILL.md that defines granular workflow steps, while the root SKILL.md maintains the high-level routing matrix that binds trigger commands to these files.

Summary

  • The main router in SKILL.md implements a six-step verification flow: intent matching, explicit naming enforcement, read-only shortcut evaluation, cross-package isolation checks, sub-skill dispatch, and post-execution validation.
  • High-level workflows require explicit sub-skill naming; ambiguous commands are rejected with clarification prompts.
  • Patent numbers and PDF inputs trigger immediate routing to the Reader skill, bypassing disclosure workflows entirely.
  • Strict package isolation prevents sub-skills from importing tools from sibling directories, ensuring clean architectural boundaries.
  • All sub-skills route through dedicated SKILL.md files located in skills/patent-{name}/ directories, with outputs strictly confined to outputs/patent-{name}/ subdirectories.

Frequently Asked Questions

What happens if I invoke a patent command without specifying the sub-skill name?

The router blocks the execution and returns a prompt asking you to explicitly name the target sub-skill. According to the routing logic in SKILL.md (lines 27-33), high-level workflows such as application generation or policy brief creation require unambiguous targeting to prevent accidental resource consumption.

Can sub-skills share utility functions or tools across packages?

No. The router explicitly bans cross-package imports (lines 26-27 in SKILL.md). Each sub-skill must maintain its own local copy of utilities, prompts, and tools. This design prevents side effects and ensures that modifications to one sub-skill cannot inadvertently break others.

How does the router handle patent numbers versus workflow commands?

When the router detects a patent number (e.g., CN1234567A) or PDF reference with a Read intent, it immediately shortcuts to skills/patent-reader/SKILL.md without invoking the disclosure workflow. This read-only optimization (lines 28-30) ensures document analysis occurs with minimal overhead compared to full disclosure processing.

Where does the router store outputs after a sub-skill completes execution?

The router enforces a strict output convention requiring all generated files to reside in outputs/patent-{subskill}/ directories (lines 48-53). For example, application documents must appear under outputs/patent-application/, while docket outputs belong in outputs/docket/. The router validates these locations during post-routing checks.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →