powershell-windows

Enforce PowerShell scripting best practices for syntax and runtime reliability.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/darthlinuxer/dialectic-crew-ai --skill powershell-windows-darthlinuxer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: powershell-windows
Source: https://github.com/darthlinuxer/dialectic-crew-ai/tree/main/src/mcp/skills/powershell-windows
Command: npx skills add https://github.com/darthlinuxer/dialectic-crew-ai --skill powershell-windows-darthlinuxer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill surfaces and enforces critical Windows PowerShell patterns to prevent common syntax errors, runtime failures, and fragile automation caused by improper operator grouping, unicode usage, null handling, and JSON/path mishandling.

Core Features & Use Cases

  • Operator and grouping rules: Mandates parentheses around cmdlet calls when using logical operators to avoid unexpected token and parameter parsing errors.
  • Safety and robustness: Advises ASCII-only scripts, explicit null checks, and consistent try/catch/finally with ErrorActionPreference guidance to improve script reliability in production and CI pipelines.
  • Data and path handling: Recommends Join-Path for paths, ConvertTo-Json with explicit -Depth for nested objects, and safe array manipulation patterns for automation and configuration tasks.

Quick Start

Ask the assistant to review a PowerShell script and list violations of parentheses usage, unicode characters, null-checks, JSON depth, and path handling.

Frequently Asked Questions about powershell-windows

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

FAQPage Schema
Why does my PowerShell script fail with unexpected token errors when using logical operators?

PowerShell script failures with logical operators often occur because cmdlet expressions lack proper grouping. Wrapping cmdlet calls in parentheses enforces correct parameter parsing and prevents unexpected token syntax errors during execution.

How do I prevent ConvertTo-Json from truncating nested objects in PowerShell?

To prevent ConvertTo-Json from truncating nested objects in PowerShell, specify an explicit -Depth parameter. Setting the serialization depth ensures complete JSON output for complex nested configuration objects and automation data structures.

What is the best way to handle file paths in PowerShell automation scripts?

The best way to handle file paths in PowerShell automation scripts is using Join-Path. This cmdlet constructs valid paths safely, prevents path-handling runtime errors, and ensures robust script execution across different Windows environments.

Does my PowerShell script need explicit null checks to avoid runtime errors?

Yes, PowerShell scripts need explicit null checks to avoid runtime errors. Verifying variables for null before access prevents null-reference exceptions and improves script reliability in production automation and CI validation pipelines.

How do I configure error handling for Windows PowerShell CI pipelines?

Configure error handling for Windows PowerShell CI pipelines by implementing consistent try/catch/finally blocks and setting ErrorActionPreference. This approach catches runtime failures early and ensures proper resource cleanup during script execution.

Can I use unicode characters in PowerShell scripts without causing syntax issues?

Using unicode characters in PowerShell scripts can cause syntax issues and encoding failures. Maintaining ASCII-only scripts prevents encoding-related parsing errors and ensures maximum compatibility across Windows PowerShell environments and text editors.