# How reverse-skill's Multi-Platform Script Architecture Works: PowerShell vs Bash

> Discover how reverse-skill's multi-platform script architecture runs the same reverse-engineering logic on Windows (PowerShell) and Kali Linux (Bash) using layered, platform-agnostic skill definitions.

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

---

**`reverse-skill` uses a layered architecture that separates platform-agnostic skill definitions from thin platform-specific wrapper scripts, enabling the same reverse-engineering logic to run on Windows via PowerShell and Kali Linux via Bash.**

The `reverse-skill` project by zhaoxuya520 is designed to run security and reverse-engineering workflows across heterogeneous environments. Rather than maintaining two separate codebases, the repository implements a **single-source-of-truth** pattern where skill definitions remain identical while execution mechanics adapt to the host operating system. This article examines how the multi-platform script architecture balances portability with native integration.

## Platform-Specific Layer Structure

The architecture divides responsibilities across two parallel directory structures. According to the source code in [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md), the platform detection and routing logic lives at the top level, while implementation details descend into environment-specific folders.

### Windows PowerShell Implementation

On Windows, `reverse-skill` leverages PowerShell modules stored in `skills/scripts/*.ps1`. The bootstrap and tool resolution pipeline centers on:

- **[`bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-manifest.json)** – Defines installation sources using `winget` or direct GitHub ZIP downloads
- **`skills/scripts/lib/ToolDiscovery.ps1`** – Resolves tool availability, checks [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md), and invokes `bootstrap-reverse.ps1` when dependencies are missing
- **[`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md)** – Platform-specific rule set that drives AI routing decisions

### Kali Linux Bash Implementation

For Kali Linux environments, native Bash scripts in `kali/scripts/*.sh` provide equivalent functionality:

- **[`kali/scripts/bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-manifest.json)** – Uses `apt`, `pip`, `npm`, and other Linux package managers
- **[`kali/scripts/bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-reverse.sh)** – Direct bootstrap invocation (called via functions like `ensure_tool` in [`recon.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/recon.sh))
- **[`kali/RULES-kali.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/RULES-kali.md)** – Kali-specific rule set with identical semantic structure to Windows rules

The shared `skills/` directory contains **platform-agnostic** skill definitions including [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md), [`routing.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/routing.md), and reference documentation accessed by both implementations.

## Execution Flow: From Platform Detection to Skill Execution

The multi-platform support architecture follows a six-stage pipeline documented in [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) (lines 70-91):

1. **Detect platform** – The system selects [`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) for Windows or [`kali/RULES-kali.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/RULES-kali.md) for Kali (lines 6-10)

2. **Load scripts** – PowerShell (`*.ps1`) or Bash (`*.sh`) implementations are selected based on the detected environment

3. **Check tool index** – [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md) is consulted to determine which tools are already installed

4. **Bootstrap if needed** – Missing tools trigger platform-specific installation:
   - PowerShell: `ToolDiscovery.ps1` → `bootstrap-reverse.ps1`
   - Bash: Direct call to [`bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-reverse.sh) (e.g., `ensure_tool` function in [`recon.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/recon.sh), lines 41-50)

5. **Execute the skill** – The platform-specific script runs identical logical steps (e.g., invoking `rabin2` with optional `r2` analysis)

6. **Generate output** – Results feed into shared documentation generators (`docs-generator`, `diagram-generator`)

## Code Comparison: Radare2 Reconnaissance Skill

The Radare2 recon skill demonstrates architectural parity across platforms. Both implementations perform the same operations with language-specific syntax.

### Windows PowerShell

```powershell

# skills/radare2/scripts/recon.ps1

.\skills\radare2\scripts\recon.ps1 -TargetPath C:\path\to\binary.exe `
    -StringsLimit 50 -ImportsLimit 100 -RunAnalysis

```

### Kali Linux Bash

```bash

# skills/radare2/scripts/recon.sh

bash skills/radare2/scripts/recon.sh /path/to/binary \
    --strings-limit 50 --imports-limit 100 --analyze

```

Both scripts execute identical analysis steps:

- Verify `rabin2` availability (and optionally `r2`), bootstrapping if absent
- Print basic file information, sections, imports, exports, and strings
- Perform function/entry analysis when the analyze flag is set

The divergence is strictly superficial: argument parsing differs (PowerShell named parameters vs. Bash long options) and bootstrap invocation paths vary by platform convention.

## Key Architectural Files

| File | Platform | Responsibility |
|------|----------|--------------|
| `skills/scripts/lib/ToolDiscovery.ps1` | Windows | Tool resolution and auto-bootstrap orchestration |
| [`kali/scripts/bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/scripts/bootstrap-reverse.sh) | Kali Linux | Dependency installation via native package managers |
| `skills/radare2/scripts/recon.ps1` | Windows | PowerShell implementation of Radare2 reconnaissance |
| [`skills/radare2/scripts/recon.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/skills/radare2/scripts/recon.sh) | Kali Linux | Bash implementation of identical reconnaissance logic |
| [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) | Both | System architecture with multi-platform diagram |
| [`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) / [`kali/RULES-kali.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/RULES-kali.md) | Platform-specific | AI routing rule sets |

## Design Principles

The `reverse-skill` multi-platform script architecture adheres to three core principles evident in the source code:

- **Separation of concerns** – *What* the skill does (in `skills/`) remains independent from *how* the OS executes it
- **Minimal platform wrappers** – Only thin adapter scripts differ; no logic duplication
- **Bootstrap symmetry** – Both platforms implement equivalent dependency resolution despite different package ecosystems

## Summary

- `reverse-skill` separates platform-agnostic skill definitions in `skills/` from platform-specific execution scripts
- Windows uses PowerShell modules in `skills/scripts/*.ps1` with `ToolDiscovery.ps1` for tool resolution
- Kali Linux uses Bash scripts in `kali/scripts/*.sh` with direct [`bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-reverse.sh) invocation
- Both platforms share identical [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md) definitions and output generators
- Platform detection occurs via [`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) selection before script loading
- The Radare2 recon skill demonstrates functional parity with syntax-appropriate implementations

## Frequently Asked Questions

### How does reverse-skill detect which platform it's running on?

The system reads the appropriate rules file at initialization. Windows environments use [`RULES.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/RULES.md) while Kali Linux uses [`kali/RULES-kali.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/kali/RULES-kali.md) as specified in [`docs/ARCHITECTURE.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/docs/ARCHITECTURE.md) lines 6-10. This selection determines subsequent script path resolution.

### Can I run the same skill on both Windows and Kali without modification?

Yes. The skill definitions in `skills/` are completely portable. Only the wrapper scripts differ—you call `recon.ps1` on Windows or [`recon.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/recon.sh) on Kali, but both execute identical analysis steps against the same [`SKILL.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/SKILL.md) configuration.

### What happens if a required tool like rabin2 is missing?

The bootstrap layer handles installation automatically. On Windows, `ToolDiscovery.ps1` checks [`tool-index.md`](https://github.com/zhaoxuya520/reverse-skill/blob/main/tool-index.md) and invokes `bootstrap-reverse.ps1`. On Kali, functions like `ensure_tool` in [`recon.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/recon.sh) call [`bootstrap-reverse.sh`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-reverse.sh) directly. Both consult their respective [`bootstrap-manifest.json`](https://github.com/zhaoxuya520/reverse-skill/blob/main/bootstrap-manifest.json) files to determine installation sources.