Check calendars, find open times, and manage Google Calendar events with confirmation before every change.
Coding
PowerShell
Avoid common PowerShell mistakes — output behavior, array traps, and comparison operator gotchas.
What it does
Output Behavior Everything not captured goes to output — even without or doesn't stop output — previous uncaptured expressions still output bypasses pipeline — use for display only, not data Assign to to suppress — cast also suppresses —
The skill document
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
Related skills
Save, search, organize, and manage Get Notes content and knowledge bases through explicit commands.
Build and operate a testable learning plan with practice, spaced review, transfer checks, and durable local records.
Learn a topic through level checks, adaptive explanations, retrieval practice, and review across sessions.
Discover and trade Polymarket crypto fast markets using CEX momentum or a custom signal.
Extract email dates, links, and deadlines for review, then create or update tracked Google Calendar events.
More from Iván
Browse all skillsWrite, debug, and tune Java and JVM systems with JDK-aware code and diagnostic steps.
Design and critique visual artifacts using measurable rules for hierarchy, spacing, type, color, and layout.
Diagnose CSS mechanics and produce targeted fixes or complete stylesheets for the chosen stack.
Architect, troubleshoot, secure, and cost-control AWS infrastructure with explicit cost and blast-radius guidance.
Diagnose, validate, transform, and evolve JSON payloads across parsers, schemas, storage, and large files.
Build and operate a testable learning plan with practice, spaced review, transfer checks, and durable local records.