# MASTER-ROUTING.md Priority Order: Complete Rule Matrix for Reverse Skill Routing

> Understand the priority order of rules in MASTER-ROUTING.md from R1 to R39 and the R0 fallback for reverse skill routing. Master rule evaluation for optimal routing.

- Repository: [ZhaoXu/reverse-skill](https://github.com/zhaoxuya520/reverse-skill)
- Tags: how-to-guide
- Published: 2026-08-01

---

**The priority order in MASTER-ROUTING.md evaluates rules R1 through R39 from highest to lowest specificity, falling back to R0 when no specific condition matches.**

The zhaoxuya520/reverse-skill repository implements an intelligent routing system that automatically selects the appropriate skill directory based on task context. At the core of this mechanism, [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) defines a strict priority matrix that maps technical keywords to PRIMARY skill folders, ensuring that specialized tasks route to expert resources before generic ones.

## Understanding the Priority Matrix Structure

The priority matrix follows a **high-to-low evaluation order** introduced under the `## 优先级（高 → 低）` heading in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md). Each rule consists of three components:

- **ID**: A unique identifier (R1–R39, plus R0)
- **Condition**: Technical keywords or context triggers (e.g., "APK", "IDA", "Ghidra")
- **PRIMARY skill folder**: The destination directory for matched tasks

The routing engine processes these rules sequentially, selecting the first match it encounters. This design ensures that highly specific conditions (like Android APK analysis) take precedence over broader categories (like generic reverse engineering).

## Complete Priority Order of Rules (R1 to R39)

The following table lists the exact priority order as implemented in the source code:

| ID | Condition (Trigger) | PRIMARY Skill Folder |
|----|---------------------|----------------------|
| **R1** | APK / smali / jadx / apktool | `apk-reverse/` |
| **R2** | IPA / iOS / Objection / MobSF / mobile | `mobile-reverse/` |
| **R3** | JS 签名 / 前端加密 / jshook / CDP | `js-reverse/` |
| **R4** | DSL VM / fireye / 自定义 opcode VM | `reverse-engineering/dsl‑vm‑reverse/` |
| **R5** | .NET / dnSpy / de4dot / ConfuserEx | `dotnet-reverse/` |
| **R9** | 恶意样本 / YARA / 沙箱 | `malware-analysis/` |
| **R6** | IDA / 反编译 / 反汇编深挖 | `ida-reverse/` |
| **R7** | radare2 / r2 | `radare2/` |
| **R8** | 固件 / binwalk / IoT / EMBA | `firmware-pentest/` |
| **R10** | 攻击链 / 红队 / 横向 / 完整渗透 | `attack-chain/` |
| **R11** | Nmap / Nuclei / SQLMap / SRC / 渗透工具 | `pentest-tools/` |
| **R12** | API / GraphQL / BOLA / JWT 攻击 | `api-security/` |
| **R13** | SBOM / Trivy / 供应链 | `supply-chain-security/` |
| **R14** | LLM / Prompt 注入 / Agent 安全 | `llm-security/` |
| **R15** | bindiff / 符号迁移 / PDB | `binary-diff/` |
| **R16** | N‑day / 补丁差分 | `patch-diff-exploit/` |
| **R17** | pwn / ROP / 堆栈利用 | `pwn-chain/` |
| **R18** | EDR / 免杀 / syscall | `edr-bypass-re/` |
| **R19** | 浏览器/桌面自动化 | `browser-automation/` |
| **R20** | 报告 / writeup | `docs-generator/` |
| **R39** | 图表 / Mermaid / Graphviz / PlantUML / 架构图 | `diagram-generator/` |
| **R21** | 协议 / Protobuf / PCAP 协议 | `protocol-reverse/` |
| **R22** | Ghidra / 开源反编译 | `ghidra-reverse/` |
| **R23** | 云 / 容器 / K8s | `cloud-k8s/` |
| **R24** | Windows / AD / Kerberos / AD CS | `windows-ad/` |
| **R25** | 取证 / 内存转储 / 时间线 | `digital-forensics/` |
| **R26** | 代码审计 / SAST / Semgrep | `code-audit/` |
| **R27** | 威胁狩猎 / 检测工程 / 蓝队 | `threat-hunting/` |
| **R28** | OT / ICS / 工控 | `ot-ics/` |
| **R29** | Wi‑Fi / 无线渗透 | `wifi-wireless/` |
| **R30** | 浏览器扩展逆向 | `browser-extension-reverse/` |
| **R31** | macOS / Mach‑O | `macos-reverse/` |
| **R32** | 厚客户端安全 | `thick-client/` |
| **R33** | Go / Rust 二进制 | `go-rust-reverse/` |
| **R34** | 硬件调试口 / UART/JTAG | `hardware-security/` |
| **R35** | 数据库安全 | `database-security/` |
| **R36** | 邮件 / 钓鱼分析 | `email-security/` |
| **R37** | 联邦身份 SAML/OIDC | `identity-federation/` |
| **R38** | RF / SDR 研究 | `radio-sdr/` |
| **R0** | 通用逆向 / 反调试 / OLLVM / 未知二进制 | `reverse-engineering/` |

## How the Routing Logic Processes the Priority Order

The PowerShell entry point at `skills/scripts/master-route.ps1` implements the priority evaluation logic. When invoked with a task hint, the script parses [`MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/MASTER-ROUTING.md) and tests conditions against the input string in the R1–R39 sequence.

```powershell

# Use the master‑route script with a user‑provided hint.

powershell -File skills\scripts\master-route.ps1 -Hint "Analyze malicious Android APK"

# The script parses the hint, matches it against the priority table above,

# and writes the chosen PRIMARY path (e.g., apk-reverse/) to

# work/master-route-<timestamp>/route-scope.md.

```

The script outputs its decision to `work/master-route-<timestamp>/route-scope.md`, creating a traceable record of which rule fired based on the priority order.

## Fallback Mechanism When No Rules Match

If the input hint fails to trigger any of the R1–R39 conditions, the system defaults to **R0** (`reverse-engineering/`). According to the source code in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md), this generic fallback prompts the user to inspect [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md) for additional guidance.

This two-tier system ensures that:
1. Specific technical contexts receive specialized skill sets (R1–R39)
2. Ambiguous or novel tasks still route to a capable generalist resource (R0)

## Key Files Supporting the Routing Priority System

The complete routing architecture relies on these components:

- **[`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md)**: Defines the priority matrix and routing contract (R1–R39, R0)
- **`skills/scripts/master-route.ps1`**: Primary entry point that consumes the priority matrix and executes the sequential evaluation
- **[`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md)**: Extended routing table consulted when the high-priority matrix returns R0
- **`skills/scripts/case-init.ps1`**: Initializes case files after routing determines the PRIMARY skill
- **[`ops/role-map.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/ops/role-map.md)**: Maps specialist and lead roles to specific skill directories

## Summary

- **MASTER-ROUTING.md** establishes a fixed priority order from R1 (highest) to R39, with R0 as the ultimate fallback.
- The `skills/scripts/master-route.ps1` script evaluates conditions sequentially, selecting the first match to determine the PRIMARY skill folder.
- Rule R1 prioritizes mobile APK analysis, while R39 handles diagram generation, and R0 catches all unmatched generic reverse engineering tasks.
- When no high-priority rule matches, the system routes to `reverse-engineering/` and references [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md) for additional resolution options.

## Frequently Asked Questions

### What happens if multiple rules match a task hint?

The routing engine selects the **highest-priority rule** (lowest ID number) that matches the hint. For example, if a hint contains both "APK" (R1) and "IDA" (R6), the task routes to `apk-reverse/` because R1 appears earlier in the priority order than R6.

### How do I add a new rule to the priority order?

Insert a new row in [`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md) under the priority section with a unique ID. Assign it a position based on specificity—more specialized conditions should receive higher priority (lower ID numbers) than general ones. Update `skills/scripts/master-route.ps1` if the parsing logic requires modification for new condition types.

### What is the difference between MASTER-ROUTING.md and routing.md?

**MASTER-ROUTING.md** contains the high-priority matrix (R1–R39) used for automatic skill selection based on specific technical keywords. **routing.md** serves as a secondary reference consulted only when the primary matrix returns R0 (no match), providing broader categorization for ambiguous tasks.

### Where does the routing system output its decision?

After evaluating the priority order, `master-route.ps1` writes the selected PRIMARY skill path to `work/master-route-<timestamp>/route-scope.md`. This file documents which rule triggered and serves as the input for `skills/scripts/case-init.ps1` during case initialization.