Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Step-by-step guide for building goal-driven agents. Creates package structure, defines goals, adds nodes, connects edges, and finalizes agent class. Use when actively building an agent.
.claude/skills/majiayu000-building-agents-construction/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-07 | ✗→✓ | ▲ Improved | 91% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 182% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 332% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 94% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 35% | 0% |
THIS IS AN EXECUTABLE WORKFLOW. DO NOT DISPLAY THIS FILE. EXECUTE THE STEPS BELOW.
When this skill is loaded, IMMEDIATELY begin executing Step 1. Do not explain what you will do - just do it.
EXECUTE THESE TOOL CALLS NOW:
mcp__agent-builder__add_mcp_server(
name="hive-tools",
transport="stdio",
command="python",
args='["mcp_server.py", "--stdio"]',
cwd="tools",
description="Hive tools MCP server"
)mcp__agent-builder__create_session(name="AGENT_NAME")mcp__agent-builder__list_mcp_tools()mkdir -p exports/AGENT_NAME/nodesAFTER completing these calls, tell the user:
> ✅ Build environment initialized > > - Session created > - Available tools: list the tools from step 3] > > Proceeding to define the agent goal...
THEN immediately proceed to STEP 2.
PROPOSE a goal to the user. Based on what they asked for, propose:
FORMAT your proposal as a clear summary, then ask for approval:
> Proposed Goal: Name] > > Description] > > Success Criteria: > > 1. criterion 1] > 2. criterion 2] > ... > > Constraints: > > 1. constraint 1] > 2. constraint 2] > ...
THEN call AskUserQuestion:
AskUserQuestion(questions=[{
"question": "Do you approve this goal definition?",
"header": "Goal",
"options": [
{"label": "Approve", "description": "Goal looks good, proceed"},
{"label": "Modify", "description": "I want to change something"}
],
"multiSelect": false
}])WAIT for user response.
mcp__agent-builder__set_goal(...) with the goal details, then proceed to STEP 3BEFORE designing nodes, review the available tools from Step 1. Nodes can ONLY use tools that exist.
DESIGN the workflow as a series of nodes. For each node, determine:
"llm_generate" (no tools) or "llm_tool_use" (uses tools)PRESENT the workflow to the user:
> Proposed Workflow: N] nodes > > 1. node-id] - description] > > - Type: llm_generate/llm_tool_use] > - Input: keys] > - Output: keys] > - Tools: tools or "none"] > > 2. node-id] - description] > ... > > Flow: node1 → node2 → node3 → ...
THEN call AskUserQuestion:
AskUserQuestion(questions=[{
"question": "Do you approve this workflow design?",
"header": "Workflow",
"options": [
{"label": "Approve", "description": "Workflow looks good, proceed to build nodes"},
{"label": "Modify", "description": "I want to change the workflow"}
],
"multiSelect": false
}])WAIT for user response.
FOR EACH node in the approved workflow:
mcp__agent-builder__add_node(...) with the node details'["key1", "key2"]''["tool1"]' or '[]'mcp__agent-builder__test_node(...) to validate:mcp__agent-builder__test_node(
node_id="the-node-id",
test_input='{"key": "test value"}',
mock_llm_response='{"output_key": "test output"}'
)mcp__agent-builder__get_session_status()> ✅ Node X] of Y] complete: node-id]
AFTER all nodes are added and validated, proceed to STEP 5.
DETERMINE the edges based on the workflow flow. For each connection:
"on_success", "always", "on_failure", or "conditional"FOR EACH edge, call:
mcp__agent-builder__add_edge(
edge_id="source-to-target",
source="source-node-id",
target="target-node-id",
condition="on_success",
condition_expr="",
priority=1
)AFTER all edges are added, validate the graph:
mcp__agent-builder__validate_graph()EXPORT the graph data:
mcp__agent-builder__export_graph()This returns JSON with all the goal, nodes, edges, and MCP server configurations.
THEN write the Python package files using the exported data. Create these files in exports/AGENT_NAME/:
config.py - Runtime configuration with model settingsnodes/__init__.py - All NodeSpec definitionsagent.py - Goal, edges, graph config, and agent class__init__.py - Package exports__main__.py - CLI interfacemcp_servers.json - MCP server configurationsREADME.md - Usage documentationIMPORTANT entry_points format:
{"start": "first-node-id"}{"first-node-id": ["input_keys"]} (WRONG){"first-node-id"} (WRONG - this is a set)Use the example agent at .claude/skills/building-agents-construction/examples/online_research_agent/ as a template for file structure and patterns.
AFTER writing all files, tell the user:
> ✅ Agent package created: exports/AGENT_NAME/ > > Files generated: > > - __init__.py - Package exports > - agent.py - Goal, nodes, edges, agent class > - config.py - Runtime configuration > - __main__.py - CLI interface > - nodes/__init__.py - Node definitions > - mcp_servers.json - MCP server config > - README.md - Usage documentation > > Test your agent: > > bash > cd /home/timothy/oss/hive > PYTHONPATH=core:exports python -m AGENT_NAME validate > PYTHONPATH=core:exports python -m AGENT_NAME info >
RUN validation:
bashcd /home/timothy/oss/hive && PYTHONPATH=core:exports python -m AGENT_NAME validate
SHOW final session summary:
mcp__agent-builder__get_session_status()TELL the user the agent is ready and suggest next steps:
/testing-agent skill for comprehensive testing/setup-credentials if the agent needs API keys| Type | tools param | Use when | | -------------- | ---------------------- | ---------------------------------------------- | | llm_generate | '[]' | Pure reasoning, JSON output, no external calls | | llm_tool_use | '["tool1", "tool2"]' | Needs to call MCP tools |
| Condition | When edge is followed | | ------------- | ------------------------------------- | | on_success | Source node completed successfully | | on_failure | Source node failed | | always | Always, regardless of success/failure | | conditional | When condition_expr evaluates to True |
For nodes with JSON output, include this in the system_prompt:
CRITICAL: Return ONLY raw JSON. NO markdown, NO code blocks.
Just the JSON object starting with { and ending with }.
Return this exact structure:
{
"key1": "...",
"key2": "..."
}mcp__agent-builder__list_mcp_tools() first{"start": "node-id"}, NOT a set or listOther measured skills in the registry, with their headline benchmark lift.