Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

PowerShell Style Practice

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.

What's in this repo

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

The skill: powershell-style-practice

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.

Core rules at a glance

  • Structure[CmdletBinding()] on every function, blocks in execution order, Verb-Noun naming with approved verbs, no return keyword, 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 Stop inside try/catch, specific exception types, $PSCmdlet.ThrowTerminatingError() over throw in advanced functions.
  • Data & output[PSCustomObject] over New-Object, $null on the left of comparisons, never += on an array or string inside a loop.
  • Parameters & safetySupportsShouldProcess + $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.

Using this skill

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.

Attribution & license

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.

About

An opinionated PowerShell Style and Best Practices Skill for Agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors