How to Run the Tests for reverse-skill: Complete PowerShell Test Suite Guide
Execute skills/scripts/test-p0-friction.ps1 from the repository root using PowerShell 5.1+ (Windows) or PowerShell 7 (cross-platform) to run the full test suite for reverse-skill.
The reverse-skill repository by zhaoxuya520 ships a self-contained, end-to-end test harness written entirely in PowerShell. Whether you are validating local changes or verifying CI pipeline integrity, this guide walks you through how to run the tests for reverse-skill with precision.
Prerequisites for Running reverse-skill Tests
Before executing any test scripts, ensure your environment meets the following requirements:
- PowerShell 5.1 or later on Windows, or PowerShell 7 on Linux/macOS
- External utilities referenced by the skill set—such as
nmapandnuclei—should be available on your$PATH - No special environment variables are required; scripts automatically create temporary directories under
$env:TEMP
The test harness tolerates missing tools. If an external utility is absent, only the relevant checks are skipped rather than failing the entire suite.
Main Test Entry Point: test-p0-friction.ps1
The primary test driver is located at skills/scripts/test-p0-friction.ps1. This script orchestrates a comprehensive sequence of end-to-end checks covering core reverse-skill workflows.
How to Execute the Full Test Suite
# From the repository root
powershell -NoProfile -ExecutionPolicy Bypass -File skills/scripts/test-p0-friction.ps1
This command creates a temporary scratch folder, runs all validation steps, and prints [OK] or [FAIL] messages for each check. The script returns a non-zero exit code if any failures occur.
What test-p0-friction.ps1 Validates
| Test Component | Purpose | Source Location |
|---|---|---|
| Smoke test | Runs smoke.ps1 and confirms routing and verification stages complete cleanly |
Lines 29-38 |
| Case-init (granted) | Creates a ready-to-act case with AuthGranted and validates scope.md generation |
Lines 39-60 |
| Bare case-init | Runs case-init.ps1 without auth to ensure defaults remain pending |
Lines 63-71 |
| Append-evidence | Exercises append-evidence.ps1 and verifies evidence file creation |
Lines 73-96 |
| Recon-pipeline sanity | Confirms key notes (Origin/Referer, network hints) exist in pentest-tools/references/recon-pipeline.md |
Lines 99-107 |
| Routing coherence | Runs verify-routing-coherence.ps1 and expects exit code 0 |
Lines 14-19 |
| Chinese routing samples | Tests master-route.ps1 with Chinese-language hints for correct skill selection |
Lines 20-30 |
| Case-guard | Validates case-guard.ps1 exit codes: 0 for ready, 2 for pending, 0 with -Force |
Lines 33-41 |
| Lab case with AuthGranted | Ensures lab-only cases retain granted status and correct network mode |
Lines 43-65 |
| Junk AuthStatus handling | Verifies stray AuthStatus does not override prior AuthGranted |
Lines 66-83 |
| Special-char evidence | Checks that -RawExcerptFile transports arbitrary Unicode safely |
Lines 85-100 |
Each verification step in test-p0-friction.ps1 corresponds to a critical operational path in the reverse-skill system.
Secondary Test: Workflow Title Safety
For CI pipeline validation, use skills/scripts/test-workflow-title-safety.ps1 to inspect the GitHub Actions workflow at .github/workflows/auto-merge-journal.yml.
Execute the Workflow Safety Check
powershell -NoProfile -ExecutionPolicy Bypass -File skills/scripts/test-workflow-title-safety.ps1
This script confirms that PR numbers and titles are handled as plain data, preventing shell injection vulnerabilities when you modify CI workflows.
Quick Validation Examples
Run Specific Components
# Quick smoke test only
powershell -NoProfile -ExecutionPolicy Bypass -File .\skills\scripts\smoke.ps1 -LogDir .\tmp\smoke-logs
# Validate routing coherence in isolation
powershell -NoProfile -ExecutionPolicy Bypass -File .\skills\scripts\verify-routing-coherence.ps1
Interpret Test Output
[OK]— The component behaved as expected[FAIL]— Listed in the final summary; investigate the specific check- Exit code
1— One or more failures occurred
Key Test Files in reverse-skill
| File Path | Role |
|---|---|
skills/scripts/test-p0-friction.ps1 |
Main end-to-end test harness |
skills/scripts/smoke.ps1 |
Minimal sanity check for routing and verification |
skills/scripts/case-init.ps1 |
Case folder creation and scope.md generation |
skills/scripts/append-evidence.ps1 |
Evidence markdown file addition |
skills/scripts/verify-routing-coherence.ps1 |
Skill-routing matrix validation against skills/routing.md |
skills/scripts/master-route.ps1 |
Natural-language hint to skill mapping |
skills/scripts/test-workflow-title-safety.ps1 |
CI workflow PR title handling verification |
Summary
- The reverse-skill test suite is PowerShell-based and requires no complex setup beyond PowerShell itself
test-p0-friction.ps1is the comprehensive entry point covering 11 distinct validation areastest-workflow-title-safety.ps1provides CI-specific security checks- Temporary test artifacts are automatically managed under
$env:TEMP - Missing external tools result in skipped checks rather than hard failures
Frequently Asked Questions
Can I run reverse-skill tests on Linux or macOS?
Yes. Install PowerShell 7 (pwsh) and execute the same commands. The scripts are cross-platform compatible, though some external utilities like nmap may have different installation paths. The test harness gracefully skips checks for missing binaries.
Why does my test fail with execution policy errors?
PowerShell's default execution policy may block script execution. The -ExecutionPolicy Bypass flag in the documented commands overrides this restriction for the current session without changing system-wide settings.
How do I debug a failing test in test-p0-friction.ps1?
Open skills/scripts/test-p0-friction.ps1 and locate the [FAIL] message in the output. Each test section includes descriptive comments matching the table above. Run individual component scripts—such as smoke.ps1 or case-init.ps1—in isolation to narrow the issue.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →