sickn33/antigravity-awesome-skills/powershell-windows

Claude Code and agent skill by sickn33/antigravity-awesome-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.

Install

npx vskill@latest install sickn33/antigravity-awesome-skills/powershell-windows

SKILL.md

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. Encoding Compatibility

Prefer portable log markers
Purpose❌ Don't Use✅ Use
Success✅ ✓[OK] [+]
Error❌ ✗ 🔴[!] [X]
Warning⚠️ 🟡[*] [WARN]
Infoℹ️ 🔵[i] [INFO]
Progress⏳[...]

PowerShell supports Unicode. ASCII log markers are a portability choice, not a syntax requirement. For non-ASCII scripts read by Windows PowerShell 5.1, use UTF-8 with BOM; PowerShell 7 uses UTF-8 without BOM by default. Check the consuming tool before choosing file encoding.


3. Null Check Patterns

Always Check Before Access
❌ Wrong✅ Correct
$array.Count -gt 0($null -ne $array) -and (@($array).Count -gt 0)
$text.Lengthif ($null -ne $text) { $text.Length }

4. String Interpolation

Complex Expressions

"Value: $($obj.prop.sub)" is valid subexpression interpolation. Store a complex expression in a variable when that improves readability.

Pattern:

$value = $obj.prop.sub
Write-Output "Value: $value"

5. Error Handling

ErrorActionPreference
ValueUse
StopRequired cmdlet failures must enter catch
ContinueReport a non-terminating error and continue deliberately
SilentlyContinueWhen errors expected
Try/Catch Pattern
  • A return inside try is valid; finally still runs
  • 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)Out-Null`

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" -RawConvertFrom-Json`
Write`$dataConvertTo-Json -Depth 10Out-File "file.json" -Encoding UTF8`

9. Common Errors

Error MessageCauseFix
"parameter 'or'"Missing parenthesesWrap cmdlets in ()
"Unexpected token"Parsing or quoting errorInspect the reported token and file encoding
"Cannot find property"Null objectCheck null first
"Cannot convert"Type mismatchValidate input and convert to the required type

10. Script Template

powershell
# Strict mode
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# Paths
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
# Main
try {
# Cmdlet logic here; check $LASTEXITCODE after native executables.
Write-Output "[OK] Done"
exit 0
}
catch {
Write-Warning "Error: $_"
exit 1
}

Remember: Check shell version, encoding, null semantics and native exit codes. try/catch alone does not reliably turn native command failures into exceptions.

References: encoding, quoting.

When to Use

Use when writing or debugging Windows PowerShell or PowerShell 7 scripts, especially command expressions, encoding, paths and error handling.

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.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
36,871
Repository forks
6,027
Repository npm downloads, 7 days
6,143
7-day trend score
74

Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 9 May 2026, 5 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/sickn33/antigravity-awesome-skills/powershell-windows/badge)](https://verified-skill.com/skills/sickn33/antigravity-awesome-skills/powershell-windows)

Something wrong with this skill or its page? Tell us.