Skip to content

PowerShell standards#

These standards apply to all PowerShell files across PSModule repositories. They implement the engineering principles defined in Principles — specifically Clean Code, Make change easy, Shift Left, and Build for the modern engineer.

Each standard states the practice, why it matters to us, and how to apply it.

Topic What it covers
Code Layout Braces, indentation, line length, semicolons, regions
Naming Functions, commands, parameters, variables, constants, paths
Function Structure CmdletBinding, pipeline design, script structure
Documentation Comment-based help, inline comments
Readability Strings, operators, splatting, collections
Control Flow If/else, loops, switch
Output and Errors Streams, output suppression, error handling
Performance Collections, filtering, method syntax
Testing Pester structure and conventions
Security Credentials, input validation, ShouldProcess