Claude Code Custom Command

๊ธฐ๋ณธ slash command

  • https://code.claude.com/docs/en/slash-commands

์ปค์Šคํ…€ slash command ๋งŒ๋“ค๊ธฐ

ํŒŒ์ผ ์œ„์น˜

  • ์ „์ฒด ์ ์šฉ : ~/.claude/commands

  • Project ๋ณ„ ์ ์šฉ : ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ์˜ .claude/commands

์ปค๋งจ๋“œ ๋งŒ๋“ค๊ธฐ

์Šฌ๋ž˜์‹œ ์ดํ›„์— ์“ธ ์ปค๋งจ๋“œ ์ด๋ฆ„์œผ๋กœ ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค.

mkdir -p ~/.claude/commands
echo "Review this code for security vulnerabilities:" > ~/.claude/commands/security-review.md

git commit message๋ฅผ ๋งŒ๋“ค์–ด์ฃผ๊ณ  commit / push

vi git-commit.md
---
title: git add, commit, push
# allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
description: Create a git commit
model: haiku
---

## git commit message๋ฅผ ๋งŒ๋“ค์–ด์ฃผ๊ณ  commit / push

git์— commitํ•  commit message๋ฅผ ๋งŒ๋“ ๋‹ค.

์ด์ œ commit ๋ฐ push๋ฅผ ํ•˜์ž.

git add --all && git commit -m "$message" && git push

$message์— ์ ๋‹นํ•œ ๋ฉ”์„ธ์ง€๋ฅผ ์ถ”๊ฐ€ํ•ด์ค˜

arguments ์‚ฌ์šฉํ•˜๊ธฐ

$ARGUMENTS ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปค๋งจ๋“œ์— ์ธ์ž๋ฅผ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋‹ค.

echo 'Fix issue #$ARGUMENTS following our coding standards' > fix-issue.md

๊ฐœ๋ณ„ arguments with $1, $2

$1, $2 ๋“ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐœ๋ณ„ ์ธ์ž์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋‹ค.

echo 'Review PR #$1 with priority $2 and assign to $3' > .claude/commands/review-pr.md

/review-pr 456 high alice

bash ์‚ฌ์šฉ

์Šฌ๋ž˜์‹œ ๋ช…๋ น์ด ์‹คํ–‰๋˜๊ธฐ ์ „์— !์ ‘๋‘์‚ฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ bash ๋ช…๋ น์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

allowed-tools ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ํ•„๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠน์ • bash ๋ช…๋ น์„ ํ—ˆ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
description: Create a git commit
---

## Context

- Current git status: !`git status`
- Current git diff (staged and unstaged changes): !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -10`

## Your task

Based on the above changes, create a single git commit.

ํŒŒ์ผ ์ฐธ์กฐ

md์—์„œ @์„ ์‚ฌ์šฉํ•ด์„œ ๊ฒฝ๋กœ๋ฅผ ์ ์œผ๋ฉด ํŒŒ์ผ์„ ์ฐธ์กฐํ• ์ˆ˜ ์žˆ๋‹ค.

# Reference a specific file

Review the implementation in @src/utils/helpers.js

# Reference multiple files

Compare @src/old-version.js with @src/new-version.js

frontmatter ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ

์†์„ฑ
์„ค๋ช…
๊ธฐ๋ณธ๊ฐ’

allowed-tools

์ปค๋งจ๋“œ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋„๊ตฌ ๋ชฉ๋ก

๋Œ€ํ™”์—์„œ ์ƒ์†

argument-hint

์Šฌ๋ž˜์‹œ ์ปค๋งจ๋“œ์— ๋Œ€ํ•œ ์ธ์ž ํžŒํŠธ. ์˜ˆ: argument-hint: add [tagId] | remove [tagId] | list. ์‚ฌ์šฉ์ž๊ฐ€ ์Šฌ๋ž˜์‹œ ์ปค๋งจ๋“œ๋ฅผ ์ž๋™์™„์„ฑํ•  ๋•Œ ํ‘œ์‹œ๋จ

None

description

์ปค๋งจ๋“œ์— ๋Œ€ํ•œ ๊ฐ„๋‹จํ•œ ์„ค๋ช…

prompt์˜ ์ฒซ ๋ฒˆ์งธ ์ค„์„ ์‚ฌ์šฉ

model

ํŠน์ • ๋ชจ๋ธ ๋ฌธ์ž์—ด (Models overview ์ฐธ์กฐ)

๋Œ€ํ™”์—์„œ ์ƒ์†

disable-model-invocation

SlashCommand ๋„๊ตฌ๊ฐ€ ์ด ์ปค๋งจ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ• ์ง€ ์—ฌ๋ถ€

false

---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
argument-hint: [message]
description: Create a git commit
model: haiku
---

Create a git commit with message: $ARGUMENTS

Example using positional arguments:

---
argument-hint: [pr-number] [priority] [assignee]
description: Review pull request
---

Review PR #$1 with priority $2 and assign to $3.
Focus on security, performance, and code style.

์‚ฌ์šฉ

/command-name arg1 arg2

mcp๋ฅผ slash command๋กœ ์‚ฌ์šฉํ•˜๊ธฐ

/mcp__<server-name>__<prompt-name> [arguments]

๋ณดํ†ต ์ž๋™์œผ๋กœ ์‹คํ–‰๋จ.

์˜ˆ์‹œ

# ์ธ์ˆ˜ ์—†์Œ
> /mcp__github__list_prs

# ์ธ์ˆ˜ ํฌํ•จ
> /mcp__github__pr_review 456
> /mcp__jira__create_issue "Bug title" high

์ž๋™ํ™”

claude๊ฐ€ ์ž๋™์œผ๋กœ slash command๋ฅผ ์‹คํ–‰ํ• ์ˆ˜ ์žˆ๋‹ค.

๋‹ค์Œ์ฒ˜๋Ÿผ prompt๋ฅผ ์ž‘์„ฑํ•ด๋ผ

Claude๊ฐ€ SlashCommand ๋„๊ตฌ๋ฅผ ํŠธ๋ฆฌ๊ฑฐํ•˜๋„๋ก ๊ถŒ์žฅํ•˜๋ ค๋ฉด ์ง€์นจ (prompt, CLAUDE.md ๋“ฑ)์ด ์ผ๋ฐ˜์ ์œผ๋กœ ์Šฌ๋ž˜์‹œ์™€ ํ•จ๊ป˜ ๋ช…๋ น์–ด ์ด๋ฆ„์„ ์ฐธ์กฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

claude๊ฐ€ ์ž๋™์œผ๋กœ ํ˜ธ์ถœํ•˜๋Š”๊ฒƒ์„ ๋ง‰์œผ๋ ค๋ฉด

---

title: test
disable-model-invocation: true

์ด๋ ‡๊ฒŒ ์‚ฌ์šฉํ•œ๋‹ค.

slash command vs skills

์Šฌ๋ž˜์‹œ ๋ช…๋ น์–ด (Slash Commands)

์‚ฌ์šฉ ๋Œ€์ƒ: ๋น ๋ฅด๊ณ  ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ํ”„๋กฌํ”„ํŠธ

ํŠน์ง•:

  • ๊ฐ„๋‹จํ•œ ํ”„๋กฌํ”„ํŠธ ์Šค๋‹ˆํŽซ

  • ๋น ๋ฅธ ๋ฏธ๋ฆฌ ์•Œ๋ฆผ ๋˜๋Š” ํ…œํ”Œ๋ฆฟ

  • ํ•œ ํŒŒ์ผ์— ๋งž๋Š” ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ์ง€์นจ

์˜ˆ์‹œ:

  • /review โ†’ "Review this code for bugs and suggest improvements"

  • /explain โ†’ "Explain this code in simple terms"

  • /optimize โ†’ "Analyze this code for performance issues"

์Šคํ‚ฌ (Skills)

์‚ฌ์šฉ ๋Œ€์ƒ: ๊ตฌ์กฐ๊ฐ€ ์žˆ๋Š” ํฌ๊ด„์ ์ธ ๊ธฐ๋Šฅ

ํŠน์ง•:

  • ์—ฌ๋Ÿฌ ๋‹จ๊ณ„๊ฐ€ ์žˆ๋Š” ๋ณต์žกํ•œ ์›Œํฌํ”Œ๋กœ์šฐ

  • ์Šคํฌ๋ฆฝํŠธ ๋˜๋Š” ์œ ํ‹ธ๋ฆฌํ‹ฐ๊ฐ€ ํ•„์š”ํ•œ ๊ธฐ๋Šฅ

  • ์—ฌ๋Ÿฌ ํŒŒ์ผ์— ๊ฑธ์ณ ๊ตฌ์„ฑ๋œ ์ง€์‹

  • ํ‘œ์ค€ํ™”ํ•˜๋ ค๋Š” ํŒ€ ์›Œํฌํ”Œ๋กœ์šฐ

์˜ˆ์‹œ:

  • ์–‘์‹ ์ž‘์„ฑ ์Šคํฌ๋ฆฝํŠธ ๋ฐ ๊ฒ€์ฆ์ด ์žˆ๋Š” PDF ์ฒ˜๋ฆฌ ์Šคํ‚ฌ

  • ๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐ ์œ ํ˜•์— ๋Œ€ํ•œ ์ฐธ์กฐ ๋ฌธ์„œ๊ฐ€ ์žˆ๋Š” ๋ฐ์ดํ„ฐ ๋ถ„์„ ์Šคํ‚ฌ

  • ์Šคํƒ€์ผ ๊ฐ€์ด๋“œ ๋ฐ ํ…œํ”Œ๋ฆฟ์ด ์žˆ๋Š” ๋ฌธ์„œ ์Šคํ‚ฌ

์ฃผ์š” ์ฐจ์ด์ 

์ธก๋ฉด
์Šฌ๋ž˜์‹œ ๋ช…๋ น์–ด
์—์ด์ „ํŠธ ์Šคํ‚ฌ

๋ณต์žก์„ฑ

๊ฐ„๋‹จํ•œ ํ”„๋กฌํ”„ํŠธ

๋ณต์žกํ•œ ๊ธฐ๋Šฅ

๊ตฌ์กฐ

๋‹จ์ผ .md ํŒŒ์ผ

SKILL.md + ๋ฆฌ์†Œ์Šค๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ

๋ฐœ๊ฒฌ

๋ช…์‹œ์  ํ˜ธ์ถœ (/command)

์ž๋™ (์ปจํ…์ŠคํŠธ ๊ธฐ๋ฐ˜)

ํŒŒ์ผ

ํ•œ ํŒŒ์ผ๋งŒ

์—ฌ๋Ÿฌ ํŒŒ์ผ, ์Šคํฌ๋ฆฝํŠธ, ํ…œํ”Œ๋ฆฟ

์˜ˆ์ œ ๋น„๊ต

์Šฌ๋ž˜์‹œ ๋ช…๋ น์–ด๋กœ

ํŒŒ์ผ ๊ตฌ์กฐ:

.claude/commands/review.md

๋‚ด์šฉ:

Review this code for:

- Security vulnerabilities
- Performance issues
- Code style violations

์‚ฌ์šฉ๋ฒ•: /review (์ˆ˜๋™ ํ˜ธ์ถœ)

skill

ํŒŒ์ผ ๊ตฌ์กฐ:

.claude/skills/code-review/
โ”œโ”€โ”€ SKILL.md (overview and workflows)
โ”œโ”€โ”€ SECURITY.md (security checklist)
โ”œโ”€โ”€ PERFORMANCE.md (performance patterns)
โ”œโ”€โ”€ STYLE.md (style guide reference)
โ””โ”€โ”€ scripts/
    โ””โ”€โ”€ run-linters.sh

์‚ฌ์šฉ๋ฒ•: "Can you review this code?" (์ž๋™ ๋ฐœ๊ฒฌ)

๊ฒฐ๋ก : ์Šคํ‚ฌ์€ ๋” ํ’๋ถ€ํ•œ ์ปจํ…์ŠคํŠธ, ๊ฒ€์ฆ ์Šคํฌ๋ฆฝํŠธ ๋ฐ ๊ตฌ์„ฑ๋œ ์ฐธ์กฐ ์ž๋ฃŒ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๋‚˜์˜ ๊ฒฐ๋ก 

๋‚˜๋Š” ์•„์ง ์ž˜ ๊ตฌ๋ถ„์ด ์•ˆ๋จ. /command๋Š” ํ•ญ์ƒ ๋‚ด๊ฐ€ ํ•„์š”ํ• ๋•Œ ๊ฐ•์ œ๋กœ ์š”์ฒญ claude๊ฐ€ ์ž๋™์œผ๋กœ ์ด๊ฑธ ์‚ฌ์šฉํ•˜๋ฉด skills์™€ ๋น„์Šทํ•œ๊ฑฐ๊ฐ™์Œ.

๋‘˜๋‹ค ๋น„์Šทํ•œ๊ฑฐ๊ฐ™์Œ.

Last updated

Was this helpful?