# Understanding the Three-Layer Reverse-Skill Routing Architecture

> Explore the three-layer reverse-skill routing architecture: shared, Windows, and Kali Linux implementation layers. Understand its core components and functionality.

- Repository: [ZhaoXu/reverse-skill](https://github.com/zhaoxuya520/reverse-skill)
- Tags: architecture
- Published: 2026-08-31

---

**The reverse-skill routing architecture consists of three distinct layers: a platform-independent shared layer, a Windows-specific implementation layer, and a Kali Linux-specific implementation layer.**

The reverse-skill project implements a modular, cross-platform routing system designed for cybersecurity workflows. At its core, this architecture separates concerns between universal logic and operating-system-specific implementations, enabling consistent skill execution across diverse environments.

## The Three Layers of the Reverse-Skill Routing Architecture

The system is organized into three tiers that work together to provide **platform-agnostic flexibility** with **OS-specific optimizations**:

### Layer 1: Shared (Platform-Independent) Core

The foundation of reverse-skill resides in the `skills/` directory and related repositories. This layer contains:

- **Skill definitions** – All [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md) files that catalog available capabilities
- **Routing matrix** – [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md) maps user intents to appropriate skill workflows
- **CTF-Sandbox-Orchestrator sub-skills** – Containerized challenge environments
- **Auto-evolution systems** – The `field-journal/` directory records execution evidence and enables self-learning mechanisms
- **Documentation generators** – Tools that maintain synchronized, up-to-date skill references

This layer executes identically on any operating system. The routing engine processes skill definitions here before delegating platform-specific tasks to lower layers.

### Layer 2: Windows Platform Layer

Windows-specific functionality lives in `skills/scripts/` and related configuration files:

| Component | Purpose |
|-----------|---------|
| `skills/scripts/*.ps1` | PowerShell automation scripts |
| [`skills/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/bootstrap-manifest.json) | Declares Winget packages and GitHub Release ZIP dependencies |
| [`skills/RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/RULES.md) | Windows-specific security constraints |

The Windows layer handles **self-bootstrapping of missing utilities** through `skills/scripts/bootstrap-reverse.ps1`. When a required tool is absent, this script consults the manifest and automatically installs dependencies via Winget or direct GitHub downloads.

### Layer 3: Kali Linux Platform Layer

Linux-specific implementations occupy the `kali/` directory tree:

| Component | Purpose |
|-----------|---------|
| `kali/scripts/*.sh` | Bash automation scripts |
| [`kali/scripts/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-manifest.json) | APT, pip, npm, and GitHub tar.gz package declarations |
| [`kali/RULES-kali.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/RULES-kali.md) | Kali-specific security hardening rules |

This layer leverages Kali's native package ecosystem. The bootstrap system can install tools from multiple sources simultaneously, ensuring penetration testing environments are provisioned correctly.

## How the Reverse-Skill Routing Engine Operates

The routing architecture follows a clear execution flow. First, the engine loads shared skill definitions from [`skills/SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/SKILL.md) and the routing matrix from [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md). Then it detects the current environment and selects the appropriate platform layer. Finally, it executes the chosen workflow with OS-specific tooling.

### Platform Detection and Manifest Selection

The internal logic for choosing the correct platform layer follows this pattern:

```python
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 detection occurs at runtime, ensuring the correct bootstrap manifest and script extensions load for the current operating system.

### Practical Execution Examples

**Cross-platform master routing (Linux/macOS/Kali):**

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

```

**Windows-specific bootstrap execution:**

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

```

These entry points demonstrate how the same high-level intent—executing a reverse engineering skill chain—routes through different platform layers depending on environment.

## Key Architectural Files in Reverse-Skill

Understanding the routing architecture requires familiarity with these critical paths:

- [`skills/SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/SKILL.md) – Aggregates all skills and serves as the primary routing entry point
- [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md) – Contains the intent-to-skill matching matrix used by the routing engine
- [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) – Visual documentation of the three-layer structure, including the **"多平台支持架构"** (multi-platform support architecture) diagram
- `skills/scripts/bootstrap-reverse.ps1` – Windows platform layer implementation for dependency resolution
- [`kali/scripts/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-manifest.json) – Kali platform layer package declarations
- `field-journal/` – Evidence repository enabling automatic skill evolution

As implemented in `zhaoxuya520/reverse-skill`, this architecture balances **portability** through the shared layer with **optimization** through platform-specific implementations. The routing engine unifies these layers into a coherent system that adapts transparently to its execution environment.

## Summary

- The **reverse-skill routing architecture** employs three distinct layers: shared (platform-independent), Windows-specific, and Kali Linux-specific.
- The **shared layer** in `skills/` provides universal skill definitions, routing matrices, and auto-evolution through `field-journal/`.
- **Platform layers** handle OS-specific tooling, package management (Winget for Windows, APT/pip/npm for Kali), and security rule enforcement.
- The **routing engine** dynamically selects the appropriate layer at runtime based on `platform.system()` detection.
- **Bootstrap manifests** ([`skills/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/bootstrap-manifest.json) and [`kali/scripts/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-manifest.json)) declaratively specify dependencies for automatic installation.

## Frequently Asked Questions

### How does reverse-skill detect which platform layer to use?

The system uses Python's `platform.system()` function to identify the operating system. If the result is `"Windows"`, it loads [`skills/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/bootstrap-manifest.json) and PowerShell scripts. For all other systems, it defaults to the Kali Linux layer, loading [`kali/scripts/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-manifest.json) and Bash scripts.

### What happens if a required tool is missing on Windows?

The `skills/scripts/bootstrap-reverse.ps1` script executes automatically. It parses [`skills/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/bootstrap-manifest.json) to identify missing dependencies, then installs them via Winget or direct download from GitHub Releases, requiring no manual intervention.

### Can the shared layer function without platform-specific components?

Partially. The core routing logic and skill definitions in [`skills/SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/SKILL.md) and [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md) are fully platform-agnostic. However, actual skill execution requires the appropriate platform layer for tool invocation and environment setup. The architecture is designed to degrade gracefully with clear error messaging when platform support is missing.

### Where is the platform selection logic documented visually?

The **"多平台支持架构"** (multi-platform support architecture) diagram in [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) illustrates how the three layers interact. This documentation shows the routing engine's position between shared skill definitions and platform-specific implementations.