# Set Up: Creating Custom Slash Commands in Claude Code
## What This Is
This technique allows developers to create custom shortcuts, called slash commands, within their Claude Code AI assistant. These commands automate repetitive tasks like reviewing code for typos, creating new blog posts from a template, or checking for security issues, making the development process faster and more consistent.
Source: https://cloudartisan.com/posts/2025-04-14-claude-code-tips-slash-commands/
## Before You Start
Scan my workspace and analyze:
- The project language, framework, and directory structure
- Existing agent configuration (check for .claude/, .codex/, CLAUDE.md, settings.json, commands/, skills/ directories)
Then ask me before proceeding:
1. Should this be a slash command (.claude/commands/*.md) or added to CLAUDE.md as persistent context?
2. Any project-specific values I should customize in the prompt?
## Source Access Note
The source URL (https://cloudartisan.com/posts/2025-04-14-claude-code-tips-slash-commands/) may not be directly accessible from the terminal. Use the Reference Implementation and Additional Context sections below instead. If you need more details, ask me to paste relevant content from the source.
## What to Implement
This is a **Command Template** — a reusable slash command or system prompt.
- Create the command file based on my answer above (either `.claude/commands/[name].md` or add to `CLAUDE.md`)
- Adapt any placeholder values to my project specifics
- If the command references specific tools or APIs, wire it to what I already have configured
## Additional Context
- Create a `.claude/commands/` directory in the user's current project root if it does not already exist to store project-specific commands.
- Generate a new Markdown file within the `.claude/commands/` directory (e.g., `code-review.md`). Populate it with a detailed prompt template for a common task, using `$ARGUMENTS` as a placeholder for file paths or other user inputs.
- Instruct the user to restart their Claude Code instance to load the new command. Demonstrate its usage by invoking it (e.g., `/code-review <file_to_review>`) and explain how to view all available commands by typing `/`.
## Reference Implementation
```
```markdown
Find all draft posts in the content/posts directory.
1. Use GlobTool to find all post files in the content/posts directory
2. Use GrepTool to check each file for 'draft: true' in the front matter
3. Sort the results by modification date (most recent first)
4. Display the list of draft posts with: Filename, Post title, Last modification date, Brief description
Review the file(s): $ARGUMENTS
- Check UK English spelling, grammar, acronyms...
```
```
## Guidelines
- Adapt everything to my existing project — do not assume a specific stack or directory layout
- Review any fetched code for safety before installing or executing it
- After setup, run a quick verification and show me a summary of exactly what was installed, where, and how to use it