Understanding the Three Layers of the Reverse-Skill Routing Architecture

The reverse-skill routing architecture consists of three distinct layers: a Shared (Platform-Independent) Layer containing core skill definitions, a Windows Platform Layer with PowerShell tooling, and a Kali Linux Platform Layer with Bash utilities.

The reverse-skill repository by zhaoxuya520 implements a sophisticated routing system that separates platform-agnostic logic from OS-specific implementations. This three-tier design enables the framework to maintain a unified skill catalog while executing environment-specific workflows on Windows and Kali Linux.

The Three-Layer Architecture Overview

According to the docs/ARCHITECTURE.md documentation, the reverse-skill routing system implements a clear separation of concerns across three distinct tiers. The "多平台支持架构" diagram illustrates how these layers interact to provide platform-agnostic flexibility combined with OS-specific tooling.

Layer 1: Shared (Platform-Independent) Layer

The foundation of the architecture resides in the skills/ folder, which houses all platform-neutral components. This layer contains SKILL.md (the entry point skill aggregator), routing.md (the routing matrix), and the CTF-Sandbox-Orchestrator sub-skills.

Key responsibilities include:

  • Providing the core skill catalog and routing matrix used to match user intents
  • Maintaining the field-journal/ directory for automatic evolution mechanisms
  • Storing documentation generators and reference files that work on any OS
  • Defining the master routing logic in skills/scripts/master-route.sh

This shared layer ensures that skill definitions and routing logic remain portable across operating systems.

Layer 2: Windows Platform Layer

Windows-specific functionality is isolated under the skills/scripts/ directory using PowerShell automation. The Windows layer handles tooling that requires Windows APIs or package management via Winget.

Key components include:

  • skills/scripts/bootstrap-reverse.ps1 – The Windows bootstrap script for self-installation of missing utilities
  • skills/bootstrap-manifest.json – Defines Winget and GitHub Release ZIP dependencies
  • skills/RULES.md – Contains Windows-specific security rules and constraints

When the routing engine detects a Windows environment, it executes PowerShell scripts with execution policies bypassed to install dependencies and enforce platform-specific security policies.

Layer 3: Kali Linux Platform Layer

Linux-specific support is organized under the kali/ directory structure, utilizing Bash scripting and native package managers. This layer targets penetration testing workflows specific to Kali distributions.

Key components include:

The Kali layer provides package management via apt, Python pip, and Node npm, ensuring security tools are properly installed before skill execution.

How the Layers Interact

The routing engine implements a cascading selection mechanism defined in skills/routing.md. First, the system reads the shared skill definitions from SKILL.md, then selects the appropriate platform-layer scripts based on the current environment.

The internal layer selection logic operates as follows:

import platform, json, pathlib

def select_manifest():
    sys = platform.system()
    if sys == "Windows":
        return pathlib.Path("skills/bootstrap-manifest.json")
    else:  # assumes Kali-compatible Linux

        return pathlib.Path("kali/scripts/bootstrap-manifest.json")

This conditional routing ensures that Windows hosts receive PowerShell execution paths while Linux systems default to Kali-compatible Bash workflows.

Practical Implementation Examples

Platform-Agnostic Skill Invocation

To invoke the master routing entry point on any Unix-like system:


# Linux / macOS / Kali

bash skills/scripts/master-route.sh --hint "pwn-chain"

This command triggers the shared layer routing logic, which then delegates to platform-specific implementations based on the detected environment.

Windows Bootstrap Execution

For Windows environments requiring tool installation:


# Windows PowerShell

powershell -NoProfile -ExecutionPolicy Bypass -File skills/scripts/bootstrap-reverse.ps1

This execution pattern references the second layer, handling Winget installations and GitHub Release ZIP extractions defined in the Windows manifest.

Manifest Selection Logic

The following Python demonstrates how the routing architecture selects between platform layers at runtime:

import platform, json, pathlib

def select_manifest():
    sys = platform.system()
    if sys == "Windows":
        return pathlib.Path("skills/bootstrap-manifest.json")
    else:  # assumes Kali‑compatible Linux

        return pathlib.Path("kali/scripts/bootstrap-manifest.json")

This function determines whether to load Windows-specific dependencies from skills/bootstrap-manifest.json or Kali-specific packages from kali/scripts/bootstrap-manifest.json.

Summary

The reverse-skill routing architecture achieves platform flexibility through three carefully separated layers:

  • Shared Layer (skills/): Contains portable skill definitions, routing matrices, and the field-journal/ auto-evolution system
  • Windows Layer (skills/scripts/): Provides PowerShell automation, Winget package management, and Windows-specific security rules
  • Kali Linux Layer (kali/): Implements Bash tooling, APT/pip/npm package installation, and penetration-testing-specific constraints

Frequently Asked Questions

How does the routing engine decide which layer to use?

The routing engine first loads the shared skill definitions from skills/SKILL.md and skills/routing.md, then queries the operating system via platform.system() to determine whether to execute Windows PowerShell scripts or Kali Linux Bash utilities. This selection happens automatically before any skill workflow begins execution.

What file triggers the skill routing process?

The entry point is skills/SKILL.md, which aggregates all available skills and routes. This file references the routing matrix in skills/routing.md to match user intents with appropriate platform-layer implementations.

Can the reverse-skill architecture support additional operating systems?

The current implementation explicitly handles Windows via skills/scripts/bootstrap-reverse.ps1 and assumes all other systems are Kali-compatible Linux. To add macOS or other distributions, you would create a new platform layer following the pattern established in kali/scripts/, including a new bootstrap manifest and OS-specific rules file.

Where is the three-layer architecture visually documented?

The "多平台支持架构" diagram in docs/ARCHITECTURE.md provides a visual representation of how the Shared, Windows, and Kali Linux layers interact. This document defines the architectural boundaries and file organization patterns used throughout the repository.

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 →