{"id":"65a51061-c45d-4f7c-a223-75c515cc878b","shortId":"W4cPXg","kind":"skill","title":"powershell-windows","tagline":"PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.","description":"# PowerShell Windows Patterns\n\n> Critical patterns and pitfalls for Windows PowerShell.\n\n---\n\n## 1. Operator Syntax Rules\n\n### CRITICAL: Parentheses Required\n\n| ❌ Wrong | ✅ Correct |\n|----------|-----------|\n| `if (Test-Path \"a\" -or Test-Path \"b\")` | `if ((Test-Path \"a\") -or (Test-Path \"b\"))` |\n| `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` |\n\n**Rule:** Each cmdlet call MUST be in parentheses when using logical operators.\n\n---\n\n## 2. Unicode/Emoji Restriction\n\n### CRITICAL: No Unicode in Scripts\n\n| Purpose | ❌ Don't Use | ✅ Use |\n|---------|-------------|--------|\n| Success | ✅ ✓ | [OK] [+] |\n| Error | ❌ ✗ 🔴 | [!] [X] |\n| Warning | ⚠️ 🟡 | [*] [WARN] |\n| Info | ℹ️ 🔵 | [i] [INFO] |\n| Progress | ⏳ | [...] |\n\n**Rule:** Use ASCII characters only in PowerShell scripts.\n\n---\n\n## 3. Null Check Patterns\n\n### Always Check Before Access\n\n| ❌ Wrong | ✅ Correct |\n|----------|-----------|\n| `$array.Count -gt 0` | `$array -and $array.Count -gt 0` |\n| `$text.Length` | `if ($text) { $text.Length }` |\n\n---\n\n## 4. String Interpolation\n\n### Complex Expressions\n\n| ❌ Wrong | ✅ Correct |\n|----------|-----------|\n| `\"Value: $($obj.prop.sub)\"` | Store in variable first |\n\n**Pattern:**\n```\n$value = $obj.prop.sub\nWrite-Output \"Value: $value\"\n```\n\n---\n\n## 5. Error Handling\n\n### ErrorActionPreference\n\n| Value | Use |\n|-------|-----|\n| Stop | Development (fail fast) |\n| Continue | Production scripts |\n| SilentlyContinue | When errors expected |\n\n### Try/Catch Pattern\n\n- Don't return inside try block\n- Use finally for cleanup\n- Return after try/catch\n\n---\n\n## 6. File Paths\n\n### Windows Path Rules\n\n| Pattern | Use |\n|---------|-----|\n| Literal path | `C:\\Users\\User\\file.txt` |\n| Variable path | `Join-Path $env:USERPROFILE \"file.txt\"` |\n| Relative | `Join-Path $ScriptDir \"data\"` |\n\n**Rule:** Use Join-Path for cross-platform safety.\n\n---\n\n## 7. Array Operations\n\n### Correct Patterns\n\n| Operation | Syntax |\n|-----------|--------|\n| Empty array | `$array = @()` |\n| Add item | `$array += $item` |\n| ArrayList add | `$list.Add($item) | Out-Null` |\n\n---\n\n## 8. JSON Operations\n\n### CRITICAL: Depth Parameter\n\n| ❌ Wrong | ✅ Correct |\n|----------|-----------|\n| `ConvertTo-Json` | `ConvertTo-Json -Depth 10` |\n\n**Rule:** Always specify `-Depth` for nested objects.\n\n### File Operations\n\n| Operation | Pattern |\n|-----------|---------|\n| Read | `Get-Content \"file.json\" -Raw | ConvertFrom-Json` |\n| Write | `$data | ConvertTo-Json -Depth 10 | Out-File \"file.json\" -Encoding UTF8` |\n\n---\n\n## 9. Common Errors\n\n| Error Message | Cause | Fix |\n|---------------|-------|-----|\n| \"parameter 'or'\" | Missing parentheses | Wrap cmdlets in () |\n| \"Unexpected token\" | Unicode character | Use ASCII only |\n| \"Cannot find property\" | Null object | Check null first |\n| \"Cannot convert\" | Type mismatch | Use .ToString() |\n\n---\n\n## 10. Script Template\n\n```powershell\n# Strict mode\nSet-StrictMode -Version Latest\n$ErrorActionPreference = \"Continue\"\n\n# Paths\n$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path\n\n# Main\ntry {\n    # Logic here\n    Write-Output \"[OK] Done\"\n    exit 0\n}\ncatch {\n    Write-Warning \"Error: $_\"\n    exit 1\n}\n```\n\n---\n\n> **Remember:** PowerShell has unique syntax rules. Parentheses, ASCII-only, and null checks are non-negotiable.\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["powershell","windows","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows"],"capabilities":["skill","source-sickn33","skill-powershell-windows","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/powershell-windows","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 37911 github stars · SKILL.md body (3,698 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:51:33.118Z","embedding":null,"createdAt":"2026-04-18T20:31:28.861Z","updatedAt":"2026-05-18T18:51:33.118Z","lastSeenAt":"2026-05-18T18:51:33.118Z","tsv":"'0':126,131,362 '1':23,369 '10':263,290,332 '2':82 '3':114 '4':136 '5':60,69,157 '6':189 '7':227 '8':248 '9':297 'access':121 'action':399 'add':237,242 'alway':118,265 'applic':393 'array':127,228,235,236,239 'array.count':124,129 'arraylist':241 'ascii':108,316,378 'ascii-on':377 'ask':437 'b':41,51 'block':181 'boundari':445 'c':199 'call':73 'cannot':318,326 'catch':363 'caus':302 'charact':109,314 'check':116,119,323,382 'clarif':439 'cleanup':185 'clear':412 'cmdlet':72,309 'common':298 'complex':139 'content':278 'continu':167,344 'convert':327 'convertfrom':282 'convertfrom-json':281 'convertto':257,260,287 'convertto-json':256,259,286 'correct':31,123,142,230,255 'criteria':448 'critic':7,16,27,85,251 'cross':224 'cross-platform':223 'data':216,285 'depth':252,262,267,289 'describ':400,416 'develop':164 'done':360 'empti':234 'encod':295 'env':208 'environ':428 'environment-specif':427 'eq':59,68 'error':11,97,158,172,299,300,367 'erroractionprefer':160,343 'execut':395 'exit':361,368 'expect':173 'expert':433 'express':140 'fail':165 'fast':166 'file':190,271,293 'file.json':279,294 'file.txt':202,210 'final':183 'find':319 'first':148,325 'fix':303 'get':54,63,277 'get-cont':276 'get-item':53,62 'gt':125,130 'handl':12,159 'info':101,104 'input':442 'insid':179 'interpol':138 'item':55,64,238,240,244 'join':206,213,220 'join-path':205,212,219 'json':249,258,261,283,288 'latest':342 'limit':404 'list.add':243 'liter':197 'logic':80,354 'main':352 'match':413 'messag':301 'mismatch':329 'miss':306,450 'mode':337 'must':74 'myinvocation.mycommand.path':351 'negoti':386 'nest':269 'non':385 'non-negoti':384 'null':115,247,321,324,381 'obj.prop.sub':144,151 'object':270,322 'ok':96,359 'oper':9,24,81,229,232,250,272,273 'out-fil':291 'out-nul':245 'output':154,358,422 'overview':403 'paramet':253,304 'parent':350 'parenthes':28,77,307,376 'path':35,40,45,50,191,193,198,204,207,214,221,345,349 'pattern':6,15,17,117,149,175,195,231,274 'permiss':443 'pitfal':8,19 'platform':225 'powershel':2,4,13,22,112,335,371 'powershell-window':1 'product':168 'progress':105 'properti':320 'purpos':90 'raw':280 'read':275 'relat':211 'rememb':370 'requir':29,441 'restrict':84 'return':178,186 'review':434 'rule':26,70,106,194,217,264,375 'safeti':226,444 'scope':415 'script':89,113,169,333 'scriptdir':215,346 'set':339 'set-strictmod':338 'silentlycontinu':170 'skill':391,407 'skill-powershell-windows' 'source-sickn33' 'specif':429 'specifi':266 'split':348 'split-path':347 'stop':163,435 'store':145 'strict':336 'strictmod':340 'string':137 'substitut':425 'success':95,447 'syntax':10,25,233,374 'task':411 'templat':334 'test':34,39,44,49,431 'test-path':33,38,43,48 'text':134 'text.length':132,135 'token':312 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'tostr':331 'treat':420 'tri':180,353 'try/catch':174,188 'type':328 'unexpect':311 'unicod':87,313 'unicode/emoji':83 'uniqu':373 'use':79,93,94,107,162,182,196,218,315,330,389,405 'user':200,201 'userprofil':209 'utf8':296 'valid':430 'valu':143,150,155,156,161 'variabl':147,203 'version':341 'warn':99,100,366 'window':3,5,14,21,192 'workflow':397 'wrap':308 'write':153,284,357,365 'write-output':152,356 'write-warn':364 'wrong':30,122,141,254 'x':56,65,98 'y':58,67 'ℹ️':102","prices":[{"id":"cadc8056-1a21-4459-9c6e-d677a804d4a8","listingId":"65a51061-c45d-4f7c-a223-75c515cc878b","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T20:31:28.861Z"}],"sources":[{"listingId":"65a51061-c45d-4f7c-a223-75c515cc878b","source":"github","sourceId":"sickn33/antigravity-awesome-skills/powershell-windows","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/powershell-windows","isPrimary":false,"firstSeenAt":"2026-04-18T21:42:38.050Z","lastSeenAt":"2026-05-18T18:51:33.118Z"},{"listingId":"65a51061-c45d-4f7c-a223-75c515cc878b","source":"skills_sh","sourceId":"sickn33/antigravity-awesome-skills/powershell-windows","sourceUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/powershell-windows","isPrimary":true,"firstSeenAt":"2026-04-18T20:31:28.861Z","lastSeenAt":"2026-05-07T22:40:31.027Z"}],"details":{"listingId":"65a51061-c45d-4f7c-a223-75c515cc878b","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"powershell-windows","github":{"repo":"sickn33/antigravity-awesome-skills","stars":37911,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-05-18T08:24:49Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"3af0f36a009255189cbe992614893dd53350b5ab","skill_md_path":"skills/powershell-windows/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/powershell-windows"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"powershell-windows","description":"PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/powershell-windows"},"updatedAt":"2026-05-18T18:51:33.118Z"}}