Slash Commands

Eleven·2026년 4월 15일

Hello, Claude Code

목록 보기
2/11

요약

Slash Command는 Claude Code에서 /명령어로 호출하는 작업 단축키다. Markdown 파일 하나가 커맨드 하나가 되며, 저장 위치에 따라 프로젝트 전용과 전역으로 나뉜다. Commands와 Skills는 둘 다 Markdown 파일이지만 호출 방식이 근본적으로 다르다.


개념 정리

파일 저장 위치

Slash Command 파일은 .claude/commands/에 저장한다. (skills/가 아님에 주의)

.claude/commands/          # 프로젝트 전용 — git으로 팀 공유 가능
~/.claude/commands/        # 전역 — 내 컴퓨터의 모든 프로젝트에서 사용

팀 공유가 필요한 커맨드는 반드시 .claude/commands/에 넣어야 한다.
git clone 시 이 폴더가 자동으로 딸려오기 때문이다.
개인 습관 커맨드는 ~/.claude/commands/에 넣는다.


커맨드 파일 구조

---
name: fix
description: 이슈 번호를 받아서 버그 수정
allowed-tools: Read, Grep
disable-model-invocation: false
---

이슈 #$1 번을 수정해줘.
원인 분석 후 최소한의 코드 변경으로 해결해.

YAML 프론트매터(--- 사이)가 메타데이터이고, 그 아래 내용이 Claude에게 전달되는 프롬프트다.


인자 처리: $1, $2, $ARGUMENTS

/fix 42 high

$1          →  "42"           (첫 번째 인자)
$2          →  "high"         (두 번째 인자)
$ARGUMENTS  →  "42 high"      (전체를 통째로)

disable-model-invocation

false (기본값)  →  Claude가 상황 판단해서 자동 실행 가능
true            →  사람이 직접 타이핑해야만 실행됨

배포, DB 마이그레이션처럼 돌이킬 수 없는 작업에는 반드시 true를 설정한다.


Commands vs Skills — 핵심 차이

CommandsSkills
저장 위치.claude/commands/.claude/skills/
호출 방식내가 /명령어로 직접 호출Claude가 맥락 보고 자동 로드
예시/pr, /deploy"코드 설명해줘" → 자동 감지

오늘 실수했던 것

처음에 Slash Command 파일을 .claude/skills/에 저장한다고 생각했다.
정확한 경로는 .claude/commands/이고, skills/는 완전히 다른 개념이다.


핵심 요약 (TL;DR)

  • Slash Command 파일은 .claude/commands/에 저장한다 (skills/ 아님)
  • 팀 공유 커맨드는 .claude/commands/, 개인 전용은 ~/.claude/commands/
  • $1, $2, $ARGUMENTS로 인자를 받아 동적 프롬프트를 만든다
  • disable-model-invocation: true는 Claude 자동 실행 방지 옵션이다
  • Commands는 내가 직접 호출, Skills는 Claude가 맥락 보고 자동 로드

다음에 알아볼 것

  • Module 02: Memory (CLAUDE.md) — 세션 간 컨텍스트를 어떻게 유지하는가
  • Skills 파일 구조와 description 필드로 자동 감지가 어떻게 동작하는지
  • 내장 커맨드(/compact, /clear, /review)를 언제 써야 하는지


[Series] Claude Code Fundamentals - Slash Commands

Summary

A Slash Command is a shortcut invoked by typing /command in Claude Code. Each Markdown file becomes one command, and its scope — project-only or global — depends on where it is saved. Commands and Skills are both Markdown files, but they differ fundamentally in how they are triggered.


Key Concepts

File Storage Location

Slash Command files go in .claude/commands/. (Not skills/ — an easy mistake to make.)

.claude/commands/          # Project-only — shared with team via git
~/.claude/commands/        # Global — available across all projects on your machine

Team-shared commands must go in .claude/commands/ so they are included automatically on git clone. Personal habit commands go in ~/.claude/commands/.


Command File Structure

---
name: fix
description: Receive an issue number and fix the bug
allowed-tools: Read, Grep
disable-model-invocation: false
---

Fix issue #$1.
Analyze the root cause and resolve it with minimal code changes.

The YAML frontmatter (between ---) is metadata. Everything below it is the prompt sent to Claude.


Argument Handling: $1, $2, $ARGUMENTS

/fix 42 high

$1          →  "42"           (first argument)
$2          →  "high"         (second argument)
$ARGUMENTS  →  "42 high"      (everything at once)

disable-model-invocation

false (default)  →  Claude can auto-invoke this command when it judges fit
true             →  Only runs when a person types the command explicitly

Always set to true for irreversible operations like deployments or DB migrations.


Commands vs Skills — Core Difference

CommandsSkills
Location.claude/commands/.claude/skills/
How triggeredYou type /command directlyClaude auto-loads based on context
Example/pr, /deploy"explain this code" → auto-detected

Mistake Made Today

Initially thought Slash Command files go in .claude/skills/.
The correct path is .claude/commands/. skills/ is an entirely separate concept.


TL;DR

  • Slash Command files go in .claude/commands/ (not skills/)
  • Team commands → .claude/commands/, personal commands → ~/.claude/commands/
  • Use $1, $2, $ARGUMENTS to build dynamic prompts with arguments
  • disable-model-invocation: true prevents Claude from auto-running the command
  • Commands = you invoke explicitly; Skills = Claude loads automatically from context

0개의 댓글