|
| 1 | +# Claude Code Skills for libCacheSim |
| 2 | + |
| 3 | +This file documents the Claude Code slash-command skills available to agents working in this repository. Skills are pre-built behaviors that extend Claude Code; invoke them with the `/skill-name` syntax in any Claude Code session. |
| 4 | + |
| 5 | +## Quick Reference |
| 6 | + |
| 7 | +| Skill | Command | Purpose | |
| 8 | +|---|---|---| |
| 9 | +| `update-config` | `/update-config` | Configure the Claude Code harness via `settings.json` | |
| 10 | +| `session-start-hook` | `/session-start-hook` | Set up `SessionStart` hooks (build checks, linters) | |
| 11 | +| `simplify` | `/simplify` | Review changed code for quality, reuse, and efficiency | |
| 12 | +| `loop` | `/loop [interval] [cmd]` | Run a command repeatedly on a timed interval | |
| 13 | +| `schedule` | `/schedule` | Create scheduled remote agents on a cron schedule | |
| 14 | +| `claude-api` | `/claude-api` | Build tools or integrations using the Anthropic SDK | |
| 15 | +| `keybindings-help` | `/keybindings-help` | Customize keyboard shortcuts | |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Skills |
| 20 | + |
| 21 | +### `update-config` — Configure the harness |
| 22 | + |
| 23 | +Use this when you want to add automated behaviors: "before every commit run the linter", "after each edit rebuild", etc. Automated behaviors are executed by the **harness** (not by Claude at prompt time), so they must be registered in `settings.json` via hooks—asking Claude to remember something is not sufficient. |
| 24 | + |
| 25 | +``` |
| 26 | +/update-config |
| 27 | +``` |
| 28 | + |
| 29 | +**When to use:** |
| 30 | +- Setting up pre/post-tool hooks (e.g., run `cmake --build` after file edits) |
| 31 | +- Storing project-level defaults or allowed tool lists |
| 32 | +- Enabling or disabling specific capabilities for automated sessions |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +### `session-start-hook` — Ensure the project is ready at session start |
| 37 | + |
| 38 | +Sets up a `SessionStart` hook so every new Claude Code session begins by verifying the project is in a known-good state: dependencies installed, build passing, tests green. |
| 39 | + |
| 40 | +``` |
| 41 | +/session-start-hook |
| 42 | +``` |
| 43 | + |
| 44 | +**When to use:** |
| 45 | +- First-time setup of a repo for Claude Code on the web |
| 46 | +- Ensuring `cmake` configuration and build succeed before an agent starts editing C code |
| 47 | +- Running `ctest` at session start to confirm no pre-existing failures |
| 48 | + |
| 49 | +**libCacheSim example hook:** |
| 50 | +```bash |
| 51 | +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j$(nproc) |
| 52 | +``` |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +### `simplify` — Code review after changes |
| 57 | + |
| 58 | +After making edits, invoke this skill to review the changed code for redundancy, reuse opportunities, and inefficiencies. The skill finds issues and fixes them in place. |
| 59 | + |
| 60 | +``` |
| 61 | +/simplify |
| 62 | +``` |
| 63 | + |
| 64 | +**When to use:** |
| 65 | +- After adding a new eviction algorithm to check for duplicated logic |
| 66 | +- After editing `CMakeLists.txt` to verify build targets aren't redundant |
| 67 | +- As a final pass before committing |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### `loop` — Recurring tasks |
| 72 | + |
| 73 | +Runs a prompt or slash command on a repeating interval. Defaults to every 10 minutes if no interval is specified. |
| 74 | + |
| 75 | +``` |
| 76 | +/loop [interval] [command or prompt] |
| 77 | +``` |
| 78 | + |
| 79 | +**Examples:** |
| 80 | +``` |
| 81 | +/loop 5m /simplify |
| 82 | +/loop 2m check if the cmake build is still passing and report any errors |
| 83 | +``` |
| 84 | + |
| 85 | +**When to use:** |
| 86 | +- Watching a long `ctest` run and summarizing new failures as they appear |
| 87 | +- Periodically re-running the trace analyzer on a data file and diffing results |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +### `schedule` — Cron-based remote agents |
| 92 | + |
| 93 | +Creates, updates, lists, or runs scheduled remote agents that execute on a cron schedule. Unlike `/loop` (which runs in the current session), scheduled agents persist and run independently. |
| 94 | + |
| 95 | +``` |
| 96 | +/schedule |
| 97 | +``` |
| 98 | + |
| 99 | +**When to use:** |
| 100 | +- Nightly performance regression checks against reference traces in `data/` |
| 101 | +- Weekly sweeps to ensure all example projects still build cleanly |
| 102 | +- Automated benchmark runs on a fixed schedule |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +### `claude-api` — Build tools with the Anthropic SDK |
| 107 | + |
| 108 | +Triggered automatically when code imports `anthropic` or `@anthropic-ai/sdk`. Also invoke manually when you want to build a script or integration that calls Claude programmatically. |
| 109 | + |
| 110 | +``` |
| 111 | +/claude-api |
| 112 | +``` |
| 113 | + |
| 114 | +**When to use in libCacheSim context:** |
| 115 | +- Writing a Python script that uses Claude to analyze cache trace output and suggest algorithm tuning |
| 116 | +- Building a Node.js tool on top of `libcachesim-node` that calls Claude to interpret miss-ratio curves |
| 117 | +- Generating synthetic trace files with LLM assistance |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +### `keybindings-help` — Customize keyboard shortcuts |
| 122 | + |
| 123 | +Modifies `~/.claude/keybindings.json` to rebind keys, add chord shortcuts, or change the submit key. |
| 124 | + |
| 125 | +``` |
| 126 | +/keybindings-help |
| 127 | +``` |
| 128 | + |
| 129 | +**When to use:** |
| 130 | +- Rebinding a key that conflicts with your terminal emulator |
| 131 | +- Adding a chord shortcut for a frequently used command like `/simplify` |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## Hooks vs. Asking Claude |
| 136 | + |
| 137 | +A common confusion: asking Claude "always run the linter after you edit a file" does **not** persist beyond the current session. To make a behavior automatic and durable, it must be registered as a hook in `settings.json`. Use `/update-config` or `/session-start-hook` to set this up correctly. |
| 138 | + |
| 139 | +| Goal | Right approach | |
| 140 | +|---|---| |
| 141 | +| Run `cmake --build` after every file edit | `/update-config` → PostToolUse hook | |
| 142 | +| Verify build at the start of every session | `/session-start-hook` | |
| 143 | +| One-off code review | `/simplify` | |
| 144 | +| Recurring check during a session | `/loop` | |
| 145 | +| Persistent scheduled agent | `/schedule` | |
0 commit comments