# Main Routing Configuration File for reverse-skill: Location, Schema, and Usage Guide

> Discover the main routing configuration file for reverse-skill at skills/config/routing.json. Learn its schema and usage for effective task routing logic.

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

---

**The main routing configuration file for reverse-skill is located at [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) and serves as the single source of truth for all task-to-skill routing logic, defining routes, keywords, and priority order used by the primary router scripts.**

The reverse-skill repository uses a centralized JSON-based routing system to triage incoming task hints and map them to appropriate security skills. This configuration file controls every routing decision made by the PowerShell and Bash entry points, making it the most critical file to understand when customizing or extending the project.

## File Location and Architecture

The routing configuration resides at [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json). According to the reverse-skill source code, this file is the **only** authoritative source of truth for routing behavior. All primary routing logic, including the `master-route.ps1` and [`master-route.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/master-route.sh) scripts, reads from this specific path to perform task triage.

## Routing Schema Structure

The JSON file follows a strict four-section schema:

### schemaVersion and Metadata

The `schemaVersion` field indicates the format version of the routing file, while the `meta` object contains descriptive metadata including the `fallbackId` (default route when no match occurs, typically `R0`), scoring logic parameters, and maintainer notes.

### Routes Definition

The `routes` object maps route identifiers (e.g., `R1`, `R2`) to objects containing:

- **`label`**: A human-readable name for the route
- **`skill`**: The relative path to the skill's markdown definition (e.g., [`quantum-crypto/SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/quantum-crypto/SKILL.md))
- **`keywords`**: An array of matching rules with `must`, `mustAll`, `exclude`, and optional `note` fields

### Priority Resolution

The `priority` array contains an ordered list of route IDs. When multiple routes achieve equal scores during matching, the router selects the **PRIMARY** route by choosing the first entry in this array that appears among the high-scoring candidates.

## How Scripts Consume the Configuration

Both PowerShell and Bash implementations load the same JSON file to ensure deterministic routing across platforms.

### PowerShell Router Implementation

In `skills/scripts/master-route.ps1`, the router loads [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) to perform one-shot primary routing:

```powershell

# Example: run the primary router with a hint string

.\skills\scripts\master-route.ps1 -Hint "I need to analyze a malicious APK with obfuscation"

```

The script applies each route's `keywords` against the input hint, calculates scores, applies the `priority` order, and outputs the selected skill markdown file.

### Bash Router Implementation

The [`skills/scripts/master-route.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/scripts/master-route.sh) script mirrors this behavior, reading the identical JSON structure to ensure cross-platform consistency.

### Programmatic Access (Python)

You can implement custom tooling by loading the configuration directly:

```python
import json, re, pathlib

routing_path = pathlib.Path('skills/config/routing.json')
routing = json.loads(routing_path.read_text())

def route_for(text: str):
    scores = {}
    for rid, info in routing['routes'].items():
        for kw in info['keywords']:
            if 'must' in kw and not re.search(kw['must'], text, re.I):
                continue
            if 'exclude' in kw and re.search(kw['exclude'], text, re.I):
                continue
            scores[rid] = scores.get(rid, 0) + 1
    if not scores:
        return routing['meta']['fallbackId']
    # highest score, then priority order

    max_score = max(scores.values())
    candidates = [r for r, s in scores.items() if s == max_score]
    for pid in routing['priority']:
        if pid in candidates:
            return pid
    return routing['meta']['fallbackId']

print(route_for("Need to reverse‑engineer an iOS IPA with jailbreak detection"))

```

This logic mirrors the scoring algorithm used by the official router scripts.

## Modifying Routing Rules

To add a new route to the main configuration file, append an entry to the `routes` object and update the `priority` array:

```json
"R41": {
  "label": "Quantum cryptanalysis",
  "skill": "quantum-crypto/SKILL.md",
  "keywords": [
    { "must": "quantum|post‑quantum|qcrypto|shor|grover", "note": "Tasks involving quantum‑ready crypto analysis" }
  ]
}

```

After inserting the route, add `R41` to the `priority` array (e.g., after `"R40"`). The `verify-routing-coherence.ps1` validation script checks that all route IDs exist in both the routes map and the priority list, preventing configuration drift.

## Validation and CI Integration

The repository includes automated safeguards to ensure the routing configuration remains valid. The `skills/scripts/verify-routing-coherence.ps1` script validates consistency between the JSON file, the skill markdown files, and the priority list. Additionally, `skills/scripts/test-routing.ps1` executes 162 automated test cases against the routing rules to verify deterministic behavior before any changes reach the main branch.

## Summary

- The **main routing configuration file for reverse-skill** is located at [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) relative to the repository root.
- The file defines four critical sections: `schemaVersion`, `meta` (including `fallbackId`), `routes` (with keyword matching rules), and `priority` (tie-breaking order).
- Both `master-route.ps1` and [`master-route.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/master-route.sh) read this file as their sole routing authority.
- Modifications require updates to both the `routes` object and the `priority` array, validated by `verify-routing-coherence.ps1`.
- The `fallbackId` in `meta` ensures graceful degradation when no keywords match the input hint.

## Frequently Asked Questions

### Where is the main routing configuration file for reverse-skill located?

The file is located at [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) in the repository root. This path is hard-coded in `master-route.ps1`, [`master-route.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/master-route.sh), and all validation scripts as the single source of truth for routing logic.

### What happens if multiple routes match a task hint with the same score?

When multiple routes achieve identical scores, the router consults the `priority` array in [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json). The first route ID in this ordered list that appears among the matching candidates is selected as the **PRIMARY** route. If no candidates match, the system falls back to the `fallbackId` specified in the `meta` section.

### How do I add a new skill route to the configuration?

Add a new object to the `routes` section with a unique ID (e.g., `"R42"`), specifying the `label`, `skill` path, and `keywords` array. Then append this ID to the `priority` array to establish its precedence order. Run `verify-routing-coherence.ps1` to ensure the configuration passes CI validation.

### Can I modify routing behavior without changing the JSON file?

No. According to the reverse-skill architecture, [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) is the **only** authoritative source for routing rules. All router scripts and documentation generators read exclusively from this file, ensuring that any behavioral change must be performed through this centralized configuration to maintain consistency across the codebase.