# Where to Find the Primary Routing Rules in reverse-skill: Complete Guide

> Locate the primary routing rules in reverse-skill within skills/config/routing.json. This guide details the single source of truth for all 44 routes.

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

---

**The primary routing rules in reverse-skill live in [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json), which serves as the single source of truth for all 44 routes (R0–R44) and is read directly by the main triage and validation scripts.**

The reverse-skill repository implements a sophisticated routing system to categorize and process security-related tasks through defined pathways. Understanding where the primary routing rules are stored is essential for modifying behavior, debugging route selection, or extending the system with new categories. All routing logic converges on one authoritative JSON configuration file that defines route labels, associated skills, and keyword matching patterns.

## Primary Routing Rules Location: [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json)

The definitive source for routing logic is the **[`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json)** file at the repository root. This JSON configuration defines every route from R0 through R44, including their display labels, corresponding skill markdown files, and the keyword patterns that determine route assignment during task triage.

According to the repository documentation, this file represents the "Routing single source of truth" as noted in the README.md Key files section. Any modification to routing behavior—whether updating keyword patterns, adding new routes, or changing skill associations—must be made exclusively in this file to maintain consistency across the tooling ecosystem.


## How Routing Scripts Consume the Configuration

Multiple PowerShell scripts read [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json) directly at runtime to determine execution flow:

- **`master-route.ps1`** – The primary triage script that loads the JSON to match incoming tasks against route patterns
- **`test-routing.ps1`** – Regression test suite that validates route matching logic against the configuration
- **`verify-routing-coherence.ps1`** – Integrity checker ensuring the JSON definitions align with documentation and skill files

### Configuration Structure

Each entry in the `routes` object follows a consistent schema mapping route IDs (e.g., "R10") to their metadata:

```json
{
  "routes": {
    "R10": {
      "label": "Attack chain",
      "skills": ["attack-chain-analysis.md"],
      "patterns": ["attack chain", "kill chain", "apt lifecycle"]
    }
  }
}

```


## Inspecting and Accessing Routing Rules

You can programmatically inspect the primary routing rules using standard command-line tools or PowerShell.

### PowerShell Method

The scripts use `ConvertFrom-Json` to parse the configuration:

```powershell

# Load the routing table

$routerPath = Join-Path $PSScriptRoot '..\skills\config\routing.json'
$router = Get-Content $routerPath -Raw | ConvertFrom-Json

# Access specific route properties

$router.routes.R10.label   # Returns: "Attack chain"

```

### Command-Line Inspection with jq

On Linux or macOS, use `jq` to query the routing structure:

```bash

# List all available route IDs

jq '.routes | keys' skills/config/routing.json

# Output: ["R0","R1","R2","R3", ... ,"R44"]

```


## Related Files in the Routing Ecosystem

While [`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json) remains the single source of truth, several supporting files interact with this configuration:

- **`skills/scripts/master-route.ps1`** – Main entry point for route resolution that consumes the JSON
- **`skills/scripts/test-routing.ps1`** – Automated testing framework for route validation
- **`skills/scripts/verify-routing-coherence.ps1`** – Consistency validator between code and docs
- **[`skills/MASTER-ROUTING.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/MASTER-ROUTING.md)** – Human-readable reference that maps to the JSON structure
- **[`README.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/README.md)** – High-level documentation pointing to the routing configuration


## Summary

- The **primary routing rules** in reverse-skill are defined in [`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json), covering routes R0 through R44.
- This file is the **single source of truth** consumed by `master-route.ps1`, `test-routing.ps1`, and `verify-routing-coherence.ps1`.
- Each route entry contains labels, skill associations, and keyword patterns for task classification.
- Use **PowerShell** (`ConvertFrom-Json`) or **jq** to programmatically inspect routing configuration.
- Modify routing behavior exclusively through this JSON file to maintain system coherence.


## Frequently Asked Questions

### What format are the primary routing rules stored in?

The primary routing rules use standard **JSON format** with a top-level `routes` object containing keyed entries for each route ID (R0–R44). Each route specifies a label string, an array of associated skill markdown files, and pattern arrays for keyword matching.

### How do I add a new route to the reverse-skill system?

To add a new route, edit **[`skills/config/routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/config/routing.json)** and append a new entry to the `routes` object following the existing schema (route ID, label, skills array, patterns array). After modification, run `verify-routing-coherence.ps1` to ensure consistency with documentation, then execute `test-routing.ps1` to validate the new routing logic.

### Why does reverse-skill use a JSON file instead of hardcoded routing logic?

Centralizing routing definitions in **[`routing.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.json)** separates configuration from implementation, enabling non-developers to modify keyword patterns and route mappings without changing PowerShell code. This architecture ensures that `master-route.ps1` and validation scripts always operate on current definitions without requiring code redeployment.

### Can I query specific keyword patterns from the routing rules?

Yes. Use `jq` to extract pattern arrays for specific routes: `jq '.routes.R10.patterns' skills/config/routing.json`. In PowerShell, access patterns via `$router.routes.R10.patterns` after loading the JSON with `ConvertFrom-Json`.