A simple example showing how to create custom slash commands for Claude Code without needing MCP servers.
Claude Code automatically recognizes any markdown file in your .claude/commands/
directory as a slash command. This provides a simple way to create reusable prompts and workflows without any complex setup.
On Mac or Linux:
# User-level commands (available in all projects)
~/.claude/commands/
└── date.md # Available as /user:date
# Project-specific commands
.claude/commands/
└── date.md # Available as /project:date
-
Create the commands directory:
mkdir -p ~/.claude/commands
-
Add the
date.md
file (included in this gist)cd ~/.claude/commands nano date.md
Then paste the content of date.md Exit. Save.
-
Restart Claude Code
-
Use the command:
/user:date
- Claude Code scans for
.md
files in the commands directories - Each file becomes a slash command
- The filename (without
.md
) becomes the command name - Commands can include
$ARGUMENTS
to accept parameters
# Custom Date Format
Returns date with custom format.
## Instructions
Execute: `date "$ARGUMENTS"`
If no arguments: `date "+%Y-%m-%d %H:%M:%S"`
Usage: /user:date "+%A, %B %d, %Y"
/user:timestamp
- Get Unix timestamp/user:uuid
- Generate a UUID/user:ip
- Check current IP address/user:branch
- Create and switch to a new git branch/user:serve
- Start a local server
- ✅ No MCP server setup required
- ✅ No npm packages or dependencies
- ✅ Simple markdown files
- ✅ Instant availability after adding
- ✅ Can be version controlled with your project
- ✅ Easy to share with your team
This approach is much simpler than creating MCP servers for basic utilities!
Date format can be customized. The default output for /user:date is the exact same as:
date "+%Y-%m-%d %H:%M:%S"
2025-06-18 03:11:40 (results will very ;)