A Claude Code skill that packages a prescriptive PowerShell house standard — style, formatting, and best practices — so Claude applies it automatically any time it writes, reviews, or refactors PowerShell.
skills/powershell-style-practice/
├── SKILL.md # Core rules + trigger conditions, loaded for every PowerShell task
└── reference/ # One condensed chapter per topic, loaded only as needed
├── Code-Layout-and-Formatting.md
├── Documentation-and-Comments.md
├── Building-Reusable-Tools.md
├── Error-Handling.md
├── Flow-Control.md
├── Function-Structure.md
├── Language-Interop-and-.NET.md
├── Module-Writing.md
├── Naming-Conventions.md
├── Output-and-Formatting.md
├── Parameters-And-Parameter-Blocks.md
├── Performance.md
├── Security.md
└── Working-With-Data.md
This skill turns a loose style guide into a rule set Claude actually follows. It triggers any
time PowerShell is in play — a new function, script, or module; a snippet in a fenced code
block; an existing .ps1/.psm1/.psd1 file being edited; or a request to follow "PowerShell
best practices" or "our PowerShell standards."
Rather than loading every rule for every task, SKILL.md gives Claude a set of core rules
that apply to essentially all PowerShell, then points to reference/ for anything more
specific — parameter design, error handling, performance, module packaging, and so on. Claude
loads only the reference chapters a given task actually touches.
- Structure —
[CmdletBinding()]on every function, blocks in execution order,Verb-Nounnaming with approved verbs, noreturnkeyword, no aliases or relative paths. - Formatting — One True Brace Style, 4-space indentation, 115-character line limit, PascalCase for public identifiers.
- Documentation — Comment-based help (
.SYNOPSIS,.EXAMPLE) on every function. - Error handling —
-ErrorAction Stopinsidetry/catch, specific exception types,$PSCmdlet.ThrowTerminatingError()overthrowin advanced functions. - Data & output —
[PSCustomObject]overNew-Object,$nullon the left of comparisons, never+=on an array or string inside a loop. - Parameters & safety —
SupportsShouldProcess+$PSCmdlet.ShouldProcess()for state-changing commands,[PSCredential]for credentials. - Modules — reusable code lives in a module, manifests export explicit lists, never
'*'.
See skills/powershell-style-practice/SKILL.md for
the full rule set and the reference file index.
With Claude Code: copy or symlink skills/powershell-style-practice/ into a project's
.claude/skills/ directory (or a personal ~/.claude/skills/ directory to make it available
everywhere), and Claude will pick it up automatically when PowerShell work comes up.
As a standalone reference: the reference/ files are plain Markdown and readable on their
own if you just want a condensed PowerShell style guide, independent of any tooling.
This skill adapts content from The PowerShell Best Practices and Style Guide, licensed CC BY-SA 4.0, with attribution to Don Jones, Matt Penny, Carlos Perez, Joel Bennett, and the PowerShell community. It's further derived from the "house-standard-rewrite" branch of themodulecollective/PowerShellPracticeAndStyle.
See LICENSE.md for full license text and credits.