Custom Commands in AI

From the Claude Code cheat sheet ยท Essential Commands ยท verified Jul 2026

Custom Commands

Create your own slash commands

markdown
# Custom command locations:
~/.claude/commands/     # User-level commands
.claude/commands/       # Project-level commands

# Example: optimize.md
---
name: optimize
description: Optimize performance
---
Find and optimize performance bottlenecks

# Example with arguments: fix-issue.md
---
name: fix-issue
description: Fix GitHub issue
---
Fix issue #$ARGUMENTS from our GitHub repo

# Use custom commands:
/optimize
/fix-issue 123
markdown
// EXAMPLE: Creating a test runner command
// File: ~/.claude/commands/test.md
---
name: test
description: Run tests for a specific file
---
Run the test suite for $ARGUMENTS and fix any failures

// Usage:
> /test auth.service.ts
๐Ÿ“Œ Commands are markdown files
๐Ÿ” Support arguments with $ARGUMENTS
๐Ÿ“Œ Project commands override user commands
customcommands

More AI tasks

Back to the full Claude Code cheat sheet