Claude Code VSCode Extension supports custom slash commands for quick access to frequently used prompts or operations.
Project commands are specific to your project and accessible to anyone working with the project repository.
- Location:
.claude/commands/directory in your project - Format: Markdown files (
.mdextension) - Usage:
/project:command-name [arguments]
User commands are personal commands that work across all projects on your machine.
- Location:
~/.claude/commands/directory in your home folder - Format: Markdown files (
.mdextension) - Usage:
/user:command-name [arguments]
The VSCode extension provides autocomplete suggestions for your custom commands, making them easy to discover and use.
When you type /, the extension scans for custom commands and displays them alongside built-in commands.
When you select and execute a custom command, it's sent directly to Claude Code CLI which processes the command - the VSCode extension simply provides the suggestions.
-
Create the appropriate directory:
- Project commands:
mkdir -p .claude/commands(in your project root) - User commands:
mkdir -p ~/.claude/commands(in your home directory)
- Project commands:
-
Create a Markdown file with your command content:
- The filename (without extension) becomes the command name
- The content of the file is the prompt that Claude Code CLI will read
- Example:
.claude/commands/optimize.mdcreates the command/project:optimize
-
For commands that accept arguments, use the
$ARGUMENTSplaceholder in your command content.- Example: If your command file contains
Find and fix issue #$ARGUMENTS, calling/project:fix-issue 123will replace$ARGUMENTSwith123
- Example: If your command file contains
- Create a file
.claude/commands/optimize.mdwith the content:
# Optimize Code
Please optimize the following code for performance and readability:
$ARGUMENTS
Focus on:
- Reducing time complexity
- Improving memory usage
- Making the code more readable
- Adding appropriate comments- Use it in the Claude VSCode extension by typing
/project:optimizefollowed by your code.
- Create a file
~/.claude/commands/ios-developer.mdwith the content:
# iOS Developer Mode
I want you to act as an experienced iOS developer with deep knowledge of Swift, UIKit, and SwiftUI. Please help me with the following:
$ARGUMENTS
Focus on Swift best practices and modern iOS development patterns.- Use it by typing
/user:ios-developerfollowed by your question or code.
The extension monitors your command directories and automatically refreshes the command list when you:
- Create, modify, or delete command files in the
.claude/commands/or~/.claude/commands/directories - Commands will be visible in the slash command autocomplete menu the next time you type
/
- The first line of the command file can be used as a description (if it starts with
#) - Commands can include any markdown formatting
- User commands work across all projects, making them ideal for personal workflows
- Project commands are great for standardizing prompts across your team