← ClaudeAtlas

writing-powershelllisted

House style, scaffolds, patterns, and a bundled style checker for high-quality PowerShell. Use whenever the answer will contain PowerShell or the input is PowerShell, even if the user never says PowerShell: writing, debugging, reviewing, or refactoring functions, scripts, one-liners, modules, Pester tests, or .ps1/.psm1/.psd1 files and diffs; pasted PowerShell errors; Windows and M365 admin jobs where PowerShell is the natural tool - Active Directory queries and CSV reports, Intune detection/remediation scripts, autounattend and first-logon setup, logon scripts, registry, scheduled tasks, Azure Automation runbooks, Microsoft Graph, Entra ID, Exchange Online, and Az. Covers Verb-Noun naming, OTBS braces, CmdletBinding, ShouldProcess, single-quote/-f strings, $null = instead of Out-Null, PascalCase variables, structured output, Graph paging, and 5.1 compatibility. Also use when pwsh, PSScriptAnalyzer, or Pester must be installed before code can be validated. Not for bash, Python, Terraform, Bicep, or KQL.
woznet/wozdev · ★ 0 · Data & Documents · score 72
Install: claude install-skill woznet/wozdev
# Writing PowerShell Author PowerShell that is idiomatic, safe, and consistent with an approved style, then prove it with the bundled checker. **Core rule:** `[CmdletBinding()]` functions, single-quoted `-f` strings, OTBS braces, `try/catch`, structured object output. Never `Write-Host`, `Out-Null`, backtick continuation, `New-Object`, aliases, doubled single quotes, or raw-string returns. ## Choosing a Template Two scaffolds cover the common cases. Default to **quick**; promote to **full** only when a real need appears. | Use **full** when… | Use **quick/helper** when… | |---|---| | Takes pipeline input | Small, single-purpose helper | | Destructive/stateful action needing `-WhatIf`/`-Confirm` | No destructive side effects | | Needs `begin`/`end` for shared setup or teardown | Thin wrapper over one or two calls | | Public/exported module command | Internal helper | A standalone `.ps1` script follows the same rules at file level: help block, `[CmdletBinding()]` and `param()` at the top, `#Requires` for modules it needs. See `references/patterns.md`. ## Quick Reference | Topic | Do | Don't | |-------|----|-------| | Strings | `('{0} -> {1}' -f $a, $b)`, single quotes | `"$a -> $b"`, double-quote interpolation | | Quotes inside strings | embed double quotes: `('name "{0}"' -f $A)` | doubled single quotes: `('name ''{0}''' -f $A)` | | Discarding output | `$null = $List.Add($x)` or `[void]$List.Add($x)` | `$List.Add($x) \| Out-Null` | | Functions | `[CmdletBinding()]` + t