# What Are the Four Layers of the Reverse-Skill Architecture?

> Explore the four layers of the reverse-skill architecture: shared, Windows, Kali Linux, and external. Understand how this structure enhances CTF orchestration.

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

---

**The reverse-skill architecture organizes code into four distinct layers: a platform-agnostic shared layer, a Windows-specific layer, a Kali Linux layer, and an external layer for CTF orchestration.**

The `zhaoxuya520/reverse-skill` project implements a modular four-layer architecture that separates platform-agnostic core logic from OS-specific implementations. This design keeps the **reverse-skill architecture** portable across Windows and Linux while maintaining clean integration with external tools like the CTF Sandbox Orchestrator.

## 1. Shared Layer (Platform-Agnostic Core)

The **shared layer** houses the universal skill definitions, routing tables, and documentation generators that function on any operating system. According to the source code in [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md), this layer contains the **skills** directory, **field-journal** generators, and the central routing logic that remains invariant across platforms.

Key components include:

- [`skills/SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/SKILL.md) – The entry point that loads the shared skill set and routing logic.
- [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md) – The routing matrix that maps user intents to concrete skills.

```python

# Example: invoke the generic "apk-reverse" skill from the shared skill set

from skills.apk-reverse import main as apk_reverse

apk_reverse.run(apk_path="sample.apk")

```

## 2. Windows Platform Layer

The **Windows platform layer** provides PowerShell scripts, platform-specific bootstrap manifests, and rule sets tailored for Windows hosts. This layer extends the shared core with OS-specific automation without modifying the portable business logic.

Key files in this layer include:

- `skills/scripts/bootstrap-reverse.ps1` – The bootstrap script that installs missing tools on Windows.
- `skills/scripts/*.ps1` – Helper scripts for Windows-specific operations.
- [`bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-manifest.json) – The Windows-specific bootstrap manifest.
- [`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) – Windows-specific rule documentation.

```powershell

# PowerShell: run the bootstrap script that installs missing tools on Windows

& "skills/scripts/bootstrap-reverse.ps1"

```

## 3. Kali Linux Platform Layer

Mirroring the Windows layer, the **Kali Linux platform layer** contains Bash scripts and manifests optimized for Kali (and general Linux) systems. It ensures native compatibility with penetration testing distributions while adhering to the same architectural boundaries.

Key files include:

- [`kali/scripts/bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-reverse.sh) – The bootstrap script for Linux environments.
- `kali/scripts/*.sh` – Shell automation scripts.
- [`kali/scripts/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-manifest.json) – The Kali-specific bootstrap manifest.
- [`kali/RULES-kali.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/RULES-kali.md) – Kali-specific rule documentation.

```bash

# Bash: bootstrap missing tools on Kali/Linux

bash kali/scripts/bootstrap-reverse.sh

```

## 4. External Layer

The **external layer** provides the **CTF-Sandbox-Orchestrator** and any auxiliary child skills that reside outside the core repository but integrate tightly with the system. This layer handles sandboxed CTF environments and external skill orchestration, keeping the core repository lightweight.

Key files include:

- [`CTF-Sandbox-Orchestrator/ctf-sandbox-orchestrator/SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/CTF-Sandbox-Orchestrator/ctf-sandbox-orchestrator/SKILL.md) – The entry point for the external CTF orchestrator.
- [`CTF-Sandbox-Orchestrator/ctf-sandbox-orchestrator/run.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/CTF-Sandbox-Orchestrator/ctf-sandbox-orchestrator/run.sh) – The execution script for launching child skills.

```bash

# Bash: launch a child skill from the CTF Sandbox Orchestrator

bash CTF-Sandbox-Orchestrator/ctf-sandbox-orchestrator/run.sh --skill pentest-tools

```

## Architecture Visualization

The complete four-layer stack is visualized in [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) using a Mermaid diagram that explicitly defines the subgraphs: "共享层" (Shared), "Windows 平台层" (Windows), "Kali Linux 平台层" (Kali), and "外部" (External). This diagram maps how each layer interacts while maintaining strict separation of concerns.

## Summary

- The **shared layer** in `skills/` and `docs/` contains portable core logic, routing tables, and documentation generators.
- The **Windows layer** in `skills/scripts/` provides PowerShell automation, bootstrap manifests, and OS-specific rules.
- The **Kali Linux layer** in `kali/scripts/` delivers Bash tooling and manifests optimized for penetration testing environments.
- The **external layer** integrates the CTF Sandbox Orchestrator for sandboxed challenges and auxiliary child skills.

## Frequently Asked Questions

### How does the reverse-skill architecture handle cross-platform compatibility?

The architecture isolates platform-specific code into dedicated Windows and Kali Linux layers while keeping all business logic in the shared layer. When running on Windows, the system invokes `skills/scripts/bootstrap-reverse.ps1`; on Kali, it executes [`kali/scripts/bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-reverse.sh), ensuring the correct dependencies are installed without polluting the core skill definitions.

### Where is the four-layer structure documented?

The definitive reference resides in [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) at the repository root. This file contains the Mermaid diagram that defines the subgraphs for the shared layer, Windows platform layer, Kali Linux platform layer, and external layer, along with their specific responsibilities and relationships.

### Can I add a new platform layer to the architecture?

Yes. The modular design allows you to create a new subdirectory following the pattern established by the Kali layer. You would provide platform-specific bootstrap scripts, a manifest file, and rules, while registering the new routing logic in the shared layer's [`skills/routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/routing.md) to maintain consistency with the existing **reverse-skill architecture**.

### What is the purpose of the external layer?

The external layer houses the **CTF-Sandbox-Orchestrator** and any tightly integrated child skills that operate outside the main repository boundary. This separation keeps the core repository lightweight while enabling complex, sandboxed CTF scenarios through the orchestrator's [`run.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/run.sh) entry point.