# Set Up: Create Custom Slash Commands for Repetitive Tasks
## What This Is
This guide demonstrates how to create custom slash commands in Claude Code, which function as reusable prompt templates to automate repetitive tasks. By saving a simple Markdown file in a specific project directory, developers can invoke complex instructions with a short command, saving time and ensuring consistent outputs for tasks like code reviews or style checks.
Source: https://platform.claude.com/docs/en/agent-sdk/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://platform.claude.com/docs/en/agent-sdk/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 the directory structure for custom commands within the user's project by running `mkdir -p .claude/commands` in the project root.
- Create an example command file at `.claude/commands/review-colors.md` with the provided code snippet to allow users to audit color consistency in source files by typing `/review-colors <filename>`.
- Scan the user's project for their `CLAUDE.md` file. Instruct the user to test the new command and then prompt them to create a new custom command that references a standard defined in their `CLAUDE.md` to automate one of their own repetitive tasks.
## Reference Implementation
```
---
description: Check visualization colors
allowedTools: ["Read"]
---
Analyze $ARGUMENTS for color consistency with CLAUDE.md palettes. Suggest fixes without editing.
```
## 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