powershell-windows
FeaturedPowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
AI & Automation 39,350 stars
6386 forks Updated today MIT
Install
Quality Score: 99/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
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:**
```
$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...
Details
- Author
- sickn33
- Repository
- sickn33/antigravity-awesome-skills
- Created
- 4 months ago
- Last Updated
- today
- Language
- Python
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Listed
powershell-windows
PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
335 Updated today
aiskillstore AI & Automation Solid
powershell-windows
PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
27,705 Updated today
davila7 AI & Automation Featured
windows-shell-reliability
Reliable command execution on Windows: paths, encoding, and common binary pitfalls.
39,350 Updated today
sickn33 Code & Development Listed
windows-shell-reliability
Reliable command execution on Windows: paths, encoding, and common binary pitfalls.
4 Updated 2 weeks ago
arlenagreer Code & Development Listed
windows-shell-reliability
Reliable command execution on Windows: paths, encoding, and common binary pitfalls.
0 Updated today
tapanshah