I used to cram everything into custom slash commands.

If I had a task, I wrote a command. If I had a pattern, I wrote a command. Eventually I had thirty of them sitting in my project.

I forgot half of them by name. And the other half? Claude never used them unless I explicitly typed them out.

That felt wrong. I was building a library of prompts that only existed if I remembered to invoke them.

It turned out I was using the wrong tool for most of those jobs.


The question that actually matters

Before you write anything, ask one thing: who triggers it?

If you trigger it, and you want it on demand, that’s a slash command.

If Claude should pull it in automatically because the task matches, that’s a skill.

If the work is noisy or needs a restricted set of tools, that’s a subagent.

If it must happen every single time without fail, that’s a hook.

I used to mix these up constantly. I’d write a massive prompt for “how we do database migrations” and put it in a slash command. Then I’d forget to type /migrate and Claude would just guess. Or I’d make a slash command to “search the codebase for X” and watch my context window fill with irrelevant files.

The fix isn’t more prompts. It’s putting the prompt in the right place.


Slash commands: for when you want control

Slash commands are markdown files in .claude/commands/. A file named review.md becomes the command /review. I trigger these. They are explicit, deliberate actions.

Use $ARGUMENTS to pass dynamic input. Here’s what I do for a quick code review in .claude/commands/review.md:

Review the following code snippet for bugs, style issues, and potential performance hits. Be direct. If it's fine, say so. If it's bad, explain why.

$ARGUMENTS

I type /review and then paste the code. That’s it.

I use slash commands for things I want to do on demand: /changelog, /commit-msg, /explain. These are verbs I perform. They don’t need Claude to decide when they’re relevant. I decide.

Don’t use slash commands for background knowledge. If you have a command called /how-we-do-auth, Claude isn’t going to remember to use it every time it touches an auth file. It’s just a static text block waiting for your finger.


Skills: for know-how Claude should own

Skills are different. They live in .claude/skills/<name>/. Each skill is a folder with a SKILL.md file. That file has YAML frontmatter with a name and a description, followed by the instructions.

Claude reads the descriptions of all available skills at the start of a session. If the current task matches a description, Claude loads that skill itself. You don’t type anything. It just knows.

This is where I put our project’s conventions. “How we write migrations.” “How to add an API endpoint here.” “Our error handling patterns.”

The description is the whole trick. Write it like a trigger condition, not a summary.

Here is the file at .claude/skills/migrations/SKILL.md:

---
name: db-migrations
description: Use when creating or modifying database migrations. Defines our naming conventions, safe rollback strategies, and index creation rules.
---

When writing a migration:
1. Always name the file with a timestamp prefix.
2. Include a `down` function that is idempotent.
3. Do not drop columns in the same migration as adding them. Add new, backfill, then drop later.

I used to write this as a slash command. I’d have to remember to type /migrations every time I touched a schema file. Now Claude sees me creating a migration file and pulls this in automatically. It’s not a tool I use. It’s knowledge it has.


Subagents: for noisy work and limited tools

This is the one that saved my sanity.

Subagents are markdown files in .claude/agents/. They have frontmatter with name, description, and tools, plus a system prompt. The key difference: they run in their own context window.

They only hand back a summary to your main session.

I made a mistake here that cost me hours. I wrote a slash command called /fix-tests. It told Claude to “run the tests, read the output, find the failing test, and fix it.”

Sounds simple. But the test output was huge. Hundreds of lines. My main context window filled up with test logs before Claude even started reading the source code. By the time it got to the actual bug, it had forgotten half the context.

So I moved that logic into a subagent.

Here is the file at .claude/agents/test-fixer.md:

---
name: test-fixer
description: Use when tests are failing and you need to diagnose and fix them.
tools: Read, Grep, Glob, Bash
---

You are a test fixing agent.
1. Run the specific failing test suite provided.
2. Analyze the error output.
3. Locate the source file using Grep or Glob.
4. Propose a minimal fix.
5. Return only the diff and a one-sentence explanation of why it works.

Now when I ask Claude to “fix the failing tests,” it spins up this agent. The agent runs the tests, reads the logs, greps the codebase. All that noise stays in its own window. It hands me back just the fix. My main context stays clean.

I also use subagents for read-only reviewers. I give them only Read, Grep, and Glob.

They can’t edit files. They can’t run Bash. They just look and report. That limits their blast radius.


Hooks: for guarantees

If something must happen every time, no exceptions, it’s not a prompt. It’s a hook.

Prompts are suggestions. Claude might follow them. It might get distracted. Hooks are configured in settings.json and run shell commands on Claude Code events, like a PostToolUse hook after Claude uses the Edit or Write tool.

I use hooks for formatting after edits and blocking writes to .env files. If I want Prettier to run every time Claude edits a file, I don’t write a prompt saying “please format the file.” I wire up a hook. It happens. Every time.

I wrote a whole post on hooks before, but the core idea here is separation of concerns. Prompts guide behavior. Hooks enforce state. Don’t try to use a prompt to guarantee something that should be mechanical.


My decision checklist

When I need to add a new capability to my Claude Code setup, I ask this:

I trigger it, and I want it on demand? Slash command. /review, /changelog.

Claude should know this automatically when the task matches? Skill. “How we write migrations,” “Our API conventions.”

The work is noisy, or I need to limit tools? Subagent. Test fixing, codebase searching, read-only review.

It must happen every single time, no exceptions? Hook. Formatting, linting, blocking sensitive file edits.


Stop asking which feature is coolest

I spent too long trying to figure out which mechanism was “better.” There isn’t one.

Slash commands are explicit. Skills are implicit. Subagents are isolated. Hooks are guaranteed.

Ask who pulls the trigger. If it’s you, use a command. If it’s Claude, use a skill. If it’s a process that needs isolation, use an agent. If it’s a rule, use a hook.

That’s it. Nothing fancy. Just put the prompt where it actually belongs.