DEV Community

brian austin
brian austin

Posted on

Claude Code custom slash commands: the /commands directory you're probably not using

Claude Code custom slash commands: the /commands directory you're probably not using

If you've been using Claude Code for a while, you've probably discovered .claude/settings.json for configuring permissions and tools. But there's another directory that most developers completely miss: .claude/commands/.

This is where you define custom slash commands — reusable prompts you can trigger with /command-name in any Claude Code session.

What are custom slash commands?

Think of them like shell aliases, but for Claude prompts. Instead of typing the same complex instruction every time, you define it once and call it with a short /command.

Here's the structure:

your-project/
├── .claude/
│   ├── settings.json
│   ├── CLAUDE.md
│   └── commands/
│       ├── review.md
│       ├── test.md
│       ├── deploy-check.md
│       └── changelog.md
Enter fullscreen mode Exit fullscreen mode

Each .md file in .claude/commands/ becomes a slash command.

Real commands I use daily

/review — consistent code review checklist

Create .claude/commands/review.md:

Review the code I'm about to paste. Check for:

1. Security issues (SQL injection, XSS, exposed secrets, unsafe deserialization)
2. Performance problems (N+1 queries, missing indexes, unnecessary loops)
3. Error handling gaps (unhandled promise rejections, missing try/catch, silent failures)
4. Code style violations (per our ESLint config in .eslintrc.js)
5. Missing tests for any new logic

Format your response as:
**Critical:** (issues that must be fixed before merge)
**Warnings:** (should fix but not blocking)
**Suggestions:** (nice to have)

Start with the most severe issue.
Enter fullscreen mode Exit fullscreen mode

Now in any Claude Code session: just type /review and paste your code.

/test — generate tests for selected code

.claude/commands/test.md:

Write comprehensive tests for the code I'm about to show you.

Rules:
- Use our test framework: Jest + Testing Library
- Test happy path, edge cases, and error conditions
- Mock external dependencies (DB calls, API calls, file system)
- Each test should have a clear description that explains WHAT it tests and WHY
- Aim for 80%+ branch coverage
- Don't test implementation details — test behavior

Output: ready-to-paste test file with imports included.
Enter fullscreen mode Exit fullscreen mode

/deploy-check — pre-deployment verification

.claude/commands/deploy-check.md:

I'm about to deploy. Help me verify I haven't missed anything.

Check the git diff I'll paste and look for:
1. Any hardcoded credentials, API keys, or secrets
2. Debug console.log statements that shouldn't ship
3. TODO comments that indicate unfinished work
4. Feature flags that should be enabled/disabled for prod
5. Database migrations that need to run before/after deploy
6. Any breaking API changes that need client-side updates

For each issue found, tell me: what it is, where it is (file:line), and what to do.
Enter fullscreen mode Exit fullscreen mode

/changelog — generate release notes from commits

.claude/commands/changelog.md:

Convert the git log I'm about to paste into user-facing changelog entries.

Rules:
- Group by: Features, Bug Fixes, Performance, Breaking Changes
- Write for users, not developers (no jargon, no internal ticket numbers)
- Skip chore/refactor/ci commits unless they affect users
- Use present tense ("Add", "Fix", "Remove")
- One line per change, keep it scannable

I'll paste the git log output.
Enter fullscreen mode Exit fullscreen mode

Then: git log v1.2.3..HEAD --oneline | pbcopy, paste into Claude Code after /changelog.

Team commands vs personal commands

The commands in .claude/commands/ are version-controlled — they live in your repo and your whole team gets them automatically.

For personal commands that shouldn't be in the repo, Claude Code also reads from ~/.claude/commands/ (global, not committed).

Practical split:

  • In repo (.claude/commands/): /review, /test, /deploy-check, /changelog — anything team-specific
  • Global (~/.claude/commands/): /explain, /rubber-duck, personal debugging workflows

Parameters in commands

Commands can accept $ARGUMENTS — whatever you type after the command name:

.claude/commands/fix-bug.md:

Fix the bug described here: $ARGUMENTS

Approach:
1. First, explain what's causing the bug
2. Show the minimal fix
3. Explain why your fix works
4. Suggest a test to prevent regression
Enter fullscreen mode Exit fullscreen mode

Usage: /fix-bug TypeError: Cannot read property 'id' of undefined in UserProfile.jsx:34

The full .claude/ setup that works for me

.claude/
├── settings.json          # tool permissions
├── CLAUDE.md              # project context (tech stack, conventions)
└── commands/
    ├── review.md          # /review — code review checklist
    ├── test.md            # /test — generate tests
    ├── deploy-check.md    # /deploy-check — pre-deploy verification
    ├── changelog.md       # /changelog — release notes from commits
    ├── fix-bug.md         # /fix-bug <description>
    └── explain.md         # /explain — explain code to a junior dev
Enter fullscreen mode Exit fullscreen mode

All committed to git. New team members get the full workflow on git clone.

One more thing: the API cost

Clause Code burns through Claude API tokens faster than anything else I use. My monthly Claude usage was approaching $200 before I started routing through SimplyLouie — a $2/month Claude API proxy that uses the same Anthropic models but at a fraction of the cost.

Configure it in your Claude Code settings:

{
  "apiKey": "your-simplylouie-key",
  "baseURL": "https://simplylouie.com/api"
}
Enter fullscreen mode Exit fullscreen mode

Same models. Different price. The /commands setup still works identically.


What's your most-used Claude Code slash command? Drop it in the comments — I collect good ones.

Top comments (0)