En

@4fu/pi-pwsh

Execute terminal commands via PowerShell 7 on Windows

开发流程 执行终端命令排查开发环境配置报错问题管理终端进程 通用 ★ 1.5k Updated 2026-08-02

Install & Use

Copy this prompt and send it to your AI assistant (Claude / Cursor / TRAE / Codex / WorkBuddy etc.) to auto-install:

Help me install this AI Skill: @4fu/pi-pwsh.
It is used for: Execute terminal commands via PowerShell 7 on Windows
Full Skill content: https://321skill.com/skills/4fu-pi-pwsh/raw/index.md
Read that page and install it.

The prompt includes a link to the full Skill content. You can also view the full content.

This Skill addresses the poor terminal command compatibility when using AI coding agents in Windows environments. In actual development, Git Bash often fails due to background process hangs or path conversion errors, while models tend to output POSIX syntax (e.g., &&, grep, $VAR) that cannot run directly in PowerShell. This Skill disables built-in tools like bash, ls, find, and grep, and registers a pwsh tool based on PowerShell 7, ensuring all shell, directory listing, and search tasks execute reliably on Windows.

Usage is straightforward: simply install this Skill in your AI coding agent, after which all terminal commands will automatically execute via pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command <cmd>. It retains features of the built-in bash tool—such as tail truncation, output saving, non-zero exit code error prompts, and streaming preview—while only replacing the process launch layer. Additionally, it provides persistent ConPTY sessions (via functions like Start-Pty), background job support, automatic retry for .cmd batch files, process tree termination, UTF-8 without BOM output, and native exit code preservation.

It is ideal for teams and individuals performing backend development, operations management, or full-stack development on Windows—especially developers who already use PowerShell 7 as their primary shell but want AI coding agents to correctly understand and execute PowerShell commands. For scenarios involving long-running background tasks (e.g., npm run dev), cross-platform script compatibility, or reliance on precise exit codes (e.g., rg, git diff --quiet), this Skill significantly reduces command execution failures and debugging time.

We recommend standardizing on this tool in Windows development environments to avoid inconsistencies from mixing Git Bash and PowerShell. Note that it is primarily designed for Windows and not suitable for Linux or macOS. Also, it has no default timeout; models can set timeouts via the timeout parameter as needed. If Windows Sudo is enabled, models can prefix commands with sudo to run with administrator privileges (subject to UAC prompt approval).

Key Features

Unlike Git Bash or WSL, this Skill natively executes commands via PowerShell 7, avoiding path conversion errors and background process hangs, while preserving true native exit codes (e.g., `rg` returning 1 for no matches, 2 for errors)—whereas `pwsh -Command` would flatten exit codes to 0/1 by default.

Limitations

Only compatible with Windows systems; requires PowerShell 7 (recommended 7.4+) and depends on the pi coding agent environment. Does not support native shell syntax for Linux/macOS.

FAQ

How do I install PowerShell 7?

Download the installer from the official Microsoft page (https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows) or use the command: `winget install Microsoft.PowerShell`.

Does this Skill support Linux or macOS?

No. It is designed specifically for Windows, leveraging PowerShell 7 and Windows-specific mechanisms like ConPTY and taskkill. On Linux/macOS, use the native bash tool instead.

Installation guide for AI assistants

If your AI coding assistant (Claude Code, Cursor, TRAE etc.) can see this page, send it this message to auto-install:

Visit https://321skill.com/skills/4fu-pi-pwsh/raw/index.md to read the original Skill definition (Markdown format) for @4fu/pi-pwsh, and install it according to the instructions.