CloudCodeTree LogoCloudCodeTree
AI NewsTutorialsAbout
CloudCodeTree Logo
CloudCodeTree
  • AI News
  • Tutorials
  • About
← Back to AI News
Stop Re-Typing the Same Prompt: Build Personal Claude Code Slash Commands That Follow You Everywhere

Photo: Daniil Komov / Pexels

Stop Re-Typing the Same Prompt: Build Personal Claude Code Slash Commands That Follow You Everywhere

Chris Harper

3 min read

Aug 2, 2026 · 12:10 UTC

AI
Workflow
Claude Code
Best Practices

One Markdown file in ~/.claude/commands/ turns any repeating prompt into a permanent slash command — with positional $ARGUMENTS support and a project scope that shares it with your whole team.

If there's a paragraph you type every week — "review this file for injection vulnerabilities and missing error handling" — you're wasting keystrokes. Claude Code custom slash commands turn that paragraph into a permanent / invocation you never retype.

Two scopes, one mental model

Personal (~/.claude/commands/): available in every project, never committed to version control. Invoke with /name or /user:name.

Project (.claude/commands/): shared with every teammate who clones the repo. Best for standards everyone should run — PR templates, release checklists, service-specific test sequences. Invoke with /name or /project:name.

Build your first command in 90 seconds

mkdir -p ~/.claude/commands

cat > ~/.claude/commands/review.md << 'EOF'
Review the following file for:
1. Security issues: injection, XSS, path traversal, hardcoded secrets
2. Missing error handling and uncaught exceptions
3. Functions that do too much and should be split

File: $ARGUMENTS
EOF

Now type /review src/auth/login.ts — Claude reads the Markdown, substitutes $ARGUMENTS with src/auth/login.ts, and runs the full review every time, identically.

Positional arguments with $ARGUMENTS[n]

For multi-argument commands, index into the words: /migrate SearchBar React Vue with a command body containing Migrate $ARGUMENTS[0] from $ARGUMENTS[1] to $ARGUMENTS[2] produces Migrate SearchBar from React to Vue. Use $ARGUMENTS (no index) to capture everything after the command name as a single string.

Project-scoped team command: shared release checklist

<!-- .claude/commands/release.md -->
Run our pre-release checklist for version $ARGUMENTS[0]:

1. Confirm CHANGELOG.md has an entry for $ARGUMENTS[0]
2. Run full test suite: pnpm test
3. Check no TODO comments remain in changed files
4. Verify the Docker build succeeds: docker build .
5. Generate release notes summarizing changes since the last tag.

Report failures as a numbered list with severity (P0/P1/P2).

Invoke with /release v2.5.0 — Claude runs all five checks and ranks failures. Every teammate runs the same checklist from the same file.

Why commands beat CLAUDE.md for repeatable tasks

CLAUDE.md rules shape Claude's defaults passively and globally. Commands are explicit and parameterized — you call them when you want them, and the Markdown file is the single source of truth that can't drift, get compressed away, or be forgotten mid-session. If something must run exactly the same way every time, put it in a command file.

Sources: Custom Slash Commands — Claude Code Docs · Slash Commands Complete Guide 2026 — alexop.dev · Custom Slash Commands Tutorial — Build This Now