Claude Code slash command
Add a custom /command to Claude Code that runs a script and feeds the output back to the model.
Slash commands are the cheapest way to extend Claude Code. They are markdown files with frontmatter — no plugin scaffolding required. Drop one into .claude/commands/ and it shows up as /<filename> immediately.
File location
.claude/commands/release-notes.md
The file
---
description: Draft release notes from the last N commits
argument-hint: [count]
allowed-tools: Bash(git log:*), Bash(git diff:*), Read
---
You are drafting a release notes entry for the current branch.
Run:
!`git log --oneline -n ${1:-10}`
!`git diff --stat HEAD~${1:-10}..HEAD`
Then write a concise CHANGELOG entry under three headings:
### Features
### Fixes
### Internal
Rules:
- Reference issue / PR numbers if they appear in commits
- One bullet per change, no marketing fluff
- Skip the "Internal" section if there are no internal-only commits
What you get
/release-notesruns with the default count of 10/release-notes 25passes 25 as${1}- The
!prefix runs each shell command and inlines its stdout into the prompt before the model sees it allowed-toolsscopes the command's permission so accepting it once doesn't grant blanket Bash
Patterns I use daily
/loadme— runsgit status,git diff,gh pr list --author @me, then asks Claude what's in flight. The single most useful command I've added./scrub— runs my repo's lint + typecheck + test in parallel and pipes failures back. Replaces my old git pre-commit hook./migrate-up— runs the migration tool with--dry-run, shows the plan, and only executes after Claude confirms. TheWaitstep is the whole point.
Project vs. user scope
| Path | Scope |
|---|---|
| .claude/commands/*.md | Project — committed, shared with the team |
| ~/.claude/commands/*.md | User — your personal commands across every repo |
Project commands win when both exist. Use this to override a personal command on a per-repo basis.