What problem does it solve? Generated PowerShell commands often break when quotes, paths with spaces, JSON, or nested shells are involved, causing corrupted arguments, silent failures, or unsafe file operations. This Skill provides rules and patterns for invoking native programs, cmdlets, and scripts on Windows without escaping bugs or destructive mistakes. ## Core Features & Use Cases - Safe native invocation: Pass arguments as arrays with & $exe @args, capture $LASTEXITCODE correctly, and avoid Invoke-Expression, cmd.exe /c wrappers, and Bash-style escaping. - Structured cmdlet usage: Apply hashtable splatting, -LiteralPath, terminating errors, and explicit encoding for reliable file operations. - Complex command handling: Move multiline or nested-quote logic into temporary .ps1 files run via pwsh.exe -NoLogo -NoProfile -NonInteractive -File, and use ProcessStartInfo.ArgumentList when exact argument boundaries or stdout/stderr capture are required. - Use Case: An agent must run a tool at C:\Program Files\App\tool.exe with a JSON input path containing spaces. Instead of building one quoted command string, it writes a small .ps1 script using an argument array and runs it with pwsh.exe -File, avoiding quoting corruption. ## Quick Start Use the powershell-safe-invocation skill to rewrite this command so it safely runs a native executable with a path containing spaces.