powershell-patterns

Provide idiomatic PowerShell patterns for robust, cross-platform scripts and modules.

1|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/flatrick/mdt --skill powershell-patterns-flatrick
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: powershell-patterns
Source: https://github.com/flatrick/mdt/tree/main/skills/powershell-patterns
Command: npx skills add https://github.com/flatrick/mdt --skill powershell-patterns-flatrick

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidance on writing robust, maintainable, and cross-platform PowerShell scripts and modules, helping developers avoid common pitfalls and adopt idiomatic patterns.

Core Features & Use Cases

  • Idiomatic PowerShell: Learn to use CmdletBinding, approved verbs, and proper parameter handling.
  • Error Handling & Security: Implement effective try/catch blocks and secure credential management.
  • Cross-Platform Scripting: Write scripts that function seamlessly on Windows, macOS, and Linux.
  • Module Design: Understand the structure and best practices for organizing PowerShell modules.

Quick Start

Review the provided PowerShell code examples for best practices in error handling and parameter validation.

Frequently Asked Questions about powershell-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle errors in PowerShell scripts using try/catch blocks?

PowerShell scripts handle errors effectively by implementing try/catch blocks for exception management. Combining this with CmdletBinding and secure credential management ensures robust, maintainable, and cross-platform module development.

What are the best practices for cross-platform PowerShell scripting on Windows, macOS, and Linux?

Cross-platform PowerShell scripting best practices involve writing scripts that function seamlessly across Windows, macOS, and Linux. Using modern PowerShell 7+ development patterns ensures robust compatibility and maintainable module execution across different operating systems.

How do I structure a PowerShell module with approved verbs and CmdletBinding?

Structuring a PowerShell module requires using CmdletBinding, approved verbs, and proper parameter handling. Following these idiomatic patterns ensures your module remains maintainable and aligns with modern PowerShell 5.1 and PowerShell 7+ development standards.

Does PowerShell 7 support secure credential management and pipeline design?

PowerShell 7 supports secure credential management and pipeline design through idiomatic patterns. Implementing proper output streams and parameter validation allows you to build robust, maintainable scripts that function seamlessly across different platforms.

What is the best way to write comment-based help and manage output streams in PowerShell?

The best way to manage output streams and write comment-based help in PowerShell is to follow idiomatic module structure patterns. This approach ensures your scripts remain maintainable and provide robust documentation for cross-platform automation tasks.