powershell-windows

Enforce safe patterns in Windows PowerShell scripts for automation.

132|22|Updated Dec 18, 2025
One-click install
npx skills add https://github.com/xenitV1/Antigravity-Workflows --skill powershell-windows
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: powershell-windows
Source: https://github.com/xenitV1/Antigravity-Workflows/tree/main/skills/powershell-windows
Command: npx skills add https://github.com/xenitV1/Antigravity-Workflows --skill powershell-windows

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves common Windows PowerShell scripting pitfalls by enforcing safe patterns.

Core Features & Use Cases

  • Enforces parentheses around cmdlet calls when using logical operators to avoid precedence errors.
  • Encourages ASCII-only scripts to ensure portability across environments.
  • Includes robust null checks and safe string handling practices.
  • Promotes proper error handling with Try/Catch and cleanup patterns.
  • Recommends safe file and path operations using Join-Path for cross-platform safety.
  • Advises on JSON data handling with explicit -Depth when parsing nested objects.

Quick Start

Use this skill to audit and improve a Windows PowerShell script by applying the described rules: enforce parentheses around logical expressions, replace non-ASCII characters with ASCII, add null checks, use Join-Path for all paths, wrap risky operations in Try/Catch, and specify -Depth for JSON parsing.

Frequently Asked Questions about powershell-windows

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

FAQPage Schema
How do I handle errors safely in Windows PowerShell scripts?

Error handling in PowerShell requires wrapping risky operations in Try/Catch blocks with cleanup patterns. This skill enforces proper error management to prevent script failures during system administration and automation tasks, ensuring scripts fail gracefully and predictably.

Why should I use Join-Path for file operations in PowerShell?

Join-Path safely constructs file paths across different environments and prevents path concatenation errors. This skill recommends Join-Path for all file and path operations to ensure cross-platform compatibility and reliable path handling in automation scripts.

What PowerShell scripting patterns prevent null reference errors?

Null checks validate that variables contain data before processing them, preventing crashes and unexpected behavior. This skill enforces explicit null checks and safe string handling to make PowerShell scripts more robust and maintainable.

How do I avoid operator precedence bugs with logical expressions in PowerShell?

Parentheses around cmdlet calls using logical operators clarify precedence and prevent evaluation errors. This skill enforces explicit parentheses to ensure complex conditions evaluate as intended.

Why does my PowerShell JSON parsing fail with nested objects?

JSON depth must be explicitly specified when parsing nested data structures. This skill advises using the -Depth parameter to handle complex JSON objects correctly and avoid data truncation during parsing.

Does ASCII-only content matter for PowerShell script portability?

ASCII-only scripts ensure compatibility across diverse Windows environments and prevent encoding issues. This skill encourages ASCII-only content to guarantee portability and reduce environment-specific failures.