home / skills / petekp / claude-code-setup / process-hunter

process-hunter skill

/skills/process-hunter

This skill helps you identify and terminate resource-hogging processes on servers, freeing CPU and memory while presenting a clear victory report.

npx playbooks add skill petekp/claude-code-setup --skill process-hunter

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
5.7 KB
---
name: process-hunter
description: >
  CAVEMAN HUNT BAD PROCESS! Me find greedy creature eating fire and rocks.
  Me bonk them good. Use when tribe say "kill processes", "clean up servers",
  "save battery", "find resource hogs", "bonk next.js", or "hunt processes".
  Me bonk known bad creature automatic. Me ask before bonk mystery creature.
---

# ๐Ÿฆฃ CAVEMAN PROCESS HUNTER ๐Ÿฆฃ

Me find greedy process eating all fire (CPU) and hoarding rocks (memory).
Me bonk them. Lightning rock (battery) happy. Tribe proud.

## How Hunt Work

**IMPORTANT:** Always show hunt report after bonking! Tribe need see victory!

1. **Remember before-time** (so can compare later):
   ```bash
   python scripts/measure_power.py before
   ```

2. **Find greedy creature**:
   ```bash
   python scripts/hunt_processes.py
   ```

3. **BONK!** (track how many bonk and how much rock freed)

4. **Show big victory report** - ALWAYS do this after hunt:
   ```bash
   python scripts/measure_power.py report <bonk_count> <rocks_freed_mb>
   ```

## Cave Tools

### hunt_processes.py - Find Bad Creature

```bash
python scripts/hunt_processes.py [--cpu-threshold 10] [--mem-threshold 500]
```

Me sort creature into pile:
- **๐Ÿฆด BONK NOW**: Me know these bad. Safe smash.
- **๐Ÿค” ME NOT SURE**: Mystery creature. Ask human first.

### terminate_process.py - BONK Tool

```bash
python scripts/terminate_process.py <pid> [--force]
```

Me try gentle tap first. If creature no listen, ME USE BIG CLUB.
Use `--force` to skip gentle tap. Go straight to BIG CLUB.

### measure_power.py - Lightning Rock Checker

```bash
python scripts/measure_power.py before    # Remember this moment
python scripts/measure_power.py report    # Show hunt victory
python scripts/measure_power.py status    # Quick peek at juice
```

## Creature Me Know Safe To Bonk

These greedy. These eat much fire. BONK:
- Next.js fire-eater (`next-server`)
- Webpack bundle-beast
- Vite speed-demon
- Turbo thunder-lizard
- npm/yarn/pnpm run-run things
- React Native bridge troll
- Claude brain-in-box (when too many clone)
- TypeScript watcher-eye
- esbuild fast-maker

## When Ask Human First

Use AskUserQuestion before bonk:
- Mystery creature me not recognize
- Human app (browser, picture-maker, code-cave)
- Anything not in bonk-safe list

## Example Hunt

```
    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
    โ”ƒ  ๐Ÿฆฃ CAVEMAN PROCESS HUNTER ๐Ÿฆฃ                    โ”ƒ
    โ”ƒ  แ•ฆ(รฒ_รณห‡)แ•ค  Me find greedy process!              โ”ƒ
    โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›

    ๐Ÿฆด BONK NOW! (me know these bad)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      PID  61331 โ”‚ Fire: 121.9% ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ
                  โ”‚ Rock: 2886.5MB ๐Ÿชจ๐Ÿชจ๐Ÿชจ๐Ÿชจ๐Ÿชจ
                  โ”‚ What: Next.js fire-eater
                  โ”‚ Name: next-server
```

## Victory Report

After hunt, always show:

```
    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘     ๐Ÿฆฃ CAVEMAN HUNT REPORT ๐Ÿฆฃ                          โ•‘
    โ•‘     แ•ฆ(รฒ_รณห‡)แ•ค  Me show what happen!                     โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
    โ”ƒ                    ๐Ÿ’€๐Ÿ’€๐Ÿ’€๐Ÿ’€๐Ÿ’€                    โ”ƒ
    โ”ƒ                    ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ                    โ”ƒ
    โ”ƒ                                             โ”ƒ
    โ”ƒ   Creatures Bonked:   5                      โ”ƒ
    โ”ƒ   Cave Space Free: ~7.8 big rocks            โ”ƒ
    โ”ƒ                                             โ”ƒ
    โ”ƒ   OOGA BOOGA! GOOD HUNT!                    โ”ƒ
    โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›

    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
    โ”‚  ๐Ÿฆฃ MAMMOTH-SIZE VICTORY! ๐Ÿฆฃ                โ”‚
    โ”‚                                            โ”‚
    โ”‚     BEFORE           AFTER                 โ”‚
    โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”‚
    โ”‚    โ”‚ 135  โ”‚  >>>   โ”‚ 212  โ”‚   +77 sun     โ”‚
    โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜               โ”‚
    โ”‚                                            โ”‚
    โ”‚  โœจ Lightning rock VERY happy! โœจ          โ”‚
    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

     โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—โ”
     โ•‘  58%  โšก  โ•‘โ”‚
     โ•‘ [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘] โ•‘โ”‚
     โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”˜

    โฑ๏ธ  Sun-moves remaining: 3:32

    โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
    ๐ŸŒฟ Magic lightning box breathe easy now!
    ๐Ÿฆด Caveman did good. Tribe proud.
```

## Caveman Wisdom

- Fire = CPU (how much thinking)
- Rock = Memory (how much cave space)
- Sun-moves = Minutes (time before lightning rock sleep)
- Lightning rock = Battery
- Bonk = Terminate process
- Big club = SIGKILL (force)
- Gentle tap = SIGTERM (nice ask)

Overview

This skill is a lightweight process hunter that finds and terminates resource-hogging processes to free CPU, memory, and battery. It automatically bonks known bad processes and prompts the user before terminating unknown or potentially important processes. Use the included tools to measure before/after power and generate a clear victory report after cleanup.

How this skill works

The skill scans running processes against configurable CPU and memory thresholds, classifies results into trusted-to-kill and unknown candidates, and terminates targets with a gentle SIGTERM or a forced SIGKILL. It provides scripts to measure system power and resource state before the hunt and to produce a post-bonk report summarizing bonk count and memory freed. Known safe targets are handled automatically; unknown items require explicit user confirmation.

When to use it

  • Clean up servers with runaway processes consuming CPU or memory
  • Save battery on laptops or mobile-style devices by killing background hogs
  • Respond to alerts like โ€œkill processesโ€ or โ€œfind resource hogsโ€
  • During dev workflows when Next.js, bundlers, watchers, or dev servers spin out of control
  • When you need a quick, auditable cleanup with before/after resource reporting

Best practices

  • Always run the before measurement to enable meaningful after reports
  • Review the hunt report immediately after termination to confirm impact
  • Use conservative CPU/memory thresholds in production; test thresholds in staging first
  • Require user confirmation for any process not on the safe-to-bonk list
  • Prefer gentle termination first; use force flag only when a process does not stop

Example use cases

  • Developer laptop: find and terminate runaway Next.js or TypeScript watcher processes draining battery
  • CI agent cleanup: automatically bonk known build tools that persist after jobs finish
  • Server maintenance: locate memory leaks and free memory by terminating offending processes
  • Ad-hoc incident response: quickly identify top CPU consumers and produce a concise report for team post-mitigation
  • Automation: schedule a safe periodic scan to alert or auto-bonk known offenders and produce reports

FAQ

What processes will be terminated automatically?

A curated list of common developer and build tools known to hog resources (Next.js servers, bundlers, watchers, package runners, etc.) are flagged for automatic termination.

How does the skill avoid killing important system processes?

It only auto-bonks processes on the safe list and prompts for confirmation on unknown processes. You should verify thresholds and review confirmations before proceeding in sensitive environments.

How do I measure impact of a hunt?

Run the before measurement, perform the hunt, and then run the report script with bonk count and freed memory to see detailed before/after metrics and battery estimates.