From c842b4a398205b1af3c908c230bdaf098304f9bf Mon Sep 17 00:00:00 2001 From: Arpad Krejczinger Date: Sun, 1 Mar 2026 23:45:18 +0100 Subject: [PATCH] Streamline AI docs, add skills, enforce symlink-everything policy - Add .claude/skills/: homelab-context (auto-loads key facts each session), homelab-status (/homelab-status command), deploy-config (symlink setup guide) - Remove AGENTS.md and ai/sessions/: superseded by plan mode + skill system - Remove 4 obsolete session commands (session-start/list/switch, reload-instructions) - Rewrite CLAUDE.md: remove duplicate content, enforce symlink policy, clarify sudo pattern - Trim docs/services.md from 946 to ~230 lines: remove planning-era content, keep install steps and current status for migration reference - Strip stale "sudo cp" deploy header from ssh-honeypot.service (now symlinked to repo) - Update TODO.md: mark NAS migration and symlink tasks done, add jellyfin upgrade warning --- .claude/skills/deploy-config/SKILL.md | 52 ++ .claude/skills/homelab-context/SKILL.md | 98 +++ .claude/skills/homelab-status/SKILL.md | 15 + AGENTS.md | 76 -- CLAUDE.md | 250 ++---- TODO.md | 22 +- config/systemd/ssh-honeypot.service | 9 - docs/services.md | 993 ++++-------------------- 8 files changed, 388 insertions(+), 1127 deletions(-) create mode 100644 .claude/skills/deploy-config/SKILL.md create mode 100644 .claude/skills/homelab-context/SKILL.md create mode 100644 .claude/skills/homelab-status/SKILL.md delete mode 100644 AGENTS.md diff --git a/.claude/skills/deploy-config/SKILL.md b/.claude/skills/deploy-config/SKILL.md new file mode 100644 index 0000000..995f2e3 --- /dev/null +++ b/.claude/skills/deploy-config/SKILL.md @@ -0,0 +1,52 @@ +--- +name: deploy-config +description: Set up symlinks from system config locations to this repo. Use when setting up on a new machine, or when a config file is found to be a real file instead of a symlink (config drift). Not for routine config changes — just edit the repo file directly. +disable-model-invocation: true +allowed-tools: Write, Bash(chmod *), Bash(diff *), Bash(ls *) +--- + +All system configs should be symlinked to this repo. Editing the repo file IS editing the live config. + +## Symlink Map + +| System location | Repo source | +|---|---| +| `/etc/nginx/sites-available/homelab` | `config/nginx/homelab.conf` | +| `/var/www/homelab/index.html` | `config/www/index.html` | +| `/etc/systemd/system/copyparty.service` | `config/systemd/copyparty.service` | +| `/etc/systemd/system/glances-web.service` | `config/systemd/glances-web.service` | +| `/etc/systemd/system/ssh-honeypot.service` | `config/systemd/ssh-honeypot.service` | +| `/opt/docker//docker-compose.yml` | `config/docker//docker-compose.yml` | + +## When to use this skill + +- **New machine setup**: Create all symlinks from scratch +- **Drift detected**: A system file is a real file instead of a symlink — replace it with a symlink +- **New config added to repo**: Create the initial symlink for it + +## How to create/fix a symlink + +Generate a script in `scripts/tmp/symlink-.sh`: + +```bash +#!/bin/bash +set -e +REPO="/home/hoborg/homelab/" +SYSTEM="" + +# Back up if it's a real file (not already a symlink) +[ ! -L "$SYSTEM" ] && cp "$SYSTEM" "${SYSTEM}.backup.$(date +%Y%m%d)" && echo "Backup created" + +ln -sf "$REPO" "$SYSTEM" && echo "Symlink created" +# Add post-link steps here (e.g. nginx -t && systemctl reload nginx, systemctl daemon-reload) +``` + +Tell the user to run: `sudo bash ~/homelab/scripts/tmp/symlink-.sh` + +## Routine config changes + +Just edit `config/` in the repo. The symlink means it's already live. Then: +- Nginx: `sudo nginx -t && sudo systemctl reload nginx` +- Systemd unit: `sudo systemctl daemon-reload && sudo systemctl restart ` +- Docker: `cd /opt/docker/ && docker compose restart` +- www/index.html: no action needed (served directly) diff --git a/.claude/skills/homelab-context/SKILL.md b/.claude/skills/homelab-context/SKILL.md new file mode 100644 index 0000000..acc1ab0 --- /dev/null +++ b/.claude/skills/homelab-context/SKILL.md @@ -0,0 +1,98 @@ +--- +name: homelab-context +description: Background reference for the homelab repo. Auto-loads key facts about services, ports, paths, and operational rules when working in this project. +user-invocable: false +--- + +## Architecture + +- **Domain**: ak-homelab.duckdns.org (DuckDNS) +- **Static IP**: 192.168.0.100 (interface: enp4s0) +- **SSH**: port 2222 (system), port 2223 (Gitea git) +- **NAS**: 192.168.0.101, mounted at `/mnt/nas/` + +## Services & Ports + +| Service | Port | Type | Path | +|-------------|-------|----------|-----------------| +| Nginx | 80/443| systemd | reverse proxy | +| Gitea | 3000 | Docker | /gitea/ | +| Jellyfin | 8096 | Docker | /media/ | +| Copyparty | 8082 | systemd | /files/ | +| Netdata | 19999 | Docker | /netdata/ | +| Portainer | 9000 | Docker | /portainer/ | +| qBittorrent | 8080 | Docker | /qbt/ | + +## Key Paths + +All configs are **symlinked** from system locations to this repo — editing the repo file is editing the live config: + +| System location | Repo source | +|---|---| +| `/opt/docker//docker-compose.yml` | `config/docker//docker-compose.yml` | +| `/etc/nginx/sites-available/homelab` | `config/nginx/homelab.conf` | +| `/var/www/homelab/index.html` | `config/www/index.html` | +| `/etc/systemd/system/copyparty.service` | `config/systemd/copyparty.service` | +| `/etc/systemd/system/glances-web.service` | `config/systemd/glances-web.service` | +| `/etc/systemd/system/ssh-honeypot.service` | `config/systemd/ssh-honeypot.service` | + +- NAS docker data: `/mnt/nas/docker-data//` + +## Critical Rules + +### Docker UID for NAS-mounted volumes +Services with data on NAS (`/mnt/nas/`) must use `USER_UID=1024 USER_GID=100` to match NAS file ownership. Services with local storage use `1000:1000`. + +### Docker config changes +Edit `config/docker//docker-compose.yml` in repo → restart container. No copy needed (symlinked). + +### After editing a config in repo +- **Docker**: `cd /opt/docker/ && docker compose restart` +- **Nginx**: `sudo nginx -t && sudo systemctl reload nginx` +- **Systemd unit**: `sudo systemctl daemon-reload && sudo systemctl restart ` +- **www/index.html**: no action needed + +### Sudo scripts +Never run sudo directly. Generate a script in `scripts/tmp/` and run `sudo bash ~/homelab/scripts/tmp/