Token导航 LogoToken导航

Agent Skill · 研究检索

powershell-shell-detection(powershell 外壳检测)

powershell-shell-detection 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

powershell-shell-detection 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 31,754。

总安装 2,644周安装 108GitHub Stars 33下载 847核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:powershell-shell-detection(powershell 外壳检测)
来源仓库:https://github.com/josiahsiegel/claude-plugin-marketplace
仓库路径:skills/powershell-shell-detection
安装命令:
npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill powershell-shell-detection
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill powershell-shell-detection

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词或任务场景快速定位候选结果时使用。适用于 PowerShell 外壳检测相关的信息查询与整理,可结合来源仓库进一步核验用法。

通过 npx skills add 命令从指定 GitHub 仓库安装,需确认权限范围和维护状态。安装前建议检查是否会触发联网、命令执行或文件读写,确保操作边界清晰。powershell-shell-detection 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/powershell-shell-detection

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

powershell-shell-detection 怎么安装?

在终端执行 npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill powershel…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

powershell-shell-detection 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

powershell-shell-detection 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

powershell-shell-detection 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

powershell-shell-detection 用的人多吗?

公开数据是累计安装 2,644 次,近一周安装 108 次,下载 847 次,GitHub 33 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

powershell-shell-detection 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
powershell-shell-detection

powershell 外壳检测 · 本页

2,64433接触敏感数据MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

PowerShell Shell Detection & Cross-Shell Compatibility

Critical guidance for distinguishing between PowerShell and Git Bash/MSYS2 shells on Windows, with shell-specific path handling and compatibility notes.

Shell Detection Priority (Windows)

When working on Windows, correctly identifying the shell environment is crucial for proper path handling and command execution.

Detection Order (Most Reliable First)

  1. process.env.PSModulePath (PowerShell specific)
  2. process.env.MSYSTEM (Git Bash/MinGW specific)
  3. process.env.WSL_DISTRO_NAME (WSL specific)
  4. uname -s output (Cross-shell, requires execution)

PowerShell Detection

Primary Indicators

PSModulePath (Most Reliable):

# PowerShell detection
if ($env:PSModulePath) {
    Write-Host "Running in PowerShell"
    # PSModulePath contains 3+ paths separated by semicolons
    $env:PSModulePath -split ';'
}

# Check PowerShell version
$PSVersionTable.PSVersion
# Output: 7.5.4 (PowerShell 7) or 5.1.x (Windows PowerShell)

PowerShell-Specific Variables:

# These only exist in PowerShell
$PSVersionTable    # Version info
$PSScriptRoot      # Script directory
$PSCommandPath     # Script full path
$IsWindows         # Platform detection (PS 7+)
$IsLinux           # Platform detection (PS 7+)
$IsMacOS           # Platform detection (PS 7+)

Shell Type Detection in Scripts

function Get-ShellType {
    if ($PSVersionTable) {
        return "PowerShell $($PSVersionTable.PSVersion)"
    }
    elseif ($env:PSModulePath -and ($env:PSModulePath -split ';').Count -ge 3) {
        return "PowerShell (detected via PSModulePath)"
    }
    else {
        return "Not PowerShell"
    }
}

Get-ShellType

Git Bash / MSYS2 Detection

Primary Indicators

MSYSTEM Environment Variable (Most Reliable):

# Bash detection in Git Bash/MSYS2
if [ -n "$MSYSTEM" ]; then
    echo "Running in Git Bash/MSYS2: $MSYSTEM"
fi

# MSYSTEM values:
# MINGW64 - Native Windows 64-bit environment
# MINGW32 - Native Windows 32-bit environment
# MSYS    - POSIX-compliant build environment

Secondary Detection Methods:

# Using OSTYPE (Bash-specific)
case "$OSTYPE" in
    msys*)   echo "MSYS/Git Bash" ;;
    cygwin*) echo "Cygwin" ;;
    linux*)  echo "Linux" ;;
    darwin*) echo "macOS" ;;
esac

# Using uname (Most portable)
case "$(uname -s)" in
    MINGW64*) echo "Git Bash 64-bit" ;;
    MINGW32*) echo "Git Bash 32-bit" ;;
    MSYS*)    echo "MSYS" ;;
    CYGWIN*)  echo "Cygwin" ;;
    Linux*)   echo "Linux" ;;
    Darwin*)  echo "macOS" ;;
esac

Cross-Shell Compatibility on Windows

Critical Differences

AspectPowerShellGit Bash/MSYS2
Environment Variable$env:VARIABLE$VARIABLE
Path Separator; (semicolon): (colon)
Path StyleC:\Windows\System32/c/Windows/System32
Home Directory$env:USERPROFILE$HOME
Temp Directory$env:TEMP/tmp
Command FormatGet-ChildItemls (native command)
AliasesPowerShell cmdlet aliasesUnix command aliases

Path Handling: PowerShell vs Git Bash

PowerShell Path Handling:

# Native Windows paths work directly
$path = "C:\Users\John\Documents"
Test-Path $path  # True

# Forward slashes also work in PowerShell 7+
$path = "C:/Users/John/Documents"
Test-Path $path  # True

# Use Join-Path for cross-platform compatibility
$configPath = Join-Path -Path $PSScriptRoot -ChildPath "config.json"

# Use [System.IO.Path] for advanced scenarios
$fullPath = [System.IO.Path]::Combine($home, "documents", "file.txt")

Git Bash Path Handling:

# Git Bash uses Unix-style paths
path="/c/Users/John/Documents"
test -d "$path" && echo "Directory exists"

# Automatic path conversion (CAUTION)
# Git Bash converts Unix-style paths to Windows-style
# /c/Users → C:\Users (automatic)
# Arguments starting with / may be converted unexpectedly

# Use cygpath for manual conversion
cygpath -u "C:\path"      # → /c/path (Unix format)
cygpath -w "/c/path"      # → C:\path (Windows format)
cygpath -m "/c/path"      # → C:/path (Mixed format)

Automatic Path Conversion in Git Bash (CRITICAL)

Git Bash/MSYS2 automatically converts paths in certain scenarios, which can cause issues:

What Triggers Conversion

# Leading forward slash triggers conversion
command /foo         # Converts to C:\msys64\foo

# Path lists with colons
export PATH=/foo:/bar  # Converts to C:\msys64\foo;C:\msys64\bar

# Arguments after dashes
command --path=/foo    # Converts to --path=C:\msys64\foo

What's Exempt from Conversion

# Arguments with equals sign (variable assignments)
VAR=/foo command      # NOT converted

# Drive specifiers
command C:/path       # NOT converted

# Arguments with semicolons (already Windows format)
command "C:\foo;D:\bar"  # NOT converted

# Double slashes (Windows switches)
command //e //s       # NOT converted

Disabling Path Conversion

# Disable ALL conversion (Git Bash)
export MSYS_NO_PATHCONV=1
command /foo  # Stays as /foo

# Exclude specific patterns (MSYS2)
export MSYS2_ARG_CONV_EXCL="*"           # Exclude everything
export MSYS2_ARG_CONV_EXCL="--dir=;/test"  # Specific prefixes

When to Use PowerShell vs Git Bash on Windows

Use PowerShell When:

  • ✅ Windows-specific tasks - Registry, WMI, Windows services
  • ✅ Azure/Microsoft 365 automation - Az, Microsoft.Graph modules
  • ✅ Module ecosystem - Leverage PSGallery modules
  • ✅ Object-oriented pipelines - Rich object manipulation
  • ✅ Native Windows integration - Built into Windows
  • ✅ CI/CD with pwsh - GitHub Actions, Azure DevOps
  • ✅ Cross-platform scripting - PowerShell 7 works on Linux/macOS

Example PowerShell Scenario:

# Azure VM management with Az module
Connect-AzAccount
Get-AzVM -ResourceGroupName "Production" |
    Where-Object {$_.PowerState -eq "VM running"} |
    Stop-AzVM -Force

Use Git Bash When:

  • ✅ Unix tool compatibility - sed, awk, grep, find
  • ✅ Git operations - Native Git command-line experience
  • ✅ POSIX script execution - Running Linux shell scripts
  • ✅ Cross-platform shell scripts - Bash scripts from Linux/macOS
  • ✅ Text processing - Unix text utilities (sed, awk, cut)
  • ✅ Development workflows - Node.js, Python, Ruby with Unix tools

Example Git Bash Scenario:

# Git workflow with Unix tools
git log --oneline | grep -i "feature" | awk '{print $1}' |
    xargs git show --stat

Shell-Aware Script Design

Detect and Adapt (PowerShell)

# Detect if running in PowerShell or Git Bash context
function Test-PowerShellContext {
    return ($null -ne $PSVersionTable)
}

# Adapt path handling based on context
function Get-CrossPlatformPath {
    param([string]$Path)

    if (Test-PowerShellContext) {
        # PowerShell: Use Join-Path
        return (Resolve-Path $Path -ErrorAction SilentlyContinue).Path
    }
    else {
        # Non-PowerShell context
        Write-Warning "Not running in PowerShell. Path operations may differ."
        return $Path
    }
}

Detect and Adapt (Bash)

# Detect shell environment
detect_shell() {
    if [ -n "$MSYSTEM" ]; then
        echo "git-bash"
    elif [ -n "$PSModulePath" ]; then
        echo "powershell"
    elif [ -n "$WSL_DISTRO_NAME" ]; then
        echo "wsl"
    else
        echo "unix"
    fi
}

# Adapt path handling
convert_path() {
    local path="$1"
    local shell_type=$(detect_shell)

    case "$shell_type" in
        git-bash)
            # Convert Windows path to Unix style
            echo "$path" | sed 's|\\|/|g' | sed 's|^\([A-Z]\):|/\L\1|'
            ;;
        *)
            echo "$path"
            ;;
    esac
}

# Usage
shell_type=$(detect_shell)
echo "Running in: $shell_type"

Environment Variable Comparison

Common Environment Variables

VariablePowerShellGit BashPurpose
Username$env:USERNAME$USERCurrent user
Home Directory$env:USERPROFILE$HOMEUser home
Temp Directory$env:TEMP/tmpTemporary files
Path List$env:Path (; sep)$PATH (: sep)Executable paths
Shell Detection$env:PSModulePath$MSYSTEMShell identifier

Cross-Shell Variable Access

PowerShell accessing environment variables:

$env:PATH              # Current PATH
$env:PSModulePath      # PowerShell module paths
$env:MSYSTEM           # Would be empty in PowerShell
[Environment]::GetEnvironmentVariable("PATH", "Machine")  # System PATH

Git Bash accessing environment variables:

echo $PATH             # Current PATH
echo $MSYSTEM          # Git Bash: MINGW64, MINGW32, or MSYS
echo $PSModulePath     # Would be empty in pure Bash

Practical Examples

Example 1: Cross-Shell File Finding

PowerShell:

# Find files modified in last 7 days
Get-ChildItem -Path "C:\Projects" -Recurse -File |
    Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-7) } |
    Select-Object FullName, LastWriteTime

Git Bash:

# Same operation in Git Bash
find /c/Projects -type f -mtime -7 -exec ls -lh {} \;

Example 2: Process Management

PowerShell:

# Stop all Chrome processes
Get-Process chrome -ErrorAction SilentlyContinue | Stop-Process -Force

Git Bash:

# Same operation in Git Bash
ps aux | grep chrome | awk '{print $2}' | xargs kill -9 2>/dev/null

Example 3: Text File Processing

PowerShell:

# Extract unique email addresses from logs
Get-Content "logs.txt" |
    Select-String -Pattern '\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b' |
    ForEach-Object { $_.Matches.Value } |
    Sort-Object -Unique

Git Bash:

# Same operation in Git Bash
grep -oE '\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b' logs.txt |
    sort -u

Troubleshooting Cross-Shell Issues

Issue 1: Command Not Found

Problem: Command works in one shell but not another

# PowerShell
Get-Process  # Works
# Git Bash
Get-Process  # Command not found

Solution: Understand that PowerShell cmdlets don't exist in Bash. Use native commands or install PowerShell Core (pwsh) in Git Bash:

# Run PowerShell from Git Bash
pwsh -Command "Get-Process"

Issue 2: Path Format Mismatches

Problem: Paths don't work across shells

# Git Bash path
/c/Users/John/file.txt  # Works in Bash

# PowerShell
Test-Path "/c/Users/John/file.txt"  # May fail

Solution: Use cygpath for conversion or normalize paths:

# Convert to Windows format for PowerShell
win_path=$(cygpath -w "/c/Users/John/file.txt")
pwsh -Command "Test-Path '$win_path'"

Issue 3: Alias Conflicts

Problem: ls, cd, cat behave differently

# PowerShell
ls  # Actually runs Get-ChildItem
# Git Bash
ls  # Runs native Unix ls command

Solution: Use full cmdlet names in PowerShell scripts:

# Instead of: ls
Get-ChildItem  # Explicit cmdlet name

Best Practices Summary

PowerShell Scripts

  1. ✅ Use $PSScriptRoot for script-relative paths
  2. ✅ Use Join-Path or [IO.Path]::Combine() for paths
  3. ✅ Avoid hardcoded backslashes
  4. ✅ Use full cmdlet names (no aliases)
  5. ✅ Test on all target platforms
  6. ✅ Use $IsWindows, $IsLinux, $IsMacOS for platform detection

Git Bash Scripts

  1. ✅ Check $MSYSTEM for Git Bash detection
  2. ✅ Use cygpath for path conversion when needed
  3. ✅ Set MSYS_NO_PATHCONV=1 to disable auto-conversion if needed
  4. ✅ Quote paths with spaces
  5. ✅ Use Unix-style paths (/c/...) within Bash
  6. ✅ Convert to Windows paths when calling Windows tools

Cross-Shell Development

  1. ✅ Document which shell your script requires
  2. ✅ Add shell detection at script start
  3. ✅ Provide clear error messages for wrong shell
  4. ✅ Consider creating wrapper scripts for cross-shell compatibility
  5. ✅ Test in both PowerShell and Git Bash if supporting both

Resources


Last Updated: October 2025

平台分布

Gemini CLI

25.94%
按下载量换算220

Claude Code

23.3%
按下载量换算197

OpenCode

18.27%
按下载量换算155

Antigravity

11.46%
按下载量换算97

windsurf

6.55%
按下载量换算55

trae

3.39%
按下载量换算29

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills