From coolify-disk-cleanup
Free disk space on a Coolify server via the web app's built-in terminal. Use when Coolify warns about low disk space, or the user says "clean up coolify disk", "free space on the server", "coolify is running out of room", or similar. Related to the `coolify` skill — same login, but drives the in-app terminal instead of the dashboard pages.
How this skill is triggered — by the user, by Claude, or both
Slash command
/coolify-disk-cleanup:coolify-disk-cleanupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Free disk space on a Coolify server by opening the in-app terminal (Playwright) and running Docker/system prune commands. The Coolify low-disk warning fires often, so this skill exists to make the cleanup a one-shot.
Free disk space on a Coolify server by opening the in-app terminal (Playwright) and running Docker/system prune commands. The Coolify low-disk warning fires often, so this skill exists to make the cleanup a one-shot.
Same as the coolify skill — read ~/Development/dotfiles/.env for COOLIFY_URL, COOLIFY_EMAIL, COOLIFY_PASSWORD. Never log or echo credentials.
browser_navigate to ${COOLIFY_URL}/loginbrowser_fill_form — email field has name="email", password is the other textboxbrowser_click the "Login" button${COOLIFY_URL}/Coolify exposes a top-level terminal page (not per-server URL):
browser_navigate to ${COOLIFY_URL}/terminalbrowser_fill_form to set the combobox to the server name (default: localhost). If multiple servers exist, ask the user which one — never guess.root@hostname:~#) appears within ~1s.Sending input: browser_type with target: ".xterm-helper-textarea" and submit: true. The Coolify terminal is a real xterm.js with a hidden textarea overlay — clicking the visible terminal pane is not required.
Reading output: don't bother with browser_snapshot — xterm renders to a canvas, the a11y tree is empty. Use:
() => document.querySelector('.xterm-rows')?.innerText
This returns only the visible viewport (~24 lines), not scrollback. Long commands like docker builder prune stream past quickly; the totals you care about (Total reclaimed space, the prompt return) stay on screen because they appear last. For very long output, slice the last 500–1000 chars and look for the totals line.
Send df -h / and capture the Avail and Use% values for /. If Use% < 50%, stop — there's nothing to do.
Run everything as one detached script with output to a log file. Do NOT send commands sequentially through xterm and poll the viewport — the websocket will drop on long prunes and you'll have to reconnect mid-run. With a log file, disconnects are harmless: reconnect and tail the log.
Write the script and start it in one shot. The whole thing should be one browser_type call:
cat > /tmp/coolify-cleanup.sh <<'EOF'
#!/usr/bin/env bash
set +e
LOG=/tmp/coolify-cleanup.log
: > $LOG
echo "=== START $(date -Is) ===" >> $LOG
echo "--- BEFORE ---" >> $LOG; df -h / >> $LOG
echo "--- BUILDER PRUNE ---" >> $LOG; docker builder prune -af >> $LOG 2>&1
echo "--- SYSTEM PRUNE ---" >> $LOG; docker system prune -af >> $LOG 2>&1
echo "--- COOLIFY LOGS ---" >> $LOG
find /data/coolify/applications -name "*.log" -mtime +7 -delete 2>>$LOG
find /data/coolify -name "deployment-*" -type d -mtime +14 -exec rm -rf {} + 2>>$LOG
echo "--- JOURNALD ---" >> $LOG; journalctl --vacuum-time=7d >> $LOG 2>&1
echo "--- APT CLEAN ---" >> $LOG; apt-get clean >> $LOG 2>&1
echo "--- AFTER ---" >> $LOG; df -h / >> $LOG
echo "=== DONE $(date -Is) ===" >> $LOG
EOF
chmod +x /tmp/coolify-cleanup.sh
nohup /tmp/coolify-cleanup.sh > /dev/null 2>&1 &
echo "STARTED PID=$!"
Then poll for completion. Expect 3–6 minutes total on a busy Coolify host (system prune dominates). Use 60–90s between polls; do not poll faster.
pgrep -af coolify-cleanup.sh || tail -50 /tmp/coolify-cleanup.log
When pgrep returns empty, the run is finished — tail -200 /tmp/coolify-cleanup.log to extract:
Total reclaimed space: lines from each pruneVacuuming done, freed XM from journalddf -h / snapshots (BEFORE / AFTER)docker volume prune is intentionally NOT in this script — it requires explicit user confirmation before each run (see Safety). If confirmed, run it as a separate one-liner and append the result to the report.
If the websocket drops during the wait, reconnect via Step 2, re-run the pgrep check, and continue tailing the log. The script keeps running on the host regardless.
Run df -h / again and diff against the baseline.
Report a concise summary to the user:
<avail> free (<use%> used)<avail> free (<use%> used)If Use% is still above 80% after cleanup, surface that and suggest the next step (large container investigation: docker ps -s --format '{{.Names}}\t{{.Size}}' | sort -k2 -h).
docker volume prune — anonymous volumes from stopped containers (e.g., a Postgres that's currently down for maintenance) will be wiped. Named, in-use volumes are safe.rm -rf / style commands or anything that touches /data/coolify/databases, /data/coolify/backups, or /data/coolify/ssh.df shows / is already below 50% used, tell the user there's nothing to do instead of running prune commands for no reason.docker system prune. Poll every 60–90s — do not sample faster.pgrep -af coolify-cleanup.sh returning empty, not on viewport text. The xterm viewport only shows ~24 lines, so anything you care about scrolls off — read /tmp/coolify-cleanup.log instead.browser_evaluate on .xterm-rows for live status; tail /tmp/coolify-cleanup.log (via the terminal) for the actual results. Skip browser_snapshot entirely — xterm renders to canvas and the a11y tree is empty.pgrep, keep tailing.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub mikesilvis/ai-skills --plugin coolify-disk-cleanup