PowerShell
v1.0.0Avoid common PowerShell mistakes — output behavior, array traps, and comparison operator gotchas.
Security Scan
OpenClaw
Benign
high confidencePurpose & Capability
Name and description (PowerShell gotchas & tips) align with the declared requirement of the pwsh binary. No unrelated binaries, credentials, or config paths are requested.
Instruction Scope
SKILL.md is purely advisory: it lists tips, examples, and best practices. It does not instruct the agent to read arbitrary files, access credentials, call external endpoints, or perform data exfiltration.
Install Mechanism
No install spec and no code files — instruction-only skill. Nothing will be downloaded or written to disk by the skill itself.
Credentials
The skill requests no environment variables or credentials. It mentions using $env:VAR in a descriptive context only, which is appropriate for documentation.
Persistence & Privilege
always:false (default) and the skill does not request persistent system presence or attempt to modify other skills or system settings. Model invocation is allowed by default (normal for skills) but the skill itself is read-only documentation.
Assessment
This skill is just documentation (no code) and only requires the pwsh binary to be present, so the surface area is small. However, the registry entry has no homepage and an unknown source — if you rely on vendor provenance, verify the origin or prefer a documented source. Also note: while the skill itself won't run code, if you allow an autonomous agent to execute PowerShell on your machine, PowerShell can perform powerful system actions; only enable execution in environments you trust.Like a lobster shell, security has layers — review code before you run it.
Runtime requirements
🔵 Clawdis
OSLinux · macOS · Windows
Binspwsh
latest
Output Behavior
- Everything not captured goes to output — even without
returnorWrite-Output returndoesn't stop output — previous uncaptured expressions still outputWrite-Hostbypasses pipeline — use for display only, not data- Assign to
$nullto suppress —$null = SomeFunction [void]cast also suppresses —[void](SomeFunction)
Array Gotchas
- Single item result is scalar, not array —
@(Get-Item .)forces array - Empty result is
$null, not empty array — check withif ($result)carefully - Array unrolling in pipeline —
@(1,2,3) | ForEachsends items one by one +=on array creates new array — slow in loops, use[System.Collections.ArrayList],is array operator —,$itemwraps single item in array
Comparison Operators
-eq,-ne,-gt,-lt— not==,!=,>,<-likewith wildcards,-matchwith regex — both return bool-containsfor array membership —$arr -contains $item, not$item -in $arr(though-inworks too)- Case-insensitive by default —
-ceq,-cmatchfor case-sensitive $nullon left side —$null -eq $varprevents array comparison issues
String Handling
- Double quotes interpolate —
"Hello $name"expands variable - Single quotes literal —
'$name'stays as literal text - Subexpression for complex —
"Count: $($arr.Count)"for properties/methods - Here-strings for multiline —
@" ... "@or@' ... '@ - Backtick escapes —
`nfor newline,`tfor tab
Pipeline
$_or$PSItemis current object — same thing,$_more commonForEach-Objectfor pipeline —foreachstatement doesn't take pipeline-PipelineVariablesaves intermediate —Get-Service -PV svc | Where ...- Pipeline processes one at a time — unless function doesn't support streaming
Error Handling
$ErrorActionPreferencesets default —Stop,Continue,SilentlyContinue-ErrorAction Stopper command — makes non-terminating errors terminatingtry/catchonly catches terminating — setErrorAction Stopfirst$?is last command success —$LASTEXITCODEfor native commands
Common Mistakes
- No space before
{inif—if($x){works butif ($x) {preferred =is assignment in conditions — use-eqfor comparison- Function return array unrolls —
return ,@($arr)to keep array Get-Contentreturns lines array —-Rawfor single stringSelect-Objectcreates new object — properties are copies, not references
Cross-Platform
pwshis PowerShell 7+ —powershellis Windows PowerShell 5.1- Paths use
/or\—Join-Pathfor portable - Environment vars:
$env:VAR— works on all platforms - Aliases differ across platforms —
ls,catmay not exist, use full cmdlet names
Comments
Loading comments...
