powershell-patterns
Skill2 starsChanged 5 months agoMITView on GitHub
PowerShell 5.1 patterns, pitfalls, and best practices for Windows development. Use when running terminal commands, writing PowerShell scripts, working with Node.js/npm on Windows, or encountering PowerShell errors. Covers nvm-windows, Angular template escaping, execution policy, and cmdlet selection.
- Installs packages
In this repository6 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- ai-engineerSkill
- developerSkill
- explore-codebaseSkill
- git-workflowSkill
- skill-creatorSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
Native cmdlets: not aliases: Get-ChildItem not ls, Select-String not findstr
- Very specific: line 66
Test-Path: before reading/writing
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PowerShell Patterns for Development
Critical Pitfalls
Templates with {{ }} — NEVER use Set-Content or heredocs
PowerShell interprets {{ }} as variable interpolation. Use the agent's create_file
tool for any file containing {{ }}, ${{}}, or Angular syntax.
# ❌ NEVER:
Set-Content file.html @"<div>{{ title }}</div>"@
# ✅ Always: agent create_file tool
# Editing existing files: replace_string_in_file
# Commands WITHOUT {{ }}: Set-Content with single quotes works finenvm-windows
nvm install X.Y.Zdoes NOT auto-activate →nvm use X.Y.Zis mandatorynvm listshows installed versions,*= active- Global packages (
@angular/cli) are NOT migrated between versions - Requires Admin shell — run PowerShell as Administrator
@angular/cli@22→ Node^22.22.3 || ^24.15.0 || >=26.0.0
Chaining — NEVER &&
&& is not valid in PowerShell 5.1:
npm install; npm run build # OK
npm install # Better: separate commands
npm run buildExecution Policy
Windows 11/10 default to Restricted — .ps1 scripts won't execute.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned # Requires admin
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser # Without adminBest Practices
- Native cmdlets not aliases:
Get-ChildItemnotls,Select-Stringnotfindstr - Quote paths:
"C:\Path With Spaces\file.txt" Select-Object -First Nto limit output2>$nullto suppress stderrTest-Pathbefore reading/writing- NEVER
Start-Sleep— the agent is notified when async commands finish Remove-Item -Forceto delete;Push-Location/Pop-Locationto navigate
File Operations Decision Table
| Task | Tool |
Create file with {{ }} | Agent create_file |
| Edit existing file | replace_string_in_file |
| Multiple simultaneous edits | multi_replace_string_in_file |
| Simple script without templates | Set-Content with single quotes |
| Overwrite existing file | Remove-Item -Force → create_file |
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.

