building-agents-core
目標達成型のAIエージェント開発に必要な、構造や役割、道具の探し方、作業の流れといった基本概念を理解し、エージェント開発の基礎を習得したり、仕組みを理解したりするSkill。
📜 元の英語説明(参考)
Core concepts for goal-driven agents - architecture, node types, tool discovery, and workflow overview. Use when starting agent development or need to understand agent fundamentals.
🇯🇵 日本人クリエイター向け解説
目標達成型のAIエージェント開発に必要な、構造や役割、道具の探し方、作業の流れといった基本概念を理解し、エージェント開発の基礎を習得したり、仕組みを理解したりするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o building-agents-core.zip https://jpskill.com/download/9604.zip && unzip -o building-agents-core.zip && rm building-agents-core.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9604.zip -OutFile "$d\building-agents-core.zip"; Expand-Archive "$d\building-agents-core.zip" -DestinationPath $d -Force; ri "$d\building-agents-core.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
building-agents-core.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
building-agents-coreフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
エージェント構築 - コアコンセプト
Python パッケージとして、目標駆動型エージェントを構築するための基礎知識です。
アーキテクチャ: Python サービス (JSON 設定ではない)
エージェントは Python パッケージとして構築されます。
exports/my_agent/
├── __init__.py # パッケージのエクスポート
├── __main__.py # CLI (run, info, validate, shell)
├── agent.py # グラフの構築 (goal, edges, agent class)
├── nodes/__init__.py # ノードの定義 (NodeSpec)
├── config.py # ランタイム設定
└── README.md # ドキュメント
重要な原則: エージェントは構築中に可視化され、編集可能であること
- ✅ コンポーネントが承認されると、ファイルがすぐに作成されます
- ✅ ユーザーはエディターでファイルの成長を監視できます
- ✅ セッション状態はありません - ファイルへの直接書き込みのみです
- ✅ 「エクスポート」ステップはありません - エージェントは構築が完了すると準備完了です
コアコンセプト
Goal
成功基準と制約 (agent.py に書き込まれます)
goal = Goal(
id="research-goal",
name="Technical Research Agent",
description="技術的なトピックを徹底的に調査する",
success_criteria=[
SuccessCriterion(
id="completeness",
description="トピックのすべての側面を網羅する",
metric="coverage_score",
target=">=0.9",
weight=0.4,
),
# 合計 3〜5 個の成功基準
],
constraints=[
Constraint(
id="accuracy",
description="すべての情報は検証済みである必要があります",
constraint_type="hard",
category="quality",
),
# 合計 1〜5 個の制約
],
)
Node
作業単位 (nodes/init.py に書き込まれます)
Node の種類:
llm_generate- テキスト生成、解析llm_tool_use- ツールを必要とするアクションrouter- 条件分岐function- 決定的な操作
search_node = NodeSpec(
id="search-web",
name="ウェブ検索",
description="オンラインで情報を検索する",
node_type="llm_tool_use",
input_keys=["query"],
output_keys=["search_results"],
system_prompt="ウェブを検索してください: {query}",
tools=["web_search"],
max_retries=3,
)
Edge
ノード間の接続 (agent.py に書き込まれます)
Edge の条件:
on_success- ノードが成功した場合に続行on_failure- エラーを処理always- 常に続行conditional- 式に基づく
EdgeSpec(
id="search-to-analyze",
source="search-web",
target="analyze-results",
condition=EdgeCondition.ON_SUCCESS,
priority=1,
)
Pause/Resume
複数ターンの会話
- Pause nodes - 実行を停止し、ユーザー入力を待ちます
- Resume entry points - ユーザーの応答で一時停止から続行します
# Pause/resume 設定の例
pause_nodes = ["request-clarification"]
entry_points = {
"start": "analyze-request",
"request-clarification_resume": "process-clarification"
}
ツールの検出と検証
重要: ツールを持つノードを追加する前に、ツールが存在することを検証する必要があります。
ツールは MCP サーバーによって提供されます。ツールが存在することを決して前提とせず、常に動的に検出してください。
ステップ 1: MCP サーバーの登録 (まだ登録されていない場合)
mcp__agent-builder__add_mcp_server(
name="tools",
transport="stdio",
command="python",
args='["mcp_server.py", "--stdio"]',
cwd="../tools"
)
ステップ 2: 利用可能なツールの検出
# 登録されているすべてのサーバーからすべてのツールをリストします
mcp__agent-builder__list_mcp_tools()
# または、特定のサーバーからツールをリストします
mcp__agent-builder__list_mcp_tools(server_name="tools")
これにより、利用可能なツールがその説明とパラメーターとともに返されます。
{
"success": true,
"tools_by_server": {
"tools": [
{
"name": "web_search",
"description": "ウェブを検索...",
"parameters": ["query"]
},
{
"name": "web_scrape",
"description": "URL をスクレイピング...",
"parameters": ["url"]
}
]
},
"total_tools": 14
}
ステップ 3: ノードを追加する前に検証する
tools=[...] を持つノードを記述する前に:
list_mcp_tools()を呼び出して、利用可能なツールを取得します- ノード内の各ツールが応答に存在することを確認します
- ツールが存在しない場合:
- ノードの処理を続行しないでください
- ユーザーに通知します: 「ツール 'X' は利用できません。利用可能なツールは次のとおりです: ...」
- 代替ツールを使用するか、ツールなしで続行するかどうかを尋ねます
ツールの検証アンチパターン
❌ ツールが存在することを決して前提としないでください - 常に最初に list_mcp_tools() を呼び出してください
❌ 検証されていないツールを使用してノードを記述しないでください - 書き込む前に検証してください
❌ ツールを黙って削除しないでください - ツールが存在しない場合は、ユーザーに通知してください
❌ ツール名を推測しないでください - 検出応答からの正確な名前を使用してください
検証フローの例
# 1. ユーザーからのリクエスト: 「ウェブを検索するノードを追加する」
# 2. 利用可能なツールを検出する
tools_response = mcp__agent-builder__list_mcp_tools()
# 3. web_search が存在するかどうかを確認する
available = [t["name"] for tools in tools_response["tools_by_server"].values() for t in tools]
if "web_search" not in available:
# ユーザーに通知し、続行方法を尋ねる
print("❌ 'web_search' は利用できません。利用可能なツール:", available)
else:
# ノードの作成を続行する
# ...
ワークフローの概要: 増分ファイル構築
1. パッケージの作成 → mkdir + スケルトンの書き込み
2. GOAL の定義 → agent.py + config.py への書き込み
3. 各 NODE について:
- 設計を提案する
- ユーザーが承認する
- nodes/__init__.py にすぐに書き込む ← ファイルが書き込まれます
- (オプション) test_node で検証する ← MCP 検証
- ユーザーはファイルを開いて確認できます
4. EDGE の接続 → agent.py の更新 ← ファイルが書き込まれます
- (オプション) validate_graph で検証する ← MCP 検証
5. 完了 → agent クラスを agent.py に書き込む ← ファイルが書き込まれます
6. 完了 - エージェントは exports/my_agent/ で準備完了です
ファイルはすぐに書き込まれます。MCP ツールは、検証/テストの記録にオプションです。
主な違い
OLD (悪い):
MCP add_node → セッション状態 → MCP add_node → セッション状態 → ... 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Building Agents - Core Concepts
Foundational knowledge for building goal-driven agents as Python packages.
Architecture: Python Services (Not JSON Configs)
Agents are built as Python packages:
exports/my_agent/
├── __init__.py # Package exports
├── __main__.py # CLI (run, info, validate, shell)
├── agent.py # Graph construction (goal, edges, agent class)
├── nodes/__init__.py # Node definitions (NodeSpec)
├── config.py # Runtime config
└── README.md # Documentation
Key Principle: Agent is visible and editable during build
- ✅ Files created immediately as components are approved
- ✅ User can watch files grow in their editor
- ✅ No session state - just direct file writes
- ✅ No "export" step - agent is ready when build completes
Core Concepts
Goal
Success criteria and constraints (written to agent.py)
goal = Goal(
id="research-goal",
name="Technical Research Agent",
description="Research technical topics thoroughly",
success_criteria=[
SuccessCriterion(
id="completeness",
description="Cover all aspects of topic",
metric="coverage_score",
target=">=0.9",
weight=0.4,
),
# 3-5 success criteria total
],
constraints=[
Constraint(
id="accuracy",
description="All information must be verified",
constraint_type="hard",
category="quality",
),
# 1-5 constraints total
],
)
Node
Unit of work (written to nodes/init.py)
Node Types:
llm_generate- Text generation, parsingllm_tool_use- Actions requiring toolsrouter- Conditional branchingfunction- Deterministic operations
search_node = NodeSpec(
id="search-web",
name="Search Web",
description="Search for information online",
node_type="llm_tool_use",
input_keys=["query"],
output_keys=["search_results"],
system_prompt="Search the web for: {query}",
tools=["web_search"],
max_retries=3,
)
Edge
Connection between nodes (written to agent.py)
Edge Conditions:
on_success- Proceed if node succeedson_failure- Handle errorsalways- Always proceedconditional- Based on expression
EdgeSpec(
id="search-to-analyze",
source="search-web",
target="analyze-results",
condition=EdgeCondition.ON_SUCCESS,
priority=1,
)
Pause/Resume
Multi-turn conversations
- Pause nodes - Stop execution, wait for user input
- Resume entry points - Continue from pause with user's response
# Example pause/resume configuration
pause_nodes = ["request-clarification"]
entry_points = {
"start": "analyze-request",
"request-clarification_resume": "process-clarification"
}
Tool Discovery & Validation
CRITICAL: Before adding a node with tools, you MUST verify the tools exist.
Tools are provided by MCP servers. Never assume a tool exists - always discover dynamically.
Step 1: Register MCP Server (if not already done)
mcp__agent-builder__add_mcp_server(
name="tools",
transport="stdio",
command="python",
args='["mcp_server.py", "--stdio"]',
cwd="../tools"
)
Step 2: Discover Available Tools
# List all tools from all registered servers
mcp__agent-builder__list_mcp_tools()
# Or list tools from a specific server
mcp__agent-builder__list_mcp_tools(server_name="tools")
This returns available tools with their descriptions and parameters:
{
"success": true,
"tools_by_server": {
"tools": [
{
"name": "web_search",
"description": "Search the web...",
"parameters": ["query"]
},
{
"name": "web_scrape",
"description": "Scrape a URL...",
"parameters": ["url"]
}
]
},
"total_tools": 14
}
Step 3: Validate Before Adding Nodes
Before writing a node with tools=[...]:
- Call
list_mcp_tools()to get available tools - Check each tool in your node exists in the response
- If a tool doesn't exist:
- DO NOT proceed with the node
- Inform the user: "The tool 'X' is not available. Available tools are: ..."
- Ask if they want to use an alternative or proceed without the tool
Tool Validation Anti-Patterns
❌ Never assume a tool exists - always call list_mcp_tools() first
❌ Never write a node with unverified tools - validate before writing
❌ Never silently drop tools - if a tool doesn't exist, inform the user
❌ Never guess tool names - use exact names from discovery response
Example Validation Flow
# 1. User requests: "Add a node that searches the web"
# 2. Discover available tools
tools_response = mcp__agent-builder__list_mcp_tools()
# 3. Check if web_search exists
available = [t["name"] for tools in tools_response["tools_by_server"].values() for t in tools]
if "web_search" not in available:
# Inform user and ask how to proceed
print("❌ 'web_search' not available. Available tools:", available)
else:
# Proceed with node creation
# ...
Workflow Overview: Incremental File Construction
1. CREATE PACKAGE → mkdir + write skeletons
2. DEFINE GOAL → Write to agent.py + config.py
3. FOR EACH NODE:
- Propose design
- User approves
- Write to nodes/__init__.py IMMEDIATELY ← FILE WRITTEN
- (Optional) Validate with test_node ← MCP VALIDATION
- User can open file and see it
4. CONNECT EDGES → Update agent.py ← FILE WRITTEN
- (Optional) Validate with validate_graph ← MCP VALIDATION
5. FINALIZE → Write agent class to agent.py ← FILE WRITTEN
6. DONE - Agent ready at exports/my_agent/
Files written immediately. MCP tools optional for validation/testing bookkeeping.
The Key Difference
OLD (Bad):
MCP add_node → Session State → MCP add_node → Session State → ...
↓
MCP export_graph
↓
Files appear
NEW (Good):
Write node to file → (Optional: MCP test_node) → Write node to file → ...
↓ ↓
File visible File visible
immediately immediately
Bottom line: Use Write/Edit for construction, MCP for validation if needed.
When to Use This Skill
Use building-agents-core when:
- Starting a new agent project and need to understand fundamentals
- Need to understand agent architecture before building
- Want to validate tool availability before proceeding
- Learning about node types, edges, and graph execution
Next Steps:
- Ready to build? → Use
building-agents-constructionskill - Need patterns and examples? → Use
building-agents-patternsskill
MCP Tools for Validation
After writing files, optionally use MCP tools for validation:
test_node - Validate node configuration with mock inputs
mcp__agent-builder__test_node(
node_id="search-web",
test_input='{"query": "test query"}',
mock_llm_response='{"results": "mock output"}'
)
validate_graph - Check graph structure
mcp__agent-builder__validate_graph()
# Returns: unreachable nodes, missing connections, etc.
create_session - Track session state for bookkeeping
mcp__agent-builder__create_session(session_name="my-build")
Key Point: Files are written FIRST. MCP tools are for validation only.
Related Skills
- building-agents-construction - Step-by-step building process
- building-agents-patterns - Best practices and examples
- agent-workflow - Complete workflow orchestrator
- testing-agent - Test and validate completed agents