/skill-ops:skill-opsfrom skill-ops
Operational hub for Claude Code skills with 4 modes: snapshot/rollback, usage health analysis, invocation frequency tracking, and operational quality scoring.
Ships in skill-ops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Skill/agent ops hub — 4 modes: snapshot, health (usage), invocations (frequency), quality (operational score).
${CLAUDE_SKILL_DIR} is this skill's folder; Claude Code fills it in. In other agents, replace it with the path where you installed the skill. Use python instead of python3 where only that exists (common on Windows). If a script is missing or fails to start, say so: Snapshot mode falls back to the manual phases below; Health, Invocations and Quality modes stop with "scoring script unavailable" (Invariant 8: no scores by eye).
File formats (invocation log, lessons.md): https://github.com/AlexZio00/sovereign-skills/blob/master/docs/FILE-CONVENTIONS.md
Snapshot integrity + invocation log completeness — if a snapshot doesn't match the original, rollback is meaningless. Without logs, usage analysis is impossible.
~/.claude/.harness/snapshots/ — if broken: report permission issue + provide manual mkdir command.~/.claude/skills/*/SKILL.md or ~/.claude/agents/*.md — if broken: ask for the skill name directly.~/.claude/.harness/invocations/YYYY-MM.jsonl (Phase 1.6.5 is the primary writer, Phase 3.7 the fallback). Without that skill there is no writer, so there are no logs — if so, state "no logs".~/.claude/skills/*/SKILL.md. An inventory file (for example SKILLS_INVENTORY.md) is optional: use one if you keep it, otherwise scan the folders./skill-ops (snapshot default)/skill-ops health/skill-ops invocations/skill-ops quality (or --quality)~/.claude/skills/ or ~/.claude/agents/ (project code → git handles it)invocations/ directory itself doesn't exist → report "no logs"| Mode | Role | Trigger |
|---|---|---|
| snapshot | Pre-change snapshot + regression-detection restore command | /skill-ops (default) |
| health | Usage/Dead/Unused/Discard report | /skill-ops health |
| invocations | Per-skill frequency rollup from session JSONL | /skill-ops invocations |
| quality | Per-skill S_Q operational score (structure + usage), bottom quartile flagged | /skill-ops quality |
Script path (preferred): python3 "${CLAUDE_SKILL_DIR}/scripts/skill_snapshot.py" snapshot <name|absolute-path> [--label L] runs Phases 0-4 and 6 in one call: byte-for-byte comparison (MATCH/MISMATCH), a same-day identical-content check (DUPLICATE), delete commands for snapshots beyond the newest 5 (printed only, never run), the rollback command (printed only, with quoted paths), and a final STATUS: line. Layout: <name>/<YYYY-MM-DD-HHMMSS>[-label]/<original file name>. python3 "${CLAUDE_SKILL_DIR}/scripts/skill_snapshot.py" audit counts directories outside that layout, read-only (for example date-only labels or name directories with no timestamp subdirectory); with no snapshot folder it prints "no snapshots". Existing nonstandard entries are not moved. Follow the manual phases below only when the script cannot run.
~/.claude/skills/<name>/SKILL.md or ~/.claude/agents/<name>.md[READ] {TARGET_FILE} → compute its SHA-256 content hash (ORIGINAL_HASH; shasum -a 256 on macOS, sha256sum on Linux/Git Bash)TIMESTAMP=$(date +%Y-%m-%d-%H%M%S)
SKILL_SNAP_DIR=~/.claude/.harness/snapshots/{skill-name}
ORIGINAL_HASH=$( (shasum -a 256 "${TARGET_FILE}" 2>/dev/null || sha256sum "${TARGET_FILE}") | cut -d' ' -f1)
mkdir -p "${SKILL_SNAP_DIR}/${TIMESTAMP}"
ORIGINAL_HASH → "identical-content snapshot already exists" → go to Phase 6 (equal line counts alone do NOT count as identical — always compare hashes)[WRITE] snapshot → [READ] re-verify → compare its SHA-256 hash against ORIGINAL_HASH⚠️ Snapshot verification failed + end with PARTIALSNAP_DIR=~/.claude/.harness/snapshots/{skill-name}
COUNT=$(find "${SNAP_DIR}" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
if [ "${COUNT}" -gt 5 ]; then
echo "Cleanup candidates (oldest first, beyond the 5 kept) — run these yourself:"
find "${SNAP_DIR}" -mindepth 1 -maxdepth 1 -type d | sort | head -n "$((COUNT-5))" | while IFS= read -r path; do
[ -n "${path}" ] && echo "rm -rf -- \"${path}\""
done
fi
COUNT ≤ 5, so head -n never receives a zero or negative argument.while IFS= read -r path loop handles snapshot paths that contain spaces.rm -rf itself — it only lists candidates and prints the exact command; running it is the user's call (same propose-then-user-executes pattern as Phase 6's rollback command). A skill silently deleting a user's files in bulk is a worse failure mode than asking them to paste one line.~/.claude/.harness/scores/*.json (for example a check-harness skill, optional, not included in this repo). This skill never writes those files.harness_score (0-100 scale, written by that tool; a different scale from this skill's own 0-10 S_Q metric in Quality Mode below) + date from the latest file.Print the command only; never run it. {ORIGINAL_FILE_NAME} is SKILL.md for a skill and <name>.md for an agent; quote the paths.
Rollback: cp "~/.claude/.harness/snapshots/{skill-name}/{TIMESTAMP}/{ORIGINAL_FILE_NAME}" "{TARGET_FILE}"
List: ls ~/.claude/.harness/snapshots/{skill-name}/
invocations/ directory existsThe script does the rollup: python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" report [--days 30] [--out ~/.claude/.harness/reports/skill-health-{date}.md] produces the Phase 1-3 per-skill count, last_seen, discard_rate, and status label in one pass. It counts records from every source in the log, accepts discarded entries as plain strings or {"skill": ..., "reason": ...} objects, and prints a denominator line. Without --out it creates no file; with --out it creates missing parent folders. If the skills folder is missing it prints an error naming it and exits 2 (pass --skills-dir). Keep this as the single rollup implementation: if the log rules change, change this script first. The manual description below explains how to read its output.
Per-skill rollup from JSONL over the last 30 days (default):
skills[] → invocation countdiscarded[] → Discard If trigger countlast_seen → last invocation date~/.claude/.harness/snapshots/{skill}/ — NOT the skill's true cumulative edit count, since Invariant 4 caps retention at 5 (a skill edited more than 5 times still shows at most 5 here). A count at or near the 5-snapshot cap is a stability-watch signal (frequent recent edits)Don't eyeball this against the criteria table — call the bucket classifier per skill instead:
python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" bucket --count {invocation_count_30d} --last-seen {last_seen_date} --discard-rate {discard_rate}
--last-seen and --discard-rate come from the Phase 1 rollup. The script is the source of truth for the label; the table below is reference only, for reading the output — not for manually re-deriving it.
| Status | Criterion | Label |
|---|---|---|
| Active | ≥ threshold (2x/30d) within range | 🟢 |
| Low | ≥1x, below threshold | 🟡 |
| Unused | 0x in range (logs exist, skill never invoked), under 90 days since last use | 🔴 |
| Dead | 0x, 90+ days | 💀 |
| Discarded | Discard If triggered only | ⚪ |
| Unknown | No logs (or no records in range) | ❓ |
Unused + no recent edits is a retire-candidate signal.
Skill-bank alignment signal: a skill bank that has drifted out of alignment with your current goals or workflow can underperform having no skill bank at all. Treat Unused and clearly-misaligned skills as a stronger retire-candidate signal than either alone.
Retirement-judge audit gate: before wiring Health mode's Dead/Unused/Discard classifications into any automated delete/archive pipeline, validate the classifier itself — deliberately include a few known-good (still-needed) skills in the candidate pool and check whether the classifier still flags them (false positives). A high false-positive rate means the retirement mechanism looks like it's working but silently isn't. Until that validation exists, this mode stays report-only — deletion is always the user's call (Invariant 5).
📊 Skill Health — {YYYY-MM-DD}
🟢 Active {N} | 🟡 Low {N} | 🔴 Unused {N} | 💀 Dead {N}
[Full status table]
[💀 Dead — recommend immediate review]
[⚪ Discard ratio >30% warning]
Save: ~/.claude/.harness/reports/skill-health-{date}.md
Measure per-skill monthly invocation frequency from the invocation log.
python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" report --days 30 (the same rollup as Health mode) and take Top 5 and zero-invocation from its table. Use --days 90 or 365 for longer windows. No log folder: state "no logs".python/python3 on PATH; if neither resolves, check common install locations before failing.Output:
📊 Skill Invocation Report (YYYY-MM)
Top 5: [most invoked]
Zero-invocation: [never-invoked list — SHARPEN candidates]
Trigger:
/skill-ops qualityor/skill-ops --quality
Calculate a per-skill quality score (S_Q, 0-10 scale — distinct from the 0-100 harness_score in Snapshot Mode's Score Store) and identify the bottom quartile as optimization targets.
⚠️ Boundary: S_Q is an operational signal for "keep vs. retire this skill" — not a quality oracle. It measures usage plus a handful of structural checklist items, not whether the skill's content is actually good. Don't read a low S_Q as "this skill is badly written" — it may simply be under-used. Deep content-quality review of a skill's actual reasoning/instructions is a separate activity outside this skill's scope (see
not_forabove).
Structure score, usage score, and their sum are computed by the script — never re-derive them by reading the checklist and eyeballing points. The bullets below are what each score means, not steps to apply by hand.
~/.claude/skills/*/SKILL.md (an inventory file is optional)python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" structural --file <path to SKILL.md>
Output is JSON: {"structural_score": N.N}. Checks, +1 each: Dominant Variable present · Discard If present · Invariants has a violation-consequence clause · Scope Boundary has 2+ rows on each side · Rationalization Table has 3+ rows.python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" usage --invocation-count-30d {N} --discard-rate {F} \
--days-since-modified {N} [--has-related-lesson]
{N} for invocations and {F} come from the Health rollup; --days-since-modified is the days since the SKILL.md file's modification time; pass --has-related-lesson only if a lessons file (tasks/lessons.md, if you keep one) has an entry that names this skill, otherwise omit it.
Output is JSON: {"usage_score": N.N}. Weights: 5+ invocations in 30 days (+2) / 1-4 (+1) / 0 (0) · Discard If trigger rate < 30% (+1, only when invocations ≥ 1 — with 0 calls the rate has no denominator) · last modified within 30 days (+1) or within 90 days (+0.5) · related lesson exists (correction history = usage evidence) (+0.5).sq subcommand takes --structural/--usage as plain floats, so piping step 2/3's JSON straight in fails argparse. Extract the numeric field first:
S=$(python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" structural --file <path to SKILL.md> | python3 -c "import json,sys; print(json.load(sys.stdin)['structural_score'])")
U=$(python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" usage --invocation-count-30d {N} --discard-rate {F} --days-since-modified {N} | python3 -c "import json,sys; print(json.load(sys.stdin)['usage_score'])")
python3 "${CLAUDE_SKILL_DIR}/scripts/skill_health_bucket.py" sq --structural "$S" --usage "$U"
📊 Skill Quality Report (YYYY-MM-DD)
Bands (half-open): STRONG 7 <= S_Q <= 10: {N} | ADEQUATE 4 <= S_Q < 7: {N} | WEAK 0 <= S_Q < 4: {N}
(the highest reachable S_Q is 9.5: structure 5 + usage 4.5)
OPTIMIZE (bottom quartile by S_Q): {N}
[OPTIMIZE target table: skill name | structure | usage | S_Q | 1-line improvement direction]
Save: ~/.claude/.harness/reports/skill-quality-{date}.md
| Does | Does NOT |
|---|---|
| [READ] Read the original snapshot target file | Directly modify skill/agent files |
| [WRITE] Save timestamped snapshot file | Execute automatic restoration (proposal only) |
| [BASH] List old snapshots beyond 5 + print the delete command | Directly delete a snapshot (execution is the user's job) / Upload to external storage/cloud |
| [READ] Check prior Score Store score (optional, only if another tool writes it) | Write the Score Store or run a quality audit itself |
| [READ] Parse invocations JSONL (tool_use only) | Read session prompt text |
| [WRITE] health report (invocations mode writes nothing) | Judge skill quality or decide deletion |
| [BASH] Scan session JSONL for frequency rollup | Access project code or databases |
[BASH] Call skill_health_bucket.py for bucket/structural/usage/S_Q scoring | Manually re-derive those scores by eye |
Targets only
~/.claude/global skills/agents. Project code version control is git's job.
| Risky Action | Reversibility | Applied Layers |
|---|---|---|
Clean up old snapshots (list + print rm -rf, user runs it) | medium | L1+L3 |
Roll back a skill file (this skill only prints the cp command; the user runs it) | medium | L1+L3 |
| Failure Type | Detection | Recovery |
|---|---|---|
tool_failure | Write/Read failure | State "snapshot save failed". Never proceed with comparison without a snapshot |
logic_inconsistency | Only if Phase 5 ran: harness_score DELTA (0-100 scale, from the optional Score Store, not the 0-10 S_Q scale) ≤ -5 but content actually improved | State "possible false positive" + ask user to re-review |
missing_data | Target file missing / invocations log missing | Discard that mode + state the reason |
input_error | Target skill unclear | Snapshot mode: ask for the skill name (1 question). Health, Invocations and Quality modes: default to the full-list scan |
cp command. Execution is the user's job. Violation → unintended file overwrite.rm -rf itself (same propose-then-user-executes pattern as Phase 6's rollback). Violation → unreported cleanup targets let the directory grow unbounded.skill_health_bucket.py (in this skill's scripts/ folder), never eyeballed: counting is a job for the script, judgment (retire or not) stays with the user/LLM. Violation → scores drift silently between runs and stop being comparable.WORKING / PARTIAL / BROKEN.| Rationalization | Rebuttal |
|---|---|
| "Skipping the re-verify after Write is fine if it succeeded" | Violates Invariant 2. A silent Write failure means rollback is attempted without a real snapshot |
| "Auto-restore would be more convenient" | Violates Invariant 3. If the user restores without understanding the regression cause, the root cause remains |
| "Old snapshots can just stay" | The folder grows without bound. The keep-5 rule prints delete commands; the user decides when to run them |
| "Skills at 0 usage can be auto-deleted" | Violates Invariant 5. Could be emergency-only, seasonal, or recently added. User decides |
| "Months with no logs can just be treated as 0 invocations" | Violates Invariant 6. Must be treated as Unknown |
| "High Discard If ratio → recommend immediate retirement" | Related to Invariant 7. The safeguard may simply be working correctly. Propose re-review only |
| "The criteria table is simple enough to just eyeball" | Violates Invariant 8. Manual application drifts from the script's exact thresholds and regex logic — the same skill can score differently run to run |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
skill-management, snapshot, rollback, usage-analysis, invocation-tracking, ops-hub
npx claudepluginhub alexzio00/sovereign-skills --plugin skill-opsOther plugins' skills for the same job