with one click
pwsh
// PowerShell rules: paths as data, Join-Path over concatenation, avoid Invoke-Expression, check LASTEXITCODE.
// PowerShell rules: paths as data, Join-Path over concatenation, avoid Invoke-Expression, check LASTEXITCODE.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | pwsh |
| description | PowerShell rules: paths as data, Join-Path over concatenation, avoid Invoke-Expression, check LASTEXITCODE. |
Use this rule when:
.ps1 scriptsTreat paths and native command arguments as structured data, not interpolated shell text.
Get-Content, Set-Content, Add-Content, Out-File, or redirection operators for local file processing. Use fs-mcp first; use bun, bun -e, bun repl, Bun.file(), and Bun.write() only when fs-mcp cannot reasonably achieve the goal.for loops. Use ForEach-Object, the foreach statement over a collection, or pipeline iteration.Join-Path, Split-Path, and explicit path helpers over manual string concatenation.& and separated arguments over a single large command string.Invoke-Expression.$LASTEXITCODE after native commands when relevant.When a script uses numbered top-level sections separated by ruler lines:
& { ... } blocks.$global: variables for state shared across numbered setup sections and between class methods.$global:-based initialization blocks.Strong rule: do not split scripts, functions, methods, or code blocks into overly fine-grained pieces. Keep related statements together as one cohesive chunk unless extraction has a current, concrete reason.
Extract a function only when one of the following is true:
Otherwise, keep the logic inline. A single well-named function with many readable lines is better than many tiny helpers connected only by call chains.
fs-mcp first.Bun.file(path).text(), Bun.file(path).bytes(), Bun.write(path, content), bun -e, or bun repl only when fs-mcp is unavailable, insufficient, or materially less reliable for the goal.bun or native tools and to pass paths and arguments as structured data.bun is unavailable or incompatible, state the fallback reason before using another runtime or API.=, -eq, -ne, -gt, -ge, -lt, -le, +, -, *, /, %, -and, -or, etc.).= or any operator across adjacent lines.else, elseif, catch, and finally — they always start on a new line after the closing brace. Never write } else {, } elseif (...) {, } catch {, or } finally {.& { on the line immediately after the bottom ruler.{ } braces for if, else, elseif, foreach, for, and while bodies — even when the body is a single statement. Never write braceless single-line forms.references/EXAMPLE.md → Early Return.& { ... } wrapping, shared $global: state visibility)