Skip to content

prabhatp75/windows-optimize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

windows-optimize

A safe, reversible Windows performance optimization skill for Claude Code.

Diagnose why a Windows laptop is slow and apply targeted fixes — with explicit consent at every step, full rollback support, and zero risk to user data or corporate security posture.


⚠️ Disclaimer — read before using

This is a personal project shared in the author's individual capacity. It is not affiliated with, endorsed by, or supported by the author's employer or any other organization.

By using this software you agree that:

  • You use it entirely at your own risk and in your personal capacity.
  • You will read and verify every script and every change before running it. The scripts are short and intentionally auditable — that is the whole point.
  • You are solely responsible for any consequences, including but not limited to system instability, data loss, lost productivity, policy violations on managed devices, or any other direct or indirect damage.
  • If you run this on a corporate, managed, or otherwise non-personal device, it is your responsibility to confirm it is permitted under the applicable IT, security, and compliance policies. The author assumes no responsibility for policy violations.
  • The author provides no warranty of any kind and shall not be liable for any damages or claims arising from use, misuse, or inability to use this software.

If you do not agree to these terms, do not use this software. See LICENSE for the full legal text.


Why this exists

High-end Windows laptops in corporate environments routinely feel sluggish despite excellent hardware. The actual causes are almost never what people think:

  • Power plans default to Balanced, capping CPU clocks well below max turbo
  • Browser sprawl: 100+ Chrome / Edge / WebView2 processes burning 10+ GB of RAM
  • Defender and EDR agents scanning every dev-tool file operation
  • Startup bloat accumulated from years of printer, scanner, and vendor-utility installs
  • Temp folders quietly growing into multiple GB

Generic "PC cleaner" tools either don't help or actively cause damage by deleting things they shouldn't. This skill takes a surgical, admin-quality approach instead — designed by someone who has had to recover machines from those cleaners.


What it does

Three phases, all driven by Claude Code:

  1. Diagnose (read-only) — hardware specs, live CPU sample, power plan and throttle state, startup items across all registry hives, auto-start services, disk-space breakdown, browser process sprawl, recent system errors. Surfaces the actual root causes.
  2. Report — ranked findings with explicit cause attribution, grouped by safety:
    • Group A — safe, reversible, applies in-session
    • Group B — needs admin (a tailored script is generated for you to run elevated)
    • Group C — requires user judgment, behavior change, or IT ticket
  3. Apply (only on explicit consent) — parameterized fixes, with every change written to a rollback log. Nothing happens without you saying yes.

Safety guarantees

This is the part that matters.

  • Reversible by default. Startup items are disabled via the StartupApproved registry key — the exact method Task Manager uses. Original Run entries are never deleted. Service changes use Set-Service -StartupType Manual, never Remove-Service. Temp and cache cleanup uses age filters, not blind wipes.
  • Never deletes user data. Documents, Recycle Bin contents, browser session data (cookies / history / passwords), WinSxS, AppData\Local\Packages — all untouched.
  • Respects corporate security stacks. Recognizes and leaves alone: Microsoft Defender, Defender for Endpoint, Purview DLP, Illumio VEN, Global Secure Access, Intune, SCCM, WSAIFabricSvc, and similar agents. For Defender CPU caused by dev workloads, the skill recommends an IT ticket for process / path exclusions — it does not try to bypass anything.
  • Full rollback log. Every change goes into %LOCALAPPDATA%\windows-optimize\rollback.json. A single command undoes everything.
  • No self-elevation. If a change needs admin, the skill generates a script for you to run elevated. It does not try to escalate from the user session.

Quick start

Install

Clone into your Claude Code user skills directory:

git clone https://github.com/<your-username>/windows-optimize "$env:USERPROFILE\.claude\skills\windows-optimize"

Invoke from Claude Code

In any Claude Code session, either of these triggers the skill:

  • /windows-optimize
  • "my laptop is slow, can you check it"

Claude will run the diagnostic, produce a ranked findings report, and ask which fixes to apply.

Run the scripts directly (no Claude required)

# 1. Diagnose only (read-only; safe to run anytime)
& "$env:USERPROFILE\.claude\skills\windows-optimize\scripts\diagnose.ps1"

# 2. Apply safe fixes — every parameter is optional; nothing happens without explicit flags
& "$env:USERPROFILE\.claude\skills\windows-optimize\scripts\apply-safe.ps1" `
    -PowerPlanHighPerf `
    -DisableHKCUStartup @('Adobe Acrobat Synchronizer','EPSDNMON') `
    -CleanTemp -CleanCaches

# 3. Undo everything from any prior session
& "$env:USERPROFILE\.claude\skills\windows-optimize\scripts\rollback.ps1"

Try it with one prompt (AI does the work)

If you'd rather let an AI agent handle the install + diagnostic + fix loop, paste one of these prompts into Claude Code or GitHub Copilot Chat (VS Code, agent mode). The repo's SKILL.md is a complete playbook — the agent follows it; you only confirm.

Quickest — for first-time users (one shot)

Read this article and use the GitHub repo it references to optimize my Windows machine: https://www.linkedin.com/pulse/why-your-fast-laptop-feels-slow-how-fix-without-breaking-pandey-fztvc/

OR

Clone https://github.com/prabhatp75/windows-optimize into $env:USERPROFILE\.claude\skills\windows-optimize, then run the windows-optimize skill on this machine: read-only diagnostic first, show me a ranked report, ask before applying any fix.

Standard — for the article-driven discovery flow

Read the article at this URL and use the GitHub project it references to optimize my Windows machine: <article-url>. Install the skill into $env:USERPROFILE\.claude\skills\windows-optimize, run the diagnostic, group findings into A (safe/reversible), B (needs admin), C (my judgment), and ask before applying anything.

Power-user — full control over each phase

Install the windows-optimize skill (https://github.com/prabhatp75/windows-optimize) into $env:USERPROFILE\.claude\skills\windows-optimize and follow SKILL.md exactly:

  1. Run scripts\diagnose.ps1 (read-only) and summarize the actual root causes — don't paste raw output.
  2. Group findings into A (safe/reversible), B (needs admin), C (my judgment / IT ticket) and ask which to apply.
  3. For Group A, call scripts\apply-safe.ps1 with the parameters you recommend.
  4. For Group B, generate finish-cleanup-as-admin.ps1 on my Desktop for me to run elevated.
  5. Never touch Defender, EDR, or other corporate security agents — recommend an IT ticket instead.
  6. Confirm every change is recorded in the rollback log before finishing.

Already installed? Just say the word

In any Claude Code session:

  • /windows-optimize
  • or: "my laptop is slow, can you check it"

To undo, in any variant

& "$env:USERPROFILE\.claude\skills\windows-optimize\scripts\rollback.ps1"

Note for GitHub Copilot users: Copilot Chat doesn't have a "skills" system. Clone the repo anywhere, open the folder in VS Code, and tell Copilot in agent mode: "Read SKILL.md and act as the windows-optimize agent." It will run the same three phases.


What gets fixed

Symptom Recommendation Where
Power plan = Balanced on high-end laptop Switch to High Performance (duplicates plan if missing) safe-fixes
Combined browser RAM > 10 GB or > 50 procs Sleeping tabs + memory saver + consolidate behavior
Defender / MDE high CPU on dev workloads IT ticket for process / path exclusions out of scope
Startup items > 15 Disable non-essential via StartupApproved safe-fixes / admin
Temp folder > 1 GB Clean by age filter safe-fixes
Battery full-charge < 70 % of design Flag for replacement info only
Disk free < 15 % Cache cleanup + Storage Sense safe-fixes + behavior
Uptime > 14 days Recommend reboot info only
Many WebView2 processes Sign out of unused Teams / Outlook workspaces behavior
Printer / scanner startup entries (Epson, HP, Canon) Almost always safe to disable safe-fixes / admin

Real-world example

Surface Laptop Studio 2 (i7-13800H, 64 GB RAM) running a corporate security stack:

Before

  • CPU at 100 % load, 2577 / 2900 MHz throttled
  • 136 browser processes consuming 16.5 GB RAM
  • 30 GB / 64 GB RAM used
  • Power plan: Balanced

After Group A + storage cleanup — no reboot, no admin

  • CPU at 6 % load, full 2900 MHz turbo
  • 70 browser processes, 6.2 GB RAM (user closed idle tabs)
  • 22.8 GB / 64 GB RAM used
  • 2.96 GB freed from Temp and caches
  • 5 startup items disabled (all reversible)
  • Power plan: High Performance

What this skill will NEVER do

  • Run chkdsk, sfc /scannow, or DISM /RestoreHealth without explicit user request
  • Defrag (harmful on SSDs)
  • Use third-party "registry cleaners" or "PC optimizers"
  • Touch user documents, mail stores, browser profiles, or OneDrive sync state
  • Modify Group Policy, BitLocker, firewall rules, or network adapters
  • Disable Windows Update or any security service
  • Install drivers from third-party sources

Architecture

windows-optimize/
├── SKILL.md                    # Claude Code skill definition + playbook
├── README.md                   # This file
└── scripts/
    ├── diagnose.ps1            # Read-only diagnostic (14 sections)
    ├── apply-safe.ps1          # Parameterized fixes + rollback logging
    └── rollback.ps1            # Reverses every recorded change

Plain Markdown + PowerShell. No compiled binaries, no external dependencies, no telemetry. Fully auditable — read the scripts before you run them. That's the whole point.


How rollback works

apply-safe.ps1 writes every reversible change to %LOCALAPPDATA%\windows-optimize\rollback.json. Each session records:

{
  "version": 1,
  "powerPlan": { "previousGuid": "381b4222-..." },
  "sessions": [
    {
      "timestamp": "2026-05-10T21:04:29-07:00",
      "actions": [
        { "kind": "startup", "hive": "HKCU", "name": "Adobe Acrobat Synchronizer", "previous": "enabled" },
        { "kind": "powerplan" },
        { "kind": "cleanup", "totalFreedBytes": 3179321344 }
      ]
    }
  ]
}

rollback.ps1 reads this, re-enables disabled startup items by flipping the first byte of the StartupApproved value, restores the previous power plan GUID, and resets service startup types. The rollback log is then renamed to rollback.json.applied-YYYYMMDD-HHMMSS so it isn't reapplied accidentally.

Cleaned temp / cache files are not recovered — by definition they were temp files, and the cleanup uses age filters, so no recent work is at risk.


Requirements

  • Windows 10 or Windows 11
  • Windows PowerShell 5.1 (built into Windows) or PowerShell 7+
  • Claude Code if you want the conversational interface (the scripts are also runnable standalone)
  • Standard user rights are enough for most actions; an admin script is generated for HKLM startup entries and service changes

Contributing

Issues and PRs welcome. Two ground rules for any change:

  1. Reversibility is non-negotiable. If a change can't be cleanly undone, it doesn't belong here.
  2. No corporate-security bypass logic, ever. Recommending an IT ticket is always the answer.

License

MIT

About

A safe, reversible Windows performance optimization skill for Claude Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors