MR
Mayur Rathi
@mayurrathi
⭐ 40.7k GitHub stars

Powershell Windows

Powershell Windows is an code AI skill with a core value of PowerShell Windows patterns. It helps developers solve real-world problems in the code domain, boosting efficiency, automating repetitive tasks, and optimizing workflows.

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

Last verified on: 2026-07-07

Quick Facts

Category code
Works With Claude
Source sickn33/antigravity-awesome-skills
Stars ⭐ 40.7k
Last Verified 2026-07-07
Risk Level Medium
mkdir -p ./skills/powershell-windows && curl -sfL https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/powershell-windows/SKILL.md -o ./skills/powershell-windows/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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:**

text
$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.

🎯 Best For

  • Claude users
  • Software engineers
  • Development teams
  • Tech leads

💡 Use Cases

  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Powershell Windows to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Is Powershell Windows compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Powershell Windows?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Powershell Windows?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/powershell-windows/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills