EPISODE · Jun 1, 2026
Custom slash commands and hooks: shortcuts you trigger, guarantees that fire on their own
from OCDevel Claude Code Podcast
You've been using the slash commands Claude Code ships with. Now write your own, and wire the hooks that fire on their own. Bundle a repeatable workflow into a command you trigger with a slash, then back it with hooks that enforce the rules a command can only ask for: build a /commit command, auto-lint after every edit, block writes to your migrations folder, and force the tests to pass before a turn can end. Episode page & show notes Try a walking desk - stay healthy & sharp while you learn & code 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. 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. 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.
What this episode covers
You've been using the slash commands Claude Code ships with. Now write your own, and wire the hooks that fire on their own. Bundle a repeatable workflow into a command you trigger with a slash, then back it with hooks that enforce the rules a command can only ask for: build a /commit command, auto-lint after every edit, block writes to your migrations folder, and force the tests to pass before a turn can end.
NOW PLAYING
Custom slash commands and hooks: shortcuts you trigger, guarantees that fire on their own
No transcript for this episode yet
Similar Episodes
Mar 26, 2026 ·1m
Jan 2, 2026 ·47m
Dec 21, 2025 ·46m