Habilidades powershell-windows
📦

powershell-windows

Seguro ⚙️ Comandos externos

Master PowerShell Windows Scripting Patterns

Avoid common PowerShell pitfalls that cause script failures. Learn proper operator syntax, error handling, and Windows-specific patterns for reliable automation.

Suporta: Claude Codex Code(CC)
🥉 74 Bronze
1

Baixar o ZIP da skill

2

Upload no Claude

Vá em Configurações → Capacidades → Skills → Upload skill

3

Ative e comece a usar

Testar

A utilizar "powershell-windows". Check if file exists or directory exists

Resultado esperado:

Use: if ((Test-Path "file.txt") -or (Test-Path "folder")) - Each cmdlet must be wrapped in parentheses when using logical operators

A utilizar "powershell-windows". Safely get array length

Resultado esperado:

Use: if ($array -and $array.Count -gt 0) - Always verify the array exists before accessing properties

A utilizar "powershell-windows". Convert nested object to JSON

Resultado esperado:

Use: $data | ConvertTo-Json -Depth 10 - Always specify depth parameter for nested objects to avoid truncation

Auditoria de Segurança

Seguro
v1 • 2/24/2026

Static analysis detected 34 patterns but all are false positives. The SKILL.md file is documentation only, containing PowerShell syntax examples and best practices. No executable code or security risks present. The skill is a reference guide for proper PowerShell scripting patterns on Windows.

1
Arquivos analisados
173
Linhas analisadas
1
achados
1
Total de auditorias
Auditado por: claude

Pontuação de qualidade

38
Arquitetura
100
Manutenibilidade
85
Conteúdo
50
Comunidade
100
Segurança
91
Conformidade com especificações

O Que Você Pode Construir

DevOps Engineer Scripting

Create reliable Windows automation scripts with proper error handling and null safety for CI/CD pipelines

System Administrator Reference

Quick reference for PowerShell syntax rules and common pitfalls when maintaining legacy scripts

Developer Learning Resource

Learn PowerShell best practices and avoid common mistakes when adding Windows scripting to your toolkit

Tente Estes Prompts

Basic Syntax Question
What is the correct PowerShell syntax for checking if a file exists OR another condition is true?
Error Handling Pattern
Show me the proper try-catch-finally pattern for PowerShell scripts that need to clean up resources
Null Safety Check
How do I safely check if an array has items before accessing its Count property in PowerShell?
JSON File Operations
What is the correct way to read and write JSON files in PowerShell with nested objects?

Melhores Práticas

  • Wrap each cmdlet in parentheses when using logical operators like -or and -and
  • Always check for null before accessing object properties or methods
  • Use Join-Path for building file paths instead of string concatenation
  • Set ErrorActionPreference appropriately for your environment (Stop for dev, Continue for production)
  • Specify -Depth parameter when converting nested objects to JSON

Evitar

  • Using unicode or emoji characters in PowerShell scripts - use ASCII markers like [OK] instead
  • Accessing properties without null checks - will cause runtime errors on null values
  • Using ConvertTo-Json without -Depth parameter - nested objects will be truncated
  • Placing return statements inside try blocks - use finally for cleanup and return after

Perguntas Frequentes

Why do PowerShell logical operators require extra parentheses?
PowerShell parses cmdlets and operators differently than other languages. Each cmdlet call must be wrapped in parentheses so the parser correctly identifies where each command ends before applying the logical operator.
What is the safest way to handle file paths in PowerShell?
Use Join-Path instead of string concatenation. This handles path separators correctly across different Windows versions and avoids issues with trailing backslashes.
Why should I avoid unicode characters in PowerShell scripts?
Unicode characters can cause parsing errors on systems with different encodings. Using ASCII markers like [OK], [WARN], or [ERROR] ensures compatibility across all Windows environments.
What ErrorActionPreference should I use in production?
Use 'Continue' in production to allow scripts to handle errors gracefully. Use 'Stop' during development to catch issues early. Use 'SilentlyContinue' when errors are expected and handled.
How do I properly convert nested objects to JSON?
Always specify the -Depth parameter with ConvertTo-Json. The default depth is 2, which truncates nested objects. Use -Depth 10 or higher for deeply nested structures.
What is the correct pattern for null-safe array access?
Check both the array and its count: if ($array -and $array.Count -gt 0). This prevents errors when the array is null or undefined before accessing the Count property.

Detalhes do Desenvolvedor

Estrutura de arquivos

📄 SKILL.md