OCDevel Claude Code Podcast

Custom slash commands and hooks: shortcuts you trigger, guarantees that fire on their own

Episode 3 covered the slash commands Claude Code ships with. This one is about writing your own, plus the automation that fires whether Claude remembers it or not. Two primitives, one rule for choosing between them: a custom slash command is a shortcut you trigger; a hook is a guarantee that runs on its own. **Custom slash commands.** Where they live (a per-command folder under your project's `.claude` or your home `.claude`, with the folder name becoming the command), the `SKILL.md` file and its YAML frontmatter, and the fields that matter: `description`, `argument-hint`, `allowed-tools`, `model`, and `disable-model-invocation`. Passing arguments with `$ARGUMENTS` and positional `$1`/`$2`, injecting live shell output into the prompt with the `` !`...` `` prefix, and pre-approving tools so a workflow runs without permission prompts. Worked example: a `/commit` command that stages, writes a real message, pushes, and opens a PR. From the [skills documentation](https://code.claude.com/docs/en/skills.md). **Hooks.** The lifecycle events (PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart/End, compaction, notifications, subagent events), how they're configured under the `hooks` key in `settings.json`, the matcher syntax, the JSON a hook receives on stdin, and how it answers back through exit codes (0 success, 2 blocks) and a decision JSON that can allow, deny, ask, modify tool input, or add context. Three hooks worth stealing: auto-lint and format after every edit, block writes to the migrations folder, and a Stop hook that forces tests to pass before a turn can end. From the [hooks documentation](https://code.claude.com/docs/en/hooks.md). **The pitfall.** Putting an "always" or "never" rule inside a command's prose and trusting it. Command instructions are advice, like CLAUDE.md; if the cost of the model forgetting is real, that rule belongs in a hook. Plus quick traps: hook timeouts, unquoted arguments, and vague descriptions that never auto-invoke. Browse what you've built with `/hooks`, `/skills`, and `/help`.