C.W.K.
Stream
Lesson 07 of 13 · published

Custom Subagent 와 /agents

~18 min · subagents, agents, delegation, context-isolation

Level 0🌱 입문자
0 XP0/70 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

자기 context 가진 전문 에이전트

Subagent 는 자기만의 context window, 도구 allowlist, system prompt 를 가진 worker. parent Claude 가 scoped 작업 위임하고, subagent 가 격리된 채로 일하고, parent 는 자기 context 오염 안 시키며 결과 받아. 메인 세션 budget 안 날리고 큰 일 처리하는 방식.

Built-in 셋이 박스에서 출하: Explore (빠르고, read-only, Haiku 에서 동작 — "이 repo 에서 X 가 어디 정의됐어?" 에 적합), Plan (Sonnet/Opus, context 모으고 코드 건드리기 전에 implementation plan 생성), General-purpose (풀 도구, 병렬 implementation 작업에 사용).

커스텀 subagent 는 YAML frontmatter 가진 markdown 파일 — Skill 이랑 같은 모양인데 자기 설정 노브 가짐: tools: allowlist, tool_denylist:, model: override, memory: 항상 로드되는 context, worktree: true filesystem 격리. .claude/agents/ (project), ~/.claude/agents/ (user), 또는 launch 시 --agents JSON 으로. /agents 가 인터랙티브 매니저.

Code

A read-only security agent·markdown
---
name: security-reviewer
description: >
  Security code review. Auto-delegated when reviewing auth,
  payments, or data-handling code. Reads only, never edits.
model: claude-opus-4-7
tools:
  - Read
  - Grep
  - Glob
  - Bash(grep *)
  - Bash(find *)
  - WebFetch(domain:owasp.org)
tool_denylist:
  - Edit
  - Write
  - Bash(git *)
memory: |
  Audit-only. Never modify files. Always cite the CWE class
  for each finding. OWASP Top 10 is the floor, not the ceiling.
worktree: false
---

You are a senior application security engineer. Produce:
1. Executive summary (1 paragraph)
2. Critical findings (CVSS ≥ 7.0)
3. Medium findings (CVSS 4.0–6.9)
4. Low / informational
5. Remediation priority matrix
Parallel team for a refactor·bash
# In an interactive session
"Refactor the entire payment module:
 - Spawn the security-reviewer to audit the current code
 - Spawn db-migration-agent to update the Prisma schema
 - Spawn a general-purpose agent for the API layer
 Work in parallel, then consolidate."

# Each subagent runs with its own context window in its own worktree
# Parent Claude gets summaries back and orchestrates

External links

Exercise

반복 작업 위한 커스텀 subagent 정의 (security review, perf audit, doc-writer, 리팩토링 전문가). tools 빡빡하게 설정, 진짜 memory: 블록 작성. parent 세션에서 돌려서 context 격리 동작 보기.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.