Back to Registry View Author Profile
Official Verified
PowerShell
Avoid common PowerShell mistakes — output behavior, array traps, and comparison operator gotchas.
skill-install — Terminal
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/ivangdavila/powershellOr
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
Metadata
AI Skill Finder
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skill Add to Configuration
Paste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-ivangdavila-powershell": {
"enabled": true,
"auto_update": true
}
}
}Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.
Related Skills
Animations
Create performant web animations with proper accessibility and timing.
ivangdavila 2190
Arduino
Develop Arduino projects avoiding common wiring, power, and code pitfalls.
ivangdavila 2190
Bulgarian
Write Bulgarian that sounds human. Not formal, not robotic, not AI-generated.
ivangdavila 2190
Arabic
Write Arabic that sounds human. Not formal, not robotic, not AI-generated.
ivangdavila 2190
Assistant
Manage tasks, communications, and scheduling with proactive and organized support.
ivangdavila 2190