Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
sickn33 avatar

Powershell Windows

  • 2.3k installs
  • 44k repo stars
  • Updated July 27, 2026
  • sickn33/antigravity-awesome-skills

powershell-windows is a community skill for Windows PowerShell syntax pitfalls, null checks, and script templates.

About

PowerShell Windows Patterns documents critical syntax and reliability rules for Windows PowerShell scripts. Operator rules require parentheses around each cmdlet call when combining with -or or -and, because bare Test-Path chains parse incorrectly. Unicode and emoji are banned in scripts; use ASCII markers like [OK], [!], and [WARN] instead. Null checks must guard before accessing Count or Length on possibly empty variables. String interpolation should store complex property paths in variables before embedding in strings. Error handling guidance sets ErrorActionPreference per environment, avoids returning inside try blocks, and uses finally for cleanup. File paths prefer Join-Path with environment variables for cross-platform safety on Windows. JSON operations mandate ConvertTo-Json -Depth 10 for nested objects and UTF8 encoding on Out-File. A script template enables Set-StrictMode, Continue preference, Split-Path script directory resolution, and exit codes in catch blocks. Common error table maps parameter or, unexpected token, and null property failures to fixes.

  • Wrap cmdlet calls in parentheses when using -or and -and operators.
  • Use ASCII-only status markers; no emoji or Unicode in scripts.
  • Guard null before accessing Count or Length on variables.
  • Always pass -Depth 10 to ConvertTo-Json for nested objects.
  • Use Join-Path instead of hard-coded Windows path concatenation.

Powershell Windows by the numbers

  • 2,326 all-time installs (skills.sh)
  • +34 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #81 of 560 CLI & Terminal skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

powershell-windows capabilities & compatibility

Capabilities
logical operator parentheses rules · ascii only output conventions · null safe property access patterns · join path and json depth guidance · try catch script template with exit codes
Use cases
devops · debugging
Platforms
Windows
Runs
Runs locally
Pricing
Free
From the docs

What powershell-windows says it does

Each cmdlet call MUST be in parentheses when using logical operators.
SKILL.md
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill powershell-windows

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.3k
repo stars44k
Security audit3 / 3 scanners passed
Last updatedJuly 27, 2026
Repositorysickn33/antigravity-awesome-skills

Why does my PowerShell if statement fail with parameter 'or' or null property errors?

Write reliable Windows PowerShell scripts with correct operators, null checks, paths, and JSON depth handling.

Who is it for?

Writing or reviewing Windows PowerShell automation and agent-generated scripts.

Skip if: Skip for bash-only Linux workflows or PowerShell Core cross-platform modules without Windows specifics.

When should I use this skill?

User writes PowerShell on Windows or hits operator, Unicode, or JSON depth errors.

What you get

Scripts following parentheses, ASCII, null-safe, and Join-Path conventions with reliable JSON output.

  • Corrected `.ps1` scripts
  • Operator-safe conditional expressions

Files

SKILL.mdMarkdownGitHub ↗

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.Lengthif ($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

ValueUse
StopDevelopment (fail fast)
ContinueProduction scripts
SilentlyContinueWhen 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

PatternUse
Literal pathC:\Users\User\file.txt
Variable pathJoin-Path $env:USERPROFILE "file.txt"
RelativeJoin-Path $ScriptDir "data"

Rule: Use Join-Path for cross-platform safety.

---

7. Array Operations

Correct Patterns

OperationSyntax
Empty array$array = @()
Add item$array += $item
ArrayList add`$list.Add($item)

---

8. JSON Operations

CRITICAL: Depth Parameter

❌ Wrong✅ Correct
ConvertTo-JsonConvertTo-Json -Depth 10

Rule: Always specify -Depth for nested objects.

File Operations

OperationPattern
Read`Get-Content "file.json" -Raw
Write`$data

---

9. Common Errors

Error MessageCauseFix
"parameter 'or'"Missing parenthesesWrap cmdlets in ()
"Unexpected token"Unicode characterUse ASCII only
"Cannot find property"Null objectCheck null first
"Cannot convert"Type mismatchUse .ToString()

---

10. Script Template

# 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.

Related skills

How it compares

Use this when agents need Windows-specific PowerShell pitfall tables instead of generic cross-shell scripting guidance.

FAQ

Why does -or fail in an if test?

Each cmdlet call must be wrapped in parentheses when combined with logical operators.

Can I use checkmark emoji for success?

No. Use ASCII markers like [OK] or [+] to avoid encoding and parsing issues.

What JSON depth should I use?

Always specify ConvertTo-Json -Depth 10 for nested objects.

Is Powershell Windows safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

CLI & Terminalbackenddevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.