Claude Code Custom Slash Commands | Stop Repeating Prompts
Core Extraction
1. The Problem: Prompt Fatigue
Developers often repeat the same complex prompts for recurring tasks (e.g., code analysis, test generation, database seeding).
Standard prompting is manual and inconsistent.
2. The Solution: Custom Slash Commands
Definition: Pre-defined prompt templates stored as Markdown files.
Invocation: Triggered by typing / followed by the filename in the Claude Code terminal.
Mapping: filename.md→/filename.
3. Implementation Patterns
User-Scoped Commands: ~/.claude/commands/ (Global across all projects).
Project-Scoped Commands: .claude/commands/ (Specific to a repository, shareable via Git).
Dynamic Inputs:
$ARGUMENTS: Captures all trailing text after the command.
$1, $2, etc.: Positional arguments for structured inputs.
Bash Execution:
Using ! prefix allows executing shell commands from within the prompt.
Example: !git diff main can be embedded into the prompt for context.
4. Transition to the Skills System
The video highlights that while .claude/commands/ works, the Skills system (.claude/skills/) is the evolved standard.
Skills vs. Commands:
Commands are explicitly invoked by the user.
Skills are autonomously discovered by Claude using YAML description metadata, but can also be invoked as slash commands.
Skill Structure: .claude/skills/<name>/SKILL.md.
5. Practical Use Cases
Seeding Data: Automating user/expense creation for development databases.
Technical Spec Generation: Creating a slash command that takes a feature description and outputs a formal spec document.
Refactoring Workflows: Generating a technical plan from a spec and then executing it using “plan mode”.
Shadow Knowledge (Synthesis)
Workflow Automation: Custom commands transform Claude from a “chatbot” into a “CLI utility”.
Team Consistency: Committing commands to .claude/commands/ ensures every team member has access to the same high-quality prompts for PR reviews or testing.
Metadata-Driven Discovery: The transition to Skills indicates a shift towards Agentic Autonomy, where the AI chooses its own “tools” based on the task at hand.