powershell-windows

Enforce best-practice Windows PowerShell patterns for ASCII-only scripts and error handling.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/AnvinX1/med-rag --skill powershell-windows-anvinx1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: powershell-windows
Source: https://github.com/AnvinX1/med-rag/tree/main/medical_genai_app/.agent/skills/powershell-windows
Command: npx skills add https://github.com/AnvinX1/med-rag --skill powershell-windows-anvinx1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill codifies best-practice Windows PowerShell patterns to reduce common scripting errors and improve reliability on Windows.

Core Features & Use Cases

  • Enforces correct operator syntax by requiring parentheses around cmdlet calls when using logical operators.
  • Prohibits Unicode in scripts and promotes ASCII-only PowerShell code for widest compatibility.
  • Provides null-check guidance to prevent null reference errors before accessing properties.
  • Demonstrates robust string interpolation patterns to avoid runtime errors.
  • Covers error handling with Try/Catch blocks and appropriate $ErrorActionPreference usage.
  • Recommends cross-platform path handling with Join-Path for safer file paths.
  • Advises safe JSON operations with ConvertTo-Json -Depth and proper read/write patterns.
  • Documents common errors and practical fixes to accelerate debugging.

Quick Start

Apply these Windows PowerShell patterns to write robust, ASCII-safe scripts on Windows.

Frequently Asked Questions about powershell-windows

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

FAQPage Schema
How do I fix PowerShell scripting errors when using logical operators with cmdlet calls?

Fix PowerShell scripting errors by wrapping cmdlet calls in parentheses before applying logical operators. This best-practice pattern ensures correct operator syntax evaluation and prevents unexpected runtime failures during Windows automation tasks.

What is the best way to handle null reference errors in Windows PowerShell scripts?

The best way to handle null reference errors in Windows PowerShell is by performing null checks before accessing properties. This proactive validation pattern prevents script termination and ensures robust automation workflow execution.

How do I safely process JSON files in PowerShell without losing nested data?

Safely process JSON files in PowerShell by using ConvertTo-Json with the -Depth parameter. Applying proper read and write patterns ensures complete serialization of nested objects and prevents data truncation during automation.

Does my PowerShell script need to be ASCII-only for cross-version compatibility?

Yes, your PowerShell script should be ASCII-only for cross-version compatibility. Prohibiting Unicode characters in scripts promotes the widest compatibility across different Windows environments and prevents encoding-related execution failures.

Why does string interpolation cause runtime errors in PowerShell and how do I prevent it?

String interpolation causes runtime errors in PowerShell due to improper variable embedding. Prevent these errors by applying robust interpolation patterns that safely expand variables within strings, ensuring reliable script execution.

How do I manage file paths in PowerShell scripts to avoid cross-platform errors?

Manage file paths in PowerShell scripts by using Join-Path for cross-platform path handling. This approach constructs safer file paths dynamically, preventing directory separator issues and ensuring reliable file system access.