powershell-safe-invocation

powershell-safe-invocation is a skill for Claude Code, Codex from Misaka-Mikoto-Tech/agent-skills. It costs 40 tokens per session (1,777 once invoked), scanned A, original, MIT.

PowerShell guidance for running Windows commands and programs with correctly separated arguments, quoted paths, and error checks.

In plain words
What is it for?
Writing scripts that launch native programs, handle file paths, check exit codes, and troubleshoot PowerShell commands.
Why use it?
It helps prevent failures caused by spaces, quoting differences, or accidentally using the wrong PowerShell version.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Writing scripts that launch native programs, handle file paths, check exit codes, and troubleshoot PowerShell commands.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/misaka-mikoto-tech/agent-skills/powershell-safe-invocation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Misaka-Mikoto-Tech/agent-skills --skill powershell-safe-invocation
Clone the repo
git clone --depth 1 https://github.com/Misaka-Mikoto-Tech/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for powershell-safe-invocation

README.md
[![agentmods](https://agentmods.dev/badge/skills/misaka-mikoto-tech/agent-skills/powershell-safe-invocation.svg)](https://agentmods.dev/skills/misaka-mikoto-tech/agent-skills/powershell-safe-invocation)
Your own site
<a href="https://agentmods.dev/skills/misaka-mikoto-tech/agent-skills/powershell-safe-invocation"><img src="https://agentmods.dev/badge/skills/misaka-mikoto-tech/agent-skills/powershell-safe-invocation.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,777 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00040 $0.01777
Opus 5 $0.00020 $0.00889
Sonnet 5 $0.00008 $0.00355
Haiku 4.5 $0.00004 $0.00178

Measured 7d ago against content hash 7d376c76f0d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

powershell-safe-invocation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/powershell-safe-invocation/SKILL.md · 203 lines

How it starts

The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

$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:

$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 hashtable splatting for PowerShell cmdlets:

$params = @{
    LiteralPath = 'C:\Data[1]\input.txt'
    Destination = 'C:\Output'
    Force       = $true
    ErrorAction = 'Stop'
}

Copy-Item @params

Use -LiteralPath for concrete paths when the cmdlet supports it. For cmdlets that expose only -Path, such as New-Item, use -Path; when unsure, check Get-Command <cmdlet> -Syntax.

Do not use $LASTEXITCODE to test a PowerShell cmdlet. Use terminating errors:

$ErrorActionPreference = 'Stop'

Wrap expressions passed as parameter values in parentheses or assign them first: use Select-Object -Index (100..120), not -Index 100..120.

Do not pipe directly from statement syntax such as foreach (...) { ... } | ...; assign the statement output first or use the pipeline cmdlet ForEach-Object.

Read the full file on GitHub · 203 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 203 lines · 40 tokens per session scan A 7d376c76f0d9

Subscribe to this mod's changes

powershell-safe-invocation is a skill published in the GitHub repository Misaka-Mikoto-Tech/agent-skills (254 stars, last pushed 3d ago), licensed MIT. It adds 40 tokens to every session and 1,777 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

codex-multi-profile

Windows Codex Desktop multi-account picker (Codex Accounts app) plus AuthSwap launchers (codex1, codex2, ...). Humans pick accounts in Show-CodexAccountApp.ps1. Agents use pool / stick / route / depleted. ShareLive keeps history in /.codex; only auth.json is per-profile. Launch MUST set env vars through a cmd wrapper.…

Hung2124/codex-multi-profile · 104 tokens

windows-dev-process-cleanup

A Windows troubleshooting guide for auditing and safely cleaning leftover development processes and UWP background tasks. UWP is Windows' platform for packaged apps.

bahayonghang/my-ai-cli-toolkit · 124 tokens

clean-windows-c-drive

Provide a standalone Simplified Chinese Windows app and CLI workflows to assess C: drive health, clean a fixed allowlist of regenerable junk, find large user files, detect exact duplicates with SHA-256, and relocate or recycle explicitly approved ordinary user files without breaking Windows or installed applications.…

1181652815-hub/clean-windows-c-drive-skill · 124 tokens

powershell-docs

PowerShell 7.6 + Windows PowerShell 5.1 — variables, arrays, hashtables, functions, classes, remoting, modules, DSC.

pledgeandgrow/pledge-skills · 39 tokens

deobfuscating-malicious-powershell

Deobfuscates malicious PowerShell by decoding -EncodedCommand, reversing string and format obfuscation, resolving base64/gzip/IEX layers, and recovering the final payload and IOCs. Activates for requests to deobfuscate, decode, or analyze obfuscated PowerShell commands or scripts.

meltedinhex/analyst-ai-pack · 71 tokens

hunting-suspicious-powershell-execution

Hunts malicious PowerShell using script-block (EID 4104) and module logging: scoring encoded commands, download cradles, AMSI/logging bypass, and in-memory execution, then decoding payloads for triage. Activates for requests to hunt malicious PowerShell, analyze script-block logs, or detect encoded command abuse.

meltedinhex/analyst-ai-pack · 79 tokens