팟캐스트로 돌아가기Claude
Claude Code subagents
효과적인 서브에이전트 설계하기
Now that you know how to create sub aents, let's look at patterns that lead to effective sub aents.
서브에이전트 생성 방법을 알았으니 효과적인 서브에이전트를 만드는 패턴을 살펴보겠습니다.
First, let's get a better idea of how subit data in the sub aent config file is used.
먼저 서브에이전트 config 파일의 데이터가 어떻게 사용되는지 이해해 봅시다.
Whenever you send a message to the main context window agent, the name and description of each sub aent is included in the system prompt.
메인 에이전트에 메시지를 보낼 때마다 각 서브에이전트의 이름과 설명이 시스템 프롬프트에 포함됩니다.
So, if you want to better control when the main agent launches a sub agent automatically, you should modify the name and description.
메인 에이전트가 서브에이전트를 자동으로 실행하는 시점을 더 잘 제어하려면 이름과 설명을 수정하세요.
Next, remember that when a sub agent is launched, the main agent writes an input prompt.
서브에이전트가 실행될 때 메인 에이전트가 입력 프롬프트를 작성한다는 점도 기억하세요.
When writing this input prompt, it uses the description as guidance.
입력 프롬프트 작성 시 설명을 참고로 사용합니다.
So, if you want to better control when the main agent launches a sub agent automatically, you should modify the name and description.
메인 에이전트가 서브에이전트를 자동으로 실행하는 시점을 더 잘 제어하려면 이름과 설명을 수정하세요.
Let's consider our review sub aent again.
리뷰 서브에이전트를 다시 살펴봅시다.
Right now, when the main agent runs this sub agent, the sub aent is given an input prompt telling it to use get diff to find the current changes.
현재 메인 에이전트가 이 서브에이전트를 실행하면 git diff로 현재 변경사항을 찾으라는 입력 프롬프트가 전달됩니다.
If we wanted the main agent to more reliably tell the sub agent exactly which files to review, we would update the description.
메인 에이전트가 서브에이전트에게 검토할 파일을 더 정확히 알려주게 하려면 설명을 업데이트해야 합니다.
You must tell the agent precisely which files you want it to review.
검토를 원하는 파일을 에이전트에게 정확히 명시해야 합니다.
Now, if we ask claw to run the code reviewer agent, we'll see a different input.
이제 Claude에 code reviewer 에이전트 실행을 요청하면 다른 입력이 보입니다.
You can also influence what the main thread tells a sub agent through the description.
설명을 통해 메인 스레드가 서브에이전트에게 전달하는 내용도 영향을 줄 수 있습니다.
So adding return sources that can be cited to a web search sub aents description causes the main thread to include that instruction when delegating the task.
웹 검색 서브에이전트 설명에 '인용 가능한 출처를 반환하라'를 추가하면 메인 스레드가 작업을 위임할 때 해당 지시도 포함합니다.
The most important improvement that you can make is defining an output format in the system prompt.
가장 중요한 개선은 시스템 프롬프트에 출력 형식을 정의하는 것입니다.
This creates natural stopping points for the sub aent.
이를 통해 서브에이전트에 자연스러운 종료 시점이 생깁니다.
Without a defined output format, sub aents struggle to decide when enough research has been done and they tend to run much much longer than sub agents that are given an output format.
출력 형식이 없으면 서브에이전트는 연구가 충분한지 판단하지 못해 출력 형식이 있는 서브에이전트보다 훨씬 오래 실행됩니다.
When a sub agent discovers a workaround to some issue like solving a dependency issue or finding that a certain command needs particular flags, these details should appear in the summary.
서브에이전트가 의존성 문제 해결이나 특정 명령에 특수 플래그가 필요하다는 사실 등 해결책을 발견하면 그 내용이 요약에 포함되어야 합니다.
Otherwise, the main thread has to rediscover the same solutions, obstacles encountered, any setup issues, workarounds discovered or environment quirks, commands that needed special flags or configuration, dependencies or imports that cause problems.
그렇지 않으면 메인 스레드가 같은 해결책을 다시 찾아야 합니다. 만났던 장애물, 설정 문제, 발견한 우회 방법, 환경 특이사항, 특수 플래그가 필요한 명령, 문제를 일으킨 의존성이나 import 등을 포함해서요.
Explicitly asking for obstacle reporting in the output format surfaces this information.
출력 형식에 장애물 보고를 명시적으로 요청하면 이 정보가 표면에 드러납니다.
A readonly sub aent using just glob grap read cannot accidentally modify files.
glob, grep, read만 사용하는 read-only 서브에이전트는 실수로 파일을 수정할 수 없습니다.
This constraint clarifies that the sub aents role and prevents unintended side effects.
이 제약이 서브에이전트의 역할을 명확히 하고 의도치 않은 부작용을 방지합니다.
So think about what sub aents actually needs to do.
서브에이전트가 실제로 무엇을 해야 하는지 생각해 보세요.
If it's just researching it only needs to read files.
단순히 조사만 한다면 파일 읽기만 필요합니다.
So keep it read only.
그러면 read-only로 유지하세요.
That way it can't accidentally modify anything while exploring.
그러면 탐색 중에 실수로 아무것도 수정할 수 없습니다.
A reviewer needs to run get diff to see what changed.
리뷰어는 변경 내용을 보기 위해 git diff를 실행해야 합니다.
So give it bash access, but it still doesn't need to edit files.
bash 접근권을 주되 파일 편집은 여전히 불필요합니다.
Only give edit and write to sub aents that should actually change your code, like a styling agent applying CSS updates.
edit과 write는 CSS 업데이트를 적용하는 styling 에이전트처럼 실제로 코드를 변경해야 하는 서브에이전트에게만 주세요.
This also helps clarify what each sub aent is for when you have several of them.
서브에이전트가 여러 개일 때 각 서브에이전트가 무엇을 위한 것인지 명확히 하는 데도 도움이 됩니다.
So effective sub aents use structured output report obstacles have specific descriptions and limit tool access.
효과적인 서브에이전트는 구조화된 출력을 사용하고, 장애물을 보고하며, 구체적인 설명을 갖고, 도구 접근을 제한합니다.