code-review
Use when asked to review code, audit a file for bugs, check code quality, or suggest improvements. Provides a structured review…
Use when building a new agent harness, designing tool systems, or structuring multi-agent workflows. Provides patterns, templates, and decision trees for harness engineering.
$ npx -y skills add FareedKhan-dev/claude-code-from-scratch --skill agent-builder --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/agent-builderContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when building a new agent harness, designing tool systems, or structuring multi-agent workflows. Provides patterns, templates, and decision trees for harness engineering.
name: agent-builder description: Use when building a new agent harness, designing tool systems, or structuring multi-agent workflows. Provides patterns, templates, and decision trees for harness engineering.
Load this skill when the user wants to:
The agent is always the model. Your job is the harness.
Harness = Tools + Knowledge + Observation + Action + Permissions
Never try to encode intelligence in your harness code. Give the model clean tools, clear context, and get out of the way.
from anthropic import Anthropic
client = Anthropic()
def agent_loop(messages, tools, dispatch, system):
while True:
response = client.messages.create(
model="claude-sonnet-4-20250514",
system=system, messages=messages,
tools=tools, max_tokens=8000,
)
messages.append({"role": "assistant", "content": response.content})
if response.stop_reason != "tool_use":
return
results = []
for block in response.content:
if block.type == "tool_use":
output = dispatch[block.name](block.input)
results.append({"type": "tool_result",
"tool_use_id": block.id, "content": output})
messages.append({"role": "user", "content": results})Do not add anything until you need it. Every mechanism should earn its place.
Before writing a tool, ask:
"[Action verb] [what it does]. Use when [specific situation]. [What it returns]. [Any important limits]."
Example:
"Read a file and return numbered lines. Use when you need to inspect file content or reference specific line numbers. Returns up to 50,000 characters. Use start_line/end_line for large files."
One task, one user, no persistence needed?
→ s01: minimal loop + bash
Need file read/write/search?
→ s02: extended tool dispatch
Need the agent to plan before acting?
→ s03: add todo_write tool
Task too big for one context window?
→ s04: subagent isolation
Need domain-specific knowledge?
→ s05: skill loading
Long-running session, context will overflow?
→ s06: compression + memory file
Complex multi-step project spanning sessions?
→ s07: task graph with dependencies
Slow operations (builds, tests)?
→ s08: background tasks
Work that parallelises across specialties?
→ s09+: agent teams with mailboxes
Need isolation between parallel tasks?
→ s12/s23: git worktrees**Putting logic in the harness instead of trusting the model** Bad: `if "error" in output: retry_with_different_approach()` Good: return the error to the model and let it decide
**Giant system prompts** Bad: 5,000-word system prompt covering every scenario Good: load domain knowledge on-demand via skills (s05)
**Blocking the loop on slow operations** Bad: `output = subprocess.run("npm test", timeout=300)` Good: run in background thread, notify when done (s08)
**Shared mutable state between subagents** Bad: subagents writing to the same dict/file without locks Good: each subagent has its own isolated context (s04, s12)
def spawn_subagent(prompt: str, tools=EXTENDED_TOOLS, dispatch=EXTENDED_DISPATCH) -> str:
messages = [{"role": "user", "content": prompt}]
while True:
response = client.messages.create(
model=MODEL, system=SUBAGENT_SYSTEM,
messages=messages, tools=tools, max_tokens=8000,
)
messages.append({"role": "assistant", "content": response.content})
if response.stop_reason != "tool_use":
break
results = dispatch_tools(response.content, dispatch)
messages.append({"role": "user", "content": results})
return "".join(b.text for b in messages[-1]["content"] if hasattr(b, "text"))Use when asked to review code, audit a file for bugs, check code quality, or suggest improvements. Provides a structured review…
Use when working with PDF files — reading, extracting text or tables, merging, splitting, or filling forms. Provides correct…