Skip to main content

Claude Code: Custom Slash Commands

ยท 2 min read
Craig P. Motlin
Software Engineer

Utility commands I use with Claude Code for code maintenance and cleanup.

This post is part of my Claude Code setup series.

Emojiโ€‹

This command adds emoji!

.claude-prompts/commands/emoji.md
---
argument-hint: file or content to enhance
description: Add appropriate emoji to make content more engaging
model: haiku
---

Add emoji to the content we're working on to make it easier to scan.

$ARGUMENTS

Put emoji at the start of headers, in lists and navigation elements, and in code comments.

Pick the best-fitting emoji for each element, then make a second pass replacing duplicates with suitable alternatives.

Keep usage consistent: match the content's tone (๐ŸŽ‰ celebrations, ๐Ÿ”ง technical, ๐Ÿ“š documentation), use status indicators (โœ… complete, โณ in progress, โŒ error, โš ๏ธ warning), and reuse one emoji per recurring label (๐Ÿ“ Notes, ๐Ÿ”— Links).

View on GitHub

Usage Patternsโ€‹

The /emoji command follows consistent patterns and avoids duplicates by using a two-pass approach to ensure variety and appropriateness.

Conflictsโ€‹

This command systematically resolves merge conflicts during git rebases.

.claude-prompts/commands/conflicts.md
---
name: conflicts
description: Resolve git merge or rebase conflicts and continue the operation. Use when a rebase, merge, or cherry-pick stops on conflicted files.
---

# Conflicts

Use the `code:cli` skill.

Run `git status` to see the operation in progress and the conflicted files. Resolve each file by keeping the correct side or combining both, and remove every conflict marker, then stage them with `git add <resolved-files>`.

Continue the operation that is actually in progress. `git rev-parse --git-path <name>` resolves each marker correctly inside worktrees:

| Marker present | Operation | Continue with |
| ---------------------------------- | ----------- | ---------------------------- |
| `rebase-merge/` or `rebase-apply/` | rebase | `git rebase --continue` |
| `MERGE_HEAD` | merge | `git merge --continue` |
| `CHERRY_PICK_HEAD` | cherry-pick | `git cherry-pick --continue` |
| `REVERT_HEAD` | revert | `git revert --continue` |

Check the rebase markers first; they take precedence over any other marker a stopped rebase leaves behind. When `--continue` would open an editor, prefix it with `GIT_EDITOR=true` to keep the default message.

If the operation stops on more conflicts, repeat.

Finish by checking `git status` and recent commit history to confirm the operation completed.

View on GitHub

Conflict Resolution Strategyโ€‹

The /conflicts command follows a structured approach to understand and fix each conflict, ensuring the rebase completes successfully without missing any issues.

Next Stepsโ€‹

These utility commands complement the main development workflow and work best with proper Claude Code configuration.

For more custom command examples and their implementations, check out the claude-code-plugins repository.