inspect-why-windows-did-shutdown

inspect-why-windows-did-shutdown is a skill for Claude Code from aiya000/dotfiles. It costs 63 tokens per session (1,644 once invoked), scanned A, original, MIT.

A Windows shutdown investigator that reads the Windows System event log from WSL, the Windows Subsystem for Linux.

In plain words
What is it for?
Use it to investigate unexpected shutdowns, reboots, crashes, and whether Windows Update or another system event caused them.
Why use it?
WSL is stopped when Windows restarts, so commands inside WSL cannot explain the earlier shutdown. This checks Windows' own records instead of relying on incomplete Linux logs.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions AGENTS.md.

Good fit Use it to investigate unexpected shutdowns, reboots, crashes, and whether Windows Update or another system event caused them.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aiya000/dotfiles/inspect-why-windows-did-shutdown
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 aiya000/dotfiles --skill inspect-why-windows-did-shutdown
Clone the repo
git clone --depth 1 https://github.com/aiya000/dotfiles

Made for: Claude Code.

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 inspect-why-windows-did-shutdown

README.md
[![agentmods](https://agentmods.dev/badge/skills/aiya000/dotfiles/inspect-why-windows-did-shutdown/github.svg)](https://agentmods.dev/skills/aiya000/dotfiles/inspect-why-windows-did-shutdown)
Your own site
<a href="https://agentmods.dev/skills/aiya000/dotfiles/inspect-why-windows-did-shutdown"><img src="https://agentmods.dev/badge/skills/aiya000/dotfiles/inspect-why-windows-did-shutdown/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 inspect-why-windows-did-shutdown

Your own site · 80×15
<a href="https://agentmods.dev/skills/aiya000/dotfiles/inspect-why-windows-did-shutdown"><img src="https://agentmods.dev/badge/skills/aiya000/dotfiles/inspect-why-windows-did-shutdown.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,644 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.00063 $0.01644
Opus 5.5 $0.00025 $0.00658
Sonnet 5.5 $0.00013 $0.00329
Haiku 4.5 $0.00006 $0.00164

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

Security

Grade A, and why

inspect-why-windows-did-shutdown 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_global/skills/inspect-why-windows-did-shutdown/SKILL.md · 130 lines

How it starts

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

inspect-why-windows-did-shutdown

The Windows System event log already knows why the machine went down. Read it from WSL with powershell.exe -- there is no need to open the GUI, and no need to ask the user to go clicking.

WSL itself holds no record of this. WSL is torn down with the host, so uptime, last, and journalctl inside the distro say nothing about why Windows restarted. Always go to the Windows log.

Step 0: Confirm powershell.exe is reachable

command -v powershell.exe

If it is missing, WSL interop is off. Stop here and fall back to the GUI instructions.

Step 1: Always set the output encoding first

powershell.exe writes the log's Japanese text in Shift-JIS, which arrives as mojibake. Every command in this skill must start with:

[Console]::OutputEncoding=[Text.Encoding]::UTF8;

Strip the CR too, or the output is littered with \r: pipe through tr -d '\r'.

Step 2: Pull the shutdown events

powershell.exe -NoProfile -Command "[Console]::OutputEncoding=[Text.Encoding]::UTF8; Get-WinEvent -FilterHashtable @{LogName='System'; Id=41,1074,6008,1001; StartTime=(Get-Date).AddDays(-3)} -ErrorAction SilentlyContinue | Sort-Object TimeCreated | ForEach-Object { '--- {0} / Id={1} / {2}' -f \$_.TimeCreated, \$_.Id, \$_.ProviderName; \$_.Message }" 2>&1 | tr -d '\r'

Reading the System log does not need Administrator.

-ErrorAction SilentlyContinue matters: Get-WinEvent -FilterHashtable throws when nothing matches, instead of returning empty. Without it, a clean machine looks like a failed command.

Widen AddDays(-3) if the event is older than the window.

Step 3: Read the four IDs

ID Provider What it means
1074 User32 Who initiated the shutdown/restart, and why. The one that answers the question
6008 EventLog The previous shutdown was unexpected -- power loss, hard freeze, held power button
41 Kernel-Power The system rebooted without shutting down cleanly
1001 BugCheck A blue screen, with the stop code and dump path

Read the full file on GitHub · 130 lines

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 · 130 lines · 63 tokens per session scan A 4ccc81301cf6

Subscribe to this mod's changes

inspect-why-windows-did-shutdown is a skill published in the GitHub repository aiya000/dotfiles (21 stars, last pushed 2d ago), licensed MIT. It adds 63 tokens to every session and 1,644 once invoked, about $0.0003 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-09-15.