powershell-refactorlisted
Install: claude install-skill mickpletcher/AI-Skills
# PowerShell Refactor Skill
## Intent
Use this skill to improve an existing PowerShell script that already works or mostly works but needs cleanup. The goal is to make the code smaller, clearer, more idiomatic, and easier to maintain without introducing unnecessary abstractions or changing the script's job.
## Use When
- A PowerShell script feels repetitive, bloated, inconsistent, or hard to follow
- Function names, parameter names, or output patterns need to be standardized
- The user wants a script simplified, tightened, cleaned up, or refactored
- The script should be aligned with practical PowerShell conventions for real admin automation
## Do Not Use When
- The main task is to create a brand new script from scratch
- The request is mostly about documentation, README writing, or tutorial content
- The user wants a major architecture redesign instead of a focused refactor
- The script's expected behavior is unclear and changing it would be risky
## Workflow
1. Read the existing script first and identify the real behavior that must stay intact.
2. Find the highest value cleanup targets:
- duplicated logic
- dead code
- inconsistent naming
- unclear control flow
- noisy error handling
- unnecessary wrappers or abstractions
3. Refactor in place with the smallest set of edits that materially improves the script.
4. Prefer native PowerShell patterns:
- approved verbs
- clear parameter blocks
- pipeline-aware l