powershell-safe-invocation
Use when writing or running PowerShell on Windows, especially native programs, quoted paths, escaping, pwsh, Start-Process, file operations, or shell troubleshooting.
npx skills add Misaka-Mikoto-Tech/agent-skills --skill powershell-safe-invocation --agent codex
Same command for any agent — swap --agent for claude-code, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# PowerShell Safe Invocation ## Shell Use PowerShell 7 through `pwsh.exe` unless Windows PowerShell 5.1 is explicitly required. When the active shell is uncertain, verify: ```powershell $PSVersionTable.PSVersion $PSNativeCommandArgumentPassing ``` Do not assume installing PowerShell 7 makes `powershell.exe` use PowerShell 7: - `pwsh.exe` = PowerShell 7 - `powershell.exe` = Windows PowerShell 5.1 ## Native Programs Never construct one large command string when arguments can be passed separately. Use: ```powershell $exe = 'C:\Path With Spaces\tool.exe' $argList = @( '--input' 'C:\Data Folder\input.json' '--flag' ) & $exe @argList $exitCode = $LASTEXITCODE if ($exitCode -ne 0) { throw "$exe failed with exit code $exitCode" } ``` Rules: - Treat every native argument as one array item. - Invoke executable paths stored in variables with `&`. - Capture `$LASTEXITCODE` immediately. - Avoid using `$args` as your own argument array name; it is a PowerShell automatic variable. Use names like `$argList` or `$nativeArgs`. - Do not use `Invoke-Expression`. - Do not add a `cmd.exe /c` layer merely to launch an executable. - Do not use Bash-style `\"` escaping in PowerShell. ## Cmdlets Use hashtab
- Shell
- Native Programs
- Cmdlets
- Complex Commands
- Strings And Multiline Code
- Start-Process
- File Operations
- Version And Module Differences
- Decision Order
What does the powershell-safe-invocation skill do?
Use when writing or running PowerShell on Windows, especially native programs, quoted paths, escaping, pwsh, Start-Process, file operations, or shell troubleshooting.
How do I install it?
Run `npx skills add Misaka-Mikoto-Tech/agent-skills --skill powershell-safe-invocation --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From Misaka-Mikoto-Tech/agent-skills, a repository with 213 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
