Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Windows PowerShell Safe

    1

    Help AI agents avoid common Windows PowerShell quoting, encoding, version and exit-code mistakes.

    Free

    1 useSecurity scanned
    Windows PowerShell Safe

    Windows PowerShell Safe

    Example session with this skill installed

    On Windows PowerShell 5.1, demonstrate how to pass a path and label containing spaces to a native executable and capture a nonzero exit code. Use a harmless fixture; do not read or modify any real project data.

    • Read your context and instructions
    • Compiled the windows powershell safe

    Checked behavior

    The native fixture received exactly four argument items. The path containing a space and the multiword label were each preserved as one item. The fixture deliberately exited with code 7, and PowerShell captured that code immediately.

    Invocation pattern

    $argList = @($fixture, '--input', 'C:\Demo Data\input.txt', '--label', 'example label')
    & $Python @argList
    $code = $LASTEXITCODE
    if ($code -ne 7) { throw "Expected fixture exit 7, got $code" }
    

    Here, $Python is a verified absolute interpreter path and $fixture is the harmless demo-argv.py file supplied with the submission materials. C:\Demo Data\input.txt is only an argument string: the fixture does not open it.

    Observed output

    {"arguments": ["--input", "C:\\Demo Data\\input.txt", "--label", "example label"], "argument_count": 4}
    Native exit code: 7
    PASS: argument boundaries and nonzero native exit code verified.
    

    Next steps and scope

    Use the same argument-array and immediate-exit-code pattern with the project's approved executable. Handle the actual tool's success codes according to its documentation. This check covers Windows PowerShell 5.1 invocation only; it does not prove that every command, encoding case or PowerShell 7 environment is correct.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    A free, focused guide for AI coding agents that run commands on Windows. It covers problems that frequently break otherwise reasonable automation: mixing Windows PowerShell 5.1 with PowerShell 7, nested quoting, paths with spaces, text encoding, native exit codes and process launching.

    What it teaches

    • Distinguish powershell.exe from pwsh.exe before choosing syntax or .NET APIs.
    • Pass native arguments as separate array items instead of composing a shell string.
    • Prefer a .ps1 file over fragile nested -Command expressions.
    • Treat native exit codes and PowerShell cmdlet exceptions separately.
    • Preserve existing file encodings and explicitly choose output encodings.
    • Stop repeated failures and validate destructive paths before proceeding.

    What's included

    SKILL.md, eight experience/documentation-based failure examples, source metadata and both upstream MIT notices. The main instructions are in Simplified Chinese; code and command identifiers remain unchanged. The marketplace description is English.

    Evidence and limits

    A harmless Windows PowerShell 5.1 demonstration verified argument boundaries for paths/labels with spaces and immediate capture of a native process's deliberate exit code 7. This is a focused invocation check, not a complete agent-behavior or PowerShell 7 regression suite. The eight reference examples remain labeled as experience/documentation guidance rather than fully rerun tests. This skill is not an OS sandbox and cannot guarantee safe execution.

    Attribution

    Adapted and maintained by haxsd / agent-skills contributors from Misaka Mikoto's powershell-safe-invocation (MIT), with stop-rule wording adapted from agent-shells contributors (MIT). Original copyright notices and fixed source revisions are included. Original contribution is the local adaptation, not ownership of the upstream method. No upstream endorsement is claimed.

    No API key or paid service is required to use the guide. Reading it does not require administrator privileges. File changes and process execution still require authorization for the underlying task.

    ProcessStartInfo.ArgumentList is unavailable on PowerShell 5.1. Requires manual scrubbing of private logs. Destructive operations are blocked on root-level or empty paths.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    1 use

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    • Free with an Agensi account

    Permissions

    Read Files
    Write Files

    Terminal/process execution and local file read/write only when needed for the user-authorized task. The guide itself makes no network requests and requires no credentials. No administrator privileges by default. This is guidance, not an OS sandbox.

    Listed1 month ago
    Updated1 month ago

    What's inside

    Frequently Asked Questions

    This skill eliminates common PowerShell failures caused by spaces in file paths, incorrect character encoding, and fragile string concatenation that often breaks when AI agents attempt to run scripts in Windows environments.

    The skill is compatible with both legacy Windows PowerShell 5.1 and modern PowerShell 7 (pwsh), automatically detecting the environment to use the correct syntax and cmdlets for each version.

    Unlike standard prompting which often relies on the risky 'Invoke-Expression', this skill enforces the use of array-based argument lists and hashtable splatting to ensure commands are executed securely and predictably.

    The skill ensures UTF-8 consistency across operations and prioritizes '-LiteralPath' over standard paths, preventing the silent data corruption or file errors that occur when special characters or brackets are present.

    You receive the optimized system prompt and logic configuration designed to be integrated directly into your AI agent's toolset or system instructions.

    New in Testing & Debugging