
Powershell Windows
Write reliable Windows PowerShell automation without classic parser traps, unicode breakage, and unsafe null access.
Overview
PowerShell Windows is an agent skill most often used in Build (also Ship, Operate) that encodes critical Windows PowerShell syntax, null-safety, and ASCII-only output patterns to avoid common script failures.
Install
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill powershell-windowsWhat is this skill?
- Critical rule: wrap each cmdlet in parentheses when combining with -or / -and
- ASCII-only status markers—no emoji or unicode in scripts
- Null-safe patterns before .Count and .Length access
- String interpolation guidance: complex expressions via variables first
- Error handling patterns with ErrorActionPreference
- Five documented pattern areas: operators, unicode restriction, null checks, string interpolation, error handling
Adoption & trust: 1.9k installs on skills.sh; 40.1k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent keeps emitting PowerShell that fails to parse or blows up on empty variables because Windows operator and null rules differ from bash habits.
Who is it for?
Indie devs on Windows writing deployment, setup, or CI scripts in PowerShell with agent assistance.
Skip if: Pure Linux/macOS workflows where bash is the only shell in play.
When should I use this skill?
User or agent is writing, reviewing, or debugging Windows PowerShell scripts and needs critical syntax and pitfall guidance.
What do I get? / Deliverables
Scripts follow tested patterns for operators, strings, null checks, and errors so automation runs cleanly on Windows.
- Corrected PowerShell snippets following documented patterns
- Review checklist applied to existing .ps1 files
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
PowerShell scripts usually appear during Build when wiring Windows tooling, installers, and local dev automation—the canonical shelf for script authoring. Integrations covers shell scripts that glue tools, paths, and CI steps on Windows hosts.
Where it fits
Agent drafts a setup.ps1 that chains Test-Path checks before copying build artifacts.
You fix a Windows GitHub Actions step where -and between cmdlets failed parsing.
A nightly health-check script needs null-safe handling when a service list is empty.
How it compares
Pattern reference for Windows PowerShell pitfalls—not a replacement for official Microsoft docs or PSScriptAnalyzer in CI.
Common Questions / FAQ
Who is powershell-windows for?
PowerShell Windows is for builders and agents authoring or reviewing scripts on Windows who need guardrails against common syntax and null bugs.
When should I use powershell-windows?
Use it in Build when generating integration scripts; in Ship when fixing Windows CI steps; and in Operate when patching maintenance scripts—any time PowerShell uses -or/-and across cmdlets or prints status lines.
Is powershell-windows safe to install?
Check the Security Audits panel on this Prism page and the community source metadata; the skill is guidance-only and does not execute commands by itself.
SKILL.md
READMESKILL.md - Powershell Windows
# PowerShell Windows Patterns > Critical patterns and pitfalls for Windows PowerShell. --- ## 1. Operator Syntax Rules ### CRITICAL: Parentheses Required | ❌ Wrong | ✅ Correct | |----------|-----------| | `if (Test-Path "a" -or Test-Path "b")` | `if ((Test-Path "a") -or (Test-Path "b"))` | | `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` | **Rule:** Each cmdlet call MUST be in parentheses when using logical operators. --- ## 2. Unicode/Emoji Restriction ### CRITICAL: No Unicode in Scripts | Purpose | ❌ Don't Use | ✅ Use | |---------|-------------|--------| | Success | ✅ ✓ | [OK] [+] | | Error | ❌ ✗ 🔴 | [!] [X] | | Warning | ⚠️ 🟡 | [*] [WARN] | | Info | ℹ️ 🔵 | [i] [INFO] | | Progress | ⏳ | [...] | **Rule:** Use ASCII characters only in PowerShell scripts. --- ## 3. Null Check Patterns ### Always Check Before Access | ❌ Wrong | ✅ Correct | |----------|-----------| | `$array.Count -gt 0` | `$array -and $array.Count -gt 0` | | `$text.Length` | `if ($text) { $text.Length }` | --- ## 4. String Interpolation ### Complex Expressions | ❌ Wrong | ✅ Correct | |----------|-----------| | `"Value: $($obj.prop.sub)"` | Store in variable first | **Pattern:** ``` $value = $obj.prop.sub Write-Output "Value: $value" ``` --- ## 5. Error Handling ### ErrorActionPreference | Value | Use | |-------|-----| | Stop | Development (fail fast) | | Continue | Production scripts | | SilentlyContinue | When errors expected | ### Try/Catch Pattern - Don't return inside try block - Use finally for cleanup - Return after try/catch --- ## 6. File Paths ### Windows Path Rules | Pattern | Use | |---------|-----| | Literal path | `C:\Users\User\file.txt` | | Variable path | `Join-Path $env:USERPROFILE "file.txt"` | | Relative | `Join-Path $ScriptDir "data"` | **Rule:** Use Join-Path for cross-platform safety. --- ## 7. Array Operations ### Correct Patterns | Operation | Syntax | |-----------|--------| | Empty array | `$array = @()` | | Add item | `$array += $item` | | ArrayList add | `$list.Add($item) | Out-Null` | --- ## 8. JSON Operations ### CRITICAL: Depth Parameter | ❌ Wrong | ✅ Correct | |----------|-----------| | `ConvertTo-Json` | `ConvertTo-Json -Depth 10` | **Rule:** Always specify `-Depth` for nested objects. ### File Operations | Operation | Pattern | |-----------|---------| | Read | `Get-Content "file.json" -Raw | ConvertFrom-Json` | | Write | `$data | ConvertTo-Json -Depth 10 | Out-File "file.json" -Encoding UTF8` | --- ## 9. Common Errors | Error Message | Cause | Fix | |---------------|-------|-----| | "parameter 'or'" | Missing parentheses | Wrap cmdlets in () | | "Unexpected token" | Unicode character | Use ASCII only | | "Cannot find property" | Null object | Check null first | | "Cannot convert" | Type mismatch | Use .ToString() | --- ## 10. Script Template ```powershell # Strict mode Set-StrictMode -Version Latest $ErrorActionPreference = "Continue" # Paths $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path # Main try { # Logic here Write-Output "[OK] Done" exit 0 } catch { Write-Warning "Error: $_" exit 1 } ``` --- > **Remember:** PowerShell has unique syntax rules. Parentheses, ASCII-only, and null checks are non-negotiable. ## When to Use This skill is applicable to execute the workflow or actions described in the overview. ## Limitations - Use this skill only when the task clearly matches the scope described above. - Do not treat the output as a substitute for environment-specific validation, testing, or expert review. - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.