powershell-refactor — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited powershell-refactor (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
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.
try and catch only where they improve control and diagnosticsWrite-Verbose, Write-Warning, and structured output instead of ad hoc console noiseLet the user control how aggressive the pass is. Default to full cleanup when no preset is named:
naming only: rename functions to approved verbs, standardize parameter and variable casing, touch nothing elsededuplication only: collapse repeated logic into shared functions or loops, keep all names and structure otherwisefull cleanup: the complete workflow aboveWhen the user names a preset, stay inside it even when other cleanup targets are visible; list the out-of-scope findings at the end instead of fixing them.
Run Invoke-ScriptAnalyzer on the script before and after when it is available, honoring any PSScriptAnalyzerSettings.psd1 in the repo. Fix the violations that fall inside the chosen scope preset, and list any remaining ones with a one-line reason they were left, such as a deliberate Write-Host for interactive output. The refactor should never introduce new violations.
End every refactor with a before-and-after summary so the user can review the pass at a glance:
Refactor Summary
- Behavior preserved: [yes / exceptions explicitly listed]
- Lines: [before] -> [after]
- Changes:
- [each behavior-preserving change in one line, e.g. "merged 3 duplicate retry blocks into Invoke-WithRetry"]
- Analyzer: [violations fixed] fixed, [count] remaining (listed above)
- Out of scope findings: [anything noticed but not touched]ShouldProcess, confirmation, or validationshared/skill-standard.mdshared/naming-conventions.mdUse this skill when the user already has a PowerShell script and wants it cleaned up, simplified, or standardized.
Minimum useful input:
.ps1 or .psm1 file to refactorExample prompts:
Refactor this PowerShell script to reduce duplication and make the error handling cleaner, but keep the same output and parameters.Tighten this Intune reporting script. Keep it as one file. Rename functions to approved verbs and remove unnecessary abstraction.Clean up this PowerShell module and standardize the parameter blocks without changing how the commands behave.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.