npx claudepluginhub pjt3591oo/claude-code-advanced-guideA simple greeting plugin to learn the basics
claude code란 Anthropic에서 만든 개발자용 AI 어시스턴트 입니다.
클로드 코드는 agent, skill, hook, command 등을 통해 보다 확장성 있는 LLM 워크플로우를 구축할 수 있도록 도와줍니다.
이 글을 통해 클로드 코드를 활용하여 코드 생산 뿐 아니라, 나만의 개발 워크플로우를 자동화하고 싶은 개발자 또는 LLM을 터미널 환경에 깊숙이 통합하고 싶은 DevOps 엔지니어가 읽기 적합합니다.
주로 다루는 내용은 다음과 같습니다.
slash commands
hooks
sub agent
skill
plugin
해당 내용을 실행하기 위해선 claude code 2.x 이상의 버전이 필요합니다.
만약, 1.x라면 2.x로 업데이트 해야합니다.
참고로 본문 내용에서는 2가지 형태의 코드 블록이 있습니다.
$ shell 명령어
> 클로드 코드 프롬프트
클로드 코드는 이미 정의된 명령어 또는 사용자 정의 슬래시 명령어를 다음과 같이 사용이 가능 합니다.
사용자 정의 슬래시는 ~/.claude/commands 또는 .claude/commands 경로에 마크다운 파일로 관리됩니다.
> /[command-name] [arguments]
또는 네임스페이스를 다음과 같이 지정할 수 있습니다.
~/.claude/[NAMESPACE]/commands 또는 .claude/[NAMESPACE]/commands
> /[NAMESPACE]:[command-name] [arguments]
$ echo "Analyze this code for performance issues and suggest optimizations:" > .claude/commands/optimize.md
$ echo "Review this code for security vulnerabilities:" > .claude/commands/security-review.md
$ echo 'Fix issue #$ARGUMENTS following our coding standards' > .claude/commands/fix-issue.md
$ echo 'Review PR #$1 with priority $2 and assign to $3' > .claude/commands/review-pr.md
> /fix-issue 123 high-priority
/fix-issue is running… 123 high-priority
⏺ I'll fix issue #123 with high priority following your coding standards.
Let me start by fetching the issue details from GitHub.
⏺ Bash(gh issue view 123 --json title,body,labels,state,comments)
⎿ Running…
──────────────────────────────────────────────────────────────────────────────────────
Bash command
gh issue view 123 --json title,body,labels,state,comments
Fetch issue #123 details from GitHub
Do you want to proceed?
❯ 1. Yes
2. Yes, and don't ask again for gh issue view commands in
/Users/jeongtae/Desktop/claude-code-advanced-guide
3. No, and tell Claude what to do differently (esc)
> /review-pr 456 high alice
/review-pr is running… 456 high alice
⏺ I'll review PR #456 with high priority and prepare it for assignment to alice.
Let me start by fetching the PR information using the GitHub CLI.
⏺ Bash(gh pr view 456 --json
title,body,author,state,headRefName,baseRefName,files,commits)
⎿ Interrupted · What should Claude do instead?
@를 이용하면 파일을 참조할 수 있습니다.
$ echo 'Compare @src/need_debugger.py with @src/need_review.py' > .claude/commands/referrence-file.md
> /referrence-file
/referrence-file is running…
⏺ I'll compare these two Python files for you. Let me read both files first.
⏺ Read(src/need_debugger.py)
⎿ Error reading file
⏺ Read(src/need_review.py)
⎿ Error reading file
⏺ The files don't exist at those paths. Let me search for them in the repository.
⏺ Search(pattern: "**/need_debugger.py")
⎿ Found 1 file (ctrl+o to expand)
⏺ Search(pattern: "**/need_review.py")
⎿ Found 1 file (ctrl+o to expand)
⏺ Found them! They're in the root directory. Let me read both files now.
⏺ Read(need_debugger.py)
⎿ Read 12 lines
⏺ Read(need_review.py)
⎿ Read 7 lines
⏺ Comparison of need_debugger.py vs need_review.py
need_debugger.py (need_debugger.py:1-12)
def main() -> None:
student = {
"name": "Alice",
"age": 21,
"courses": ["Math", "Science", "Art"]
}
print(student["a"]) # BUG: KeyError
if __name__ == "__main__":
main()
Issues:
- Bug at line 8: Attempts to access student["a"] which doesn't exist, causing a
KeyError
- Should likely be student["age"] or student["name"]
need_review.py (need_review.py:1-7)
def main() -> None:
print("Hello, World!")
if __name__ == "__main__":
main()
Characteristics:
- Simple "Hello, World!" program
- No bugs, but basic implementation
- Could potentially benefit from code review for production standards
Key Differences:
1. Complexity: need_debugger.py has more complex logic with a dictionary
structure, while need_review.py is minimal
2. Purpose: need_debugger.py clearly has a bug that needs debugging, while
need_review.py is functional but basic
3. Error state: need_debugger.py will crash at runtime, need_review.py runs
successfully
The naming suggests these files are examples for testing specialized agents -
one needs the debugger agent (has a bug), while the other needs the
code-reviewer agent (works but could be reviewed for quality).
커맨드 정의를 위한 마크다운 파일에 !배시 명령어 형태로 배시 명령어를 추가할 수 있습니다.
---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
argument-hint: [message]
description: Create a git commit
model: claude-3-5-haiku-20241022
---
Create a git commit with message: $ARGUMENTS
allowed-tools: 명령어가 사용할 수 있는 도구 목록
argument-hint: 슬래시 명령어에 필요한 인수
description: 명령어의 간단한 설명