← ClaudeAtlas

powershell-style-guidelisted

Review and write PowerShell code following community style guide and best practices (based on PoshCode/PowerShellPracticeAndStyle). Use when writing new PowerShell scripts, functions, or modules (.ps1, .psm1, .psd1), reviewing PowerShell code for style compliance, refactoring PowerShell code, or any task involving PowerShell scripting where code quality matters.
chenwei791129/agent-skills · ★ 0 · Code & Development · score 56
Install: claude install-skill chenwei791129/agent-skills
# PowerShell Style Guide Apply the [PoshCode PowerShell Practice and Style Guide](https://github.com/PoshCode/PowerShellPracticeAndStyle) when writing or reviewing PowerShell code. ## Quick Reference - Essential Rules ### Formatting - **OTBS braces**: opening `{` on same line, closing `}` on own line - **4-space indentation** (spaces, not tabs) - **115 char line limit** - use splatting to break long commands - **No trailing whitespace**, no semicolons as line terminators - **Two blank lines** around function/class definitions - **Single space** around operators and after commas ### Naming - **PascalCase** everything public: functions, parameters, variables, modules - **Verb-Noun** for functions (approved verbs from `Get-Verb`) - **Singular nouns** only - **Full names** always: `Get-Process -Name Explorer` not `gps Explorer` - **lowercase** for keywords (`if`, `foreach`) and operators (`-eq`, `-gt`) ### Function Structure ```powershell function Get-Example { <# .SYNOPSIS Brief description. .EXAMPLE Get-Example -Name "Test" Demonstrates basic usage. #> [CmdletBinding()] [OutputType([string])] param( # The name to look up [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [string]$Name ) process { # Return objects directly, no 'return' keyword "Hello, $Name" } } ``` ### Key Patterns - Always use `[CmdletBinding()]` - Always ad