powershell-windows
Skill0 starsChanged 41 days agoMITView on GitHub
Windows PowerShell 5.1 execution rules for the Bash/shell tool — chaining commands, $? vs $LASTEXITCODE, quoting and backtick escaping, Cyrillic/UTF-8 encoding corruption (non-UTF-8 console codepages such as cp866, us-ascii $OutputEncoding), file IO, exit codes, and running external exes. Use for ANY command run under Windows PowerShell 5.1, and especially when writing shell one-liners, piping output, handling non-ASCII text, or chaining dependent commands.
18 other projects use a version of this.
Adopted by
Most recently taken up by
- sid-lakhani/agents-configtheir own version, first seen Oct 20, 2026
- xfstudio/skillstheir own version, first seen Oct 13, 2026
- komissar-dev/ClaudeCode-Properties-1Stheir own version, first seen Oct 11, 2026
- xenitV1/Antigravity-Workflowstheir own version, first seen Oct 8, 2026
- vudovn/ag-kittheir own version, first seen Oct 8, 2026
- involvex/youtube-music-clitheir own version, first seen Oct 8, 2026
Used with
Projects 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
xfstudioSkillcontext7-auto-research
Automatically fetch latest library/framework documentation for Claude Code via Context7 API
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
- +3 more from xfstudio
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- itsfatduck/optimizerDuck★ 11ksame name
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- involvex/youtube-music-cli★ 477same name
- xenitV1/Antigravity-Workflows★ 130same name
- VoDaiLocz/kilo-kit-mcp★ 28same name
- Fandry96/k3-agentic-skills★ 27same name
- soumatheusgomes/agentville★ 9same name
- xfstudio/skills★ 9same name
- SKB3002/agenthub★ 4same name
8 more not listed
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.
In this repository19 other files it gives its agents.
- api-doc-recallSkill
- assistant-runtime-architectureSkill
- code-disciplineSkill
- english-requestSkill
- github-repo-opsSkill
- git-safetySkill
- long-task-continuitySkill
- opencode-config-authoringSkill
- opencode-tool-outputSkill
- provider-reconnectSkill
- reference-booksSkill
- release-checklistSkill
- research-synthesisSkill
- self-improvementSkill
- skill-authoringSkill
- subagent-delegationSkill
- task-closureSkill
- test-first-fixSkill
- troubleshooting-treeSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 5 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Prefer $? for chaining. Use $LASTEXITCODE only when you need the number, e.g.
- Distinctive: line 54
Read, Write, Edit, Glob, Grep.
- Very specific: line 70
Do not pipe file content through Select-Object -First/-Last to "limit" output — the harness already truncates and spills to a file.
- Distinctive: line 83
Do not assume those exact values — detect them once per session instead:
- Very specific: line 103
Never redirect cmdlet text output with > into a file.
- Very specific: line 104
If a native tool must emit non-ASCII, set the console to UTF-8 in the same command: chcp 65001 > $null.
- Distinctive: line 153
Never hardcode machine-specific values (tool paths, home directories, console codepage, git status of a directory).
- Distinctive: line 156
Do not assume git commands work anywhere.
- Very specific: line 160
Prefer Get-Command <tool> over a remembered path when you need the binary:
- Distinctive: line 182
If a workflow needs machine-specific facts, keep them in a machine-local file that is excluded from version control, not baked into a …
“Common” is measured: kept by at least 6 in 10 of the 16 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
Windows PowerShell 5.1 — execution rules
The shell is Windows PowerShell 5.1, not bash. Every command here is PowerShell unless it is an explicitly invoked native exe. Bash habits produce silent wrong answers more often than errors.
1. Chaining: no &&, no |, use ; if ($?)
&&, ||, and &&= do not exist in 5.1.
npm run build; if ($?) { npm test }$?= did the last pipeline succeed. Works for both cmdlets and native exes, but reflects only the immediately preceding statement.$LASTEXITCODE= numeric exit code of the last native exe only. It is stale/unset after a cmdlet.- Prefer
$?for chaining. Use$LASTEXITCODEonly when you need the number, e.g.if ($LASTEXITCODE -ne 0) { throw "build failed: $LASTEXITCODE" }. ;when you do not care whether the earlier command succeeded.- Full-length form, same semantics:
if (Test-Path -LiteralPath "x") { Remove-Item -LiteralPath "x" -Recurse -Force }
2. Quoting and escaping
Backtick ` is the escape character (not backslash).
| Intent | Write |
String with $var inside | "total: $count" |
Literal $ | 'price: $5' or "price:$5" `` |
Double quote inside " | `"quoted`" or 'say "hi"' |
| Backtick itself | `` (double it) |
| Line continuation | trailing backtick — nothing may follow it, not even a space |
- Prefer single quotes for anything not interpolating. Single-quoted
strings treat
$, backtick,"literally. - Regex needs single quotes:
'^\s*#','a{2,3}'. Double quotes would make PowerShell expand$and backticks inside the pattern first. -notmatch/-replacewith a$in the replacement needs the backtick escape ('``$1') or a script block replacement.
3. Do not use PowerShell cmdlets for file/content work
The tool harness has dedicated tools and they are faster and safer: Read, Write, Edit, Glob, Grep. Reach for the shell only for actual process execution.
Banned by default:
Get-Content (read), Set-Content / Out-File (write), Add-Content,
Select-String (search), Get-ChildItem for finding files (use Glob).
Legit shell uses: git, npm, npx, node, python, rg, dotnet,
cargo, docker, az, launching a build. Also fine: Test-Path,
Remove-Item, New-Item, Copy-Item, Move-Item when the operation itself is
the point.
- Full-cmdlet aliases:
ls,cat,echo,where,?,%,curl,mv,rm,cp. Avoid them in scripts — they hide what actually runs. curlis an alias forInvoke-WebRequest, not real curl. For real curl usecurl.exe. Same forwget→Invoke-WebRequest.- Do not pipe file content through
Select-Object -First/-Lastto "limit" output — the harness already truncates and spills to a file; truncating with cmdlets loses data.
4. Cyrillic / encoding — the big footgun
A stock Windows console is not UTF-8. On a RU-locale machine you will typically see:
[Console]::OutputEncoding→ cp866 (or cp1251)$OutputEncoding→ us-asciichcp→ 866
Do not assume those exact values — detect them once per session instead:
$PSVersionTable.PSVersion.ToString()
[Console]::OutputEncoding.WebName
$OutputEncoding.WebNameConsequences:
- Native exes inherit cp866. Russian text passed into an exe's argv
(or a pipe) gets mangled.
rgwith a Cyrillic pattern may silently find nothing. Out-File,>redirection, andSet-Contentuse us-ascii/Defaultencoding unless told otherwise.>on a file containing Cyrillic corrupts it.chcpoutput itself is unreadable in the captured log.
Rules:
- Never redirect cmdlet text output with
>into a file. Use the Write tool. - If a native tool must emit non-ASCII, set the console to UTF-8 in the same
command:
chcp 65001 > $null; <command>— and prefer tools that accept--encoding utf-8/-Encoding UTF8/-AsByteStream. - For non-ASCII search use the Grep tool, not
Select-String/rgthrough a pipe. - Reading a file that might be UTF-8:
Get-Content -Encoding UTF8. Default assumes the ANSI codepage and will produce mojibake for UTF-8 files. - PowerShell 7 (
pwsh) is not the default shell here. If a script needs PS7 features (??, ternary,&&), invokepwsh -NoProfile -Command "..."explicitly.
5. Paths
- Always quote:
& "C:\Program Files\nodejs\node.exe" --version. Unquoted paths with spaces are the single most common shell failure. - Native exe with a path → call operator
&. -LiteralPathfor anything user-supplied or containing[].-Pathtreats those as wildcard character classes and silently matches nothing.~works in PowerShell paths;$env:USERPROFILEis the explicit form.- Non-ASCII in paths: pass through the call operator, don't pipe.
6. Native exes and output capture
- Exe stdout is captured fine, but stderr interleaving is not ordered — don't assume error lines come last.
- Exes that spawn children (npm, npx, cargo) can leave the pipe open; long
builds may hit the tool timeout. Pass the
timeoutparameter rather than wrapping inStart-Job. - Exit-code check after a build/install is worth it:
npx tsc --noEmit; if ($LASTEXITCODE -ne 0) { "typecheck failed" } Write-Host/Write-Outputfor messaging: just emit plain text as your response instead of echoing from the shell.
7. Useful one-liners
git status --short; if ($?) { git diff --stat }
python -c "import sys; print(sys.version)"
rg -n --stats "pattern" -g '*.ts'
Get-Command node | Select-Object -ExpandProperty Source
node -v; npm -v; python --version8. Environment — detect, do not assume
- Working dir is passed with the tool's
workdirparameter — nevercdorSet-Locationinside a command. - Never hardcode machine-specific values (tool paths, home directories, console codepage, git status of a directory). Detect them, or read them from a local file that is not part of any shared config.
- Do not assume git commands work anywhere. Check first:
git rev-parse --show-toplevel - Prefer
Get-Command <tool>over a remembered path when you need the binary:(Get-Command node).Source - PowerShell 7 features (
&&,??, ternary) are unavailable in 5.1. Either invokepwsh -NoProfile -Command "..."or write 5.1-compatible syntax. - Log timestamps are usually UTC;
Get-Dateis local. Anything RFC3339 with a trailingZis UTC, and this machine is UTC+5. Comparing them directly is a 5-hour skew, so a filter for "recent" events silently accepts or rejects the wrong rows — it reports clean while ignoring what just happened, or reports fresh failures that are hours old. Convert both sides:
or filter on a file timestamp ((Get-Date).ToUniversalTime()(Get-Item $log).LastWriteTime) instead. - Grepping a log for a term you just typed matches your own search. The
agent's commands are recorded in the same log it is reading, so a substring
search for
"Out of memory"also matches theSelect-Stringthat searched for it, and every repetition adds another. Count only lines carrying the record shape you care about (e.g.diffStderr=), and treat a hit count that grows while you are searching as self-contamination, not as new events.
If a workflow needs machine-specific facts, keep them in a machine-local file that is excluded from version control, not baked into a shared skill.
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.

