powershell-refactor

powershell-refactor is a skill for Claude Code, Codex from mickpletcher/AI-Skills. It costs 33 tokens per session (1,138 once invoked), scanned A, original, MIT.

A refactoring aid for existing PowerShell scripts. PowerShell is a command-line shell and scripting language commonly used for automating Windows and system tasks.

In plain words
What is it for?
Use it to restructure and tighten existing PowerShell scripts without changing what they are meant to do.
Why use it?
It helps simplify script flow, remove repeated code, and make naming and structure more consistent while preserving the intended result.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to restructure and tighten existing PowerShell scripts without changing what they are meant to do.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mickpletcher/ai-skills/powershell-refactor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mickpletcher/AI-Skills --skill powershell-refactor
Clone the repo
git clone --depth 1 https://github.com/mickpletcher/AI-Skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for powershell-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/mickpletcher/ai-skills/powershell-refactor/github.svg)](https://agentmods.dev/skills/mickpletcher/ai-skills/powershell-refactor)
Your own site
<a href="https://agentmods.dev/skills/mickpletcher/ai-skills/powershell-refactor"><img src="https://agentmods.dev/badge/skills/mickpletcher/ai-skills/powershell-refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for powershell-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/mickpletcher/ai-skills/powershell-refactor"><img src="https://agentmods.dev/badge/skills/mickpletcher/ai-skills/powershell-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,138 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.01138
Opus 5.5 $0.00013 $0.00455
Sonnet 5.5 $0.00007 $0.00228
Haiku 4.5 $0.00003 $0.00114

Measured 1mo ago against content hash 0fe54f6fd120, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

powershell-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

claude/skills/powershell-refactor/SKILL.md · 122 lines

How it starts

The opening of the file, as written. The whole thing — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 logic when it adds value
    • try and catch only where they improve control and diagnostics
    • Write-Verbose, Write-Warning, and structured output instead of ad hoc console noise
  5. Keep function boundaries practical. Split code only when it improves readability or reuse in a clear way.
  6. Recheck for behavior drift, naming consistency, and obvious lint or test issues before finishing.

Scope Presets

Let the user control how aggressive the pass is. Default to full cleanup when no preset is named:

Read the full file on GitHub · 122 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 122 lines · 33 tokens per session scan A 0fe54f6fd120

Subscribe to this mod's changes

powershell-refactor is a skill published in the GitHub repository mickpletcher/AI-Skills (20 stars, last pushed 2d ago), licensed MIT. It adds 33 tokens to every session and 1,138 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

godot-code-review

Use when reviewing GDScript or C# Godot code — checklist of best practices, common anti-patterns, and Godot-specific pitfalls. Triggers on "review this script", "check my code", "any issues with this", "what's wrong with this code", including a short pasted snippet.

jame581/GodotPrompter · 67 tokens

code-review-checklist

Genera un checklist de revisión de código personalizado para cualquier pull request basado en el lenguaje, tipo de cambio y nivel de riesgo. Úsalo cuando te pidan revisar código, verificar un PR, revisar un pull request o generar un checklist de revisión de código. Produce un checklist enfocado con verificaciones…

mohitagw15856/pm-claude-skills · 88 tokens

pr-description-writer

Redacta una descripción de pull request clara y estructurada a partir de un diff de git, resumen de rama o lista de commits. Úsalo cuando te pidan escribir una descripción de PR, redactar una solicitud de cambios o documentar cambios de código. Produce una descripción con resumen, motivación, cambios realizados, pasos…

mohitagw15856/pm-claude-skills · 80 tokens

pr-review-toolkit

Review pull requests and recent code changes across specialized lenses: general code quality, tests, error handling and silent failures, comments and docs, type design, and simplification. Use when the user asks to review a PR, review recent changes, check tests, check error handling, check comments, analyze types…

neuromechanist/research-skills · 89 tokens

neo-code-review

Use this skill when the user asks to review or audit source code, a PR, diff, commit, or recent changes for bugs, security, performance, tests, compatibility, or maintainability, duplicated code or logic across files, or hard-coded values. Also use it after an AI agent finishes modifying code to inspect the current…

Benknightdark/neo-skills · 87 tokens

neo-pr

Use this skill when the user asks to create, draft, review, format, or generate a Pull Request (PR) title and description, specify target or source branches for a repository, or convert git branch diffs into concise, high-impact, non-AI-slop PR content.

Benknightdark/neo-skills · 60 tokens