Where Is the Main Routing Configuration File in reverse-skill?

The main routing configuration file in the reverse-skill project is located at skills/config/routing.json, which serves as the single source of truth for all routing decisions across the entire repository.

This JSON file acts as the central routing table that maps user hints to appropriate skill modules. While other files like skills/routing.md provide human-readable documentation, the actual routing logic depends entirely on the structured data in routing.json. Understanding this file's location and format is essential for anyone extending, debugging, or automating routing behavior in the zhaoxuya520/reverse-skill project.

The Canonical Location: skills/config/routing.json

The routing configuration resides at a fixed, predictable path within the repository structure:


skills/config/routing.json

This placement follows a conventional separation of concerns: configuration data lives in config/, while executable scripts reside in scripts/. The routing.json file contains structured route definitions with keyword mappings, target modules, and routing metadata.

According to the reverse-skill source code, all routing scripts—regardless of language—resolve this path relative to their own location using standard path-traversal techniques.

How Routing Scripts Load the Configuration

Multiple entry points consume the same JSON file, ensuring consistent behavior across PowerShell, Bash, and Python environments.

PowerShell: master-route.ps1

The primary PowerShell router determines the configuration path dynamically:


# Resolve the path to the routing definition

$skillsRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$configPath = Join-Path $skillsRoot 'config/routing.json'

# Load the JSON content

if (Test-Path $configPath) {
    $routing = Get-Content $configPath -Raw | ConvertFrom-Json
    # Example: find the route whose label matches a hint

    $hint = 'privilege escalation'
    $match = $routing.routes | Where-Object { $_.keywords -match $hint }
    $match | Format-List
} else {
    Write-Error "Routing config missing: $configPath"
}

This pattern uses $MyInvocation.MyCommand.Path to establish the script's location, then traverses to config/routing.json. The ConvertFrom-Json cmdlet deserializes the routing table for in-memory querying.

Bash: master-route.sh

The Bash equivalent employs similar relative-path resolution:

#!/usr/bin/env bash
SKILLS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
ROUTING_JSON="${SKILLS_ROOT}/skills/config/routing.json"

if [[ -f "$ROUTING_JSON" ]]; then
    python3 "${SKILLS_ROOT}/skills/scripts/master-route.py" -Hint "network pivot"
else
    echo "Error: routing config not found at $ROUTING_JSON" >&2
    exit 1
fi

The ${BASH_SOURCE[0]} parameter provides the script's path, enabling portable resolution across different execution contexts.

Python: Direct JSON Parsing

For programmatic access without wrapper scripts:

import json
from pathlib import Path

routing_path = Path(__file__).parents[2] / "skills" / "config" / "routing.json"
with routing_path.open(encoding="utf-8") as f:
    data = json.load(f)

def find_route(keyword):
    return [r for r in data["routes"] if keyword.lower() in (kw.lower() for kw in r["keywords"])]

print(find_route("code audit"))

Python's pathlib offers a clean, cross-platform approach to resolving the configuration location.

Supporting Files in the Routing Ecosystem

Several related files work in concert with routing.json:

File Purpose
skills/config/routing.json Authoritative routing table — the single source of truth
skills/routing.md Human-readable matrix mirroring the JSON structure
skills/scripts/master-route.ps1 PowerShell entry point consuming routing.json
skills/scripts/master-route.sh Bash entry point consuming routing.json
skills/scripts/verify-routing-coherence.ps1 Validation script ensuring JSON consistency with other assets

The verify-routing-coherence.ps1 script performs integrity checks to confirm that routing.json remains synchronized with documentation and other derived artifacts.

Why JSON Was Chosen for Routing Configuration

The selection of JSON over alternatives like YAML or TOML reflects specific design priorities in reverse-skill:

  • Native parsing support — PowerShell, Python, and Bash (via jq or Python) handle JSON without external dependencies
  • Schema validation readiness — JSON Schema can enforce routing structure constraints
  • Line-oriented diffs — Version control systems handle JSON modifications more cleanly than dense formats
  • Cross-language compatibility — No serialization ambiguities between PowerShell's ConvertFrom-Json and Python's json.load()

Best Practices for Modifying Routing

When editing the main routing configuration file:

  1. Validate before committing — Run verify-routing-coherence.ps1 to catch structural errors
  2. Update companion documentation — Sync skills/routing.md when adding or removing routes
  3. Preserve keyword normalization — Maintain consistent casing in keywords arrays to ensure case-insensitive matching works correctly
  4. Test across all entry points — Verify both PowerShell and Bash routers respond correctly to new route definitions

Summary

  • The main routing configuration file is skills/config/routing.json in the reverse-skill repository
  • All routing scripts—master-route.ps1, master-route.sh, and validation tools—read from this single JSON source
  • The file contains structured route definitions with keyword mappings to skill modules
  • skills/routing.md provides human-readable documentation but does not drive runtime behavior
  • Use verify-routing-coherence.ps1 to validate configuration integrity after modifications

Frequently Asked Questions

What format is the routing configuration file?

The routing configuration uses standard JSON format. The file contains a top-level object with a routes array, where each element specifies keywords, target modules, and routing metadata. This format enables native parsing in PowerShell, Python, and other tools without additional dependencies.

Can I use YAML instead of JSON for routing configuration?

No—the reverse-skill codebase hardcodes expectations for JSON parsing. All routing scripts specifically target routing.json and use language-native JSON deserializers. Converting to YAML would require modifying every consumer script and the validation tooling.

How do I add a new route to the configuration?

Edit skills/config/routing.json to append a new route object to the routes array, then update skills/routing.md with corresponding documentation. Always run skills/scripts/verify-routing-coherence.ps1 afterward to ensure structural validity and cross-file consistency.

What happens if routing.json is missing or malformed?

Each routing script implements explicit error handling: PowerShell emits Write-Error with the missing path, Bash exits with status 1 and stderr output, and Python would raise FileNotFoundError or json.JSONDecodeError. The verify-routing-coherence.ps1 script provides proactive validation to prevent runtime failures.

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 →