powershell-windows
Skill130 starsChanged 10 months agoMITView on GitHub
PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
We split this skill into the rules it gives an agent
5 rules. 4 are common, 0 are distinctive, and 1 is very specific to this project.
4
Common
Most of the 9 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 38
Rule: Use ASCII characters only in PowerShell scripts.
- Common: line 81
Don't return inside try block
- Common: line 82
Use finally for cleanup
- Common: line 97
Rule: Use Join-Path for cross-platform safety.
- Very specific: line 121
Rule: Always specify -Depth for nested objects.
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 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
# 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.
Other versions17 projects use a version of this.
Word for word · 6
- VoDaiLocz/kilo-kit-mcp★ 26100% same
- xfstudio/skills★ 9100% same
- SKB3002/agenthub★ 4100% same
- ai4brands-design/claude-skills★ 2100% same
- sid-lakhani/agents-config★ 2100% same
- taeeho/ClaudeSkills★ 0100% same
Edited · 8
- itsfatduck/optimizerDuck★ 10k92% same
- vudovn/ag-kit★ 8.2k92% same
- vudovn/antigravity-kit★ 8.2k92% same
- involvex/youtube-music-cli★ 46192% same
- Fandry96/k3-agentic-skills★ 2792% same
- soumatheusgomes/agentville★ 989% same
- jornalistainclusivo/jinc-skills★ 1100% same
- MortuisVMain/ai-agent-superpowers★ 070% same
Wrote their own version · 3
- JAXTech-Labs/claude-code-template★ 2same name
- TTNAN/wps-agent-skills★ 2same name
- komissar-dev/ClaudeCode-Properties-1S★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use intelligent-routing, nextjs-react-expert and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SKB3002Skillintelligent-routing
Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
Also in 6 projects that use this
SKB3002Skillnextjs-react-expert
React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
Also in 3 projects that use this
xfstudioSkillrust-pro
Master Rust 1.75+ with modern async patterns, advanced type system
Also in 5 projects that use this
goca-seSkillbatch-operations
Apply a change safely across many files — refactors touching more than 5 files, library or API migrations, project-wide renames of symbols/imports/paths, or adding boilerplate to many files. Use when "do it all at once" risks context overflow or silent failures.
Also in 3 projects that use this
jornalistainclusivoSkilldesign-spec
How to author a DESIGN.md file — the machine-readable design-token + human-rationale format that must exist before any UI is built. YAML front-matter token schema (colors, typography, spacing, rounded, components), type system, token references, and canonical section order.
Also in 3 projects that use this
xfstudioSkillgcp-cloud-run
Specialized skill for building production-ready serverless applications on GCP. Covers Cloud Run services (containerized), Cloud Run Functions (event-driven), cold start optimization, and event-driven architecture with Pub/Sub.
Also in 3 projects that use this
- +3 more from xfstudio
In this repository45 other files it gives its agents.
- api-patternsSkill
- app-builderSkill
- templatesSkill
- architectureSkill
- bash-linuxSkill
- behavioral-modesSkill
- brainstormingSkill
- clean-codeSkill
- code-review-checklistSkill
- database-designSkill
- deployment-proceduresSkill
- documentation-templatesSkill
- frontend-designSkill
- 2d-gamesSkill
- 3d-gamesSkill
- game-artSkill
- game-audioSkill
- game-designSkill
- mobile-gamesSkill
- multiplayerSkill
- pc-gamesSkill
- game-developmentSkill
- vr-arSkill
- web-gamesSkill
- geo-fundamentalsSkill
- i18n-localizationSkill
- lint-and-validateSkill
- mcp-builderSkill
- mobile-designSkill
- nextjs-best-practicesSkill
- nodejs-best-practicesSkill
- parallel-agentsSkill
- performance-profilingSkill
- plan-writingSkill
- python-patternsSkill
- react-patternsSkill
- red-team-tacticsSkill
- seo-fundamentalsSkill
- server-managementSkill
- systematic-debuggingSkill
- tailwind-patternsSkill
- tdd-workflowSkill
- testing-patternsSkill
- vulnerability-scannerSkill
- webapp-testingSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

