architecture-synthesis
Generate a reference architecture specification from analyzed frameworks. Use when (1) designing a new agent framework based on prior art, (2) defining core primitives (Message, State, Tool types), (3) specifying interface protocols, (4) creating execution loop pseudocode, or (5) producing architecture diagrams and implementation roadmaps.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o architecture-synthesis.zip https://jpskill.com/download/18850.zip && unzip -o architecture-synthesis.zip && rm architecture-synthesis.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18850.zip -OutFile "$d\architecture-synthesis.zip"; Expand-Archive "$d\architecture-synthesis.zip" -DestinationPath $d -Force; ri "$d\architecture-synthesis.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
architecture-synthesis.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
architecture-synthesisフォルダができる - 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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
アーキテクチャ合成
新しいフレームワークのリファレンスアーキテクチャ仕様を生成します。
プロセス
- プリミティブの定義 — Message、State、Result、Tool の各タイプ
- インターフェースの指定 — LLM、Tool、Memory の各プロトコル
- ループの設計 — コア実行アルゴリズム
- 図の作成 — 視覚的なアーキテクチャ表現
- ロードマップの作成 — 実装フェーズ
前提条件
合成の前に、以下を確認してください。
- [ ] 各ディメンションごとの決定を含む比較マトリックス
- [ ] 「繰り返さない」リストを含むアンチパターンカタログ
- [ ] 設計要件ドキュメント
コアプリミティブの定義
Message Type
from typing import Literal
from pydantic import BaseModel
class Message(BaseModel):
"""Immutable message in the conversation."""
role: Literal["system", "user", "assistant", "tool"]
content: str
name: str | None = None # For tool messages
tool_call_id: str | None = None
class Config:
frozen = True # Immutable
State Type
from dataclasses import dataclass, field
from typing import Any
@dataclass(frozen=True)
class AgentState:
"""Immutable agent state - copy-on-write pattern."""
messages: tuple[Message, ...]
tool_results: tuple[ToolResult, ...] = ()
metadata: dict[str, Any] = field(default_factory=dict)
step_count: int = 0
def with_message(self, msg: Message) -> "AgentState":
"""Return new state with message added."""
return AgentState(
messages=(*self.messages, msg),
tool_results=self.tool_results,
metadata=self.metadata,
step_count=self.step_count
)
Result Types
from typing import Union
@dataclass(frozen=True)
class ToolResult:
"""Result from tool execution."""
tool_name: str
success: bool
output: str | None = None
error: str | None = None
@dataclass(frozen=True)
class AgentFinish:
"""Agent completed its task."""
output: str
@dataclass(frozen=True)
class AgentContinue:
"""Agent needs another step."""
tool_calls: tuple[ToolCall, ...]
StepResult = Union[AgentFinish, AgentContinue]
インターフェースプロトコル
LLM Protocol
from typing import Protocol, Iterator
class LLM(Protocol):
"""Minimal LLM interface."""
def generate(self, messages: list[Message]) -> LLMResponse:
"""Generate a response."""
...
def stream(self, messages: list[Message]) -> Iterator[str]:
"""Stream response tokens."""
...
@dataclass
class LLMResponse:
"""Full LLM response with metadata."""
content: str
tool_calls: list[ToolCall] | None
usage: TokenUsage
model: str
raw: Any # Original API response
Tool Protocol
class Tool(Protocol):
"""Minimal tool interface."""
@property
def name(self) -> str:
"""Tool identifier."""
...
@property
def description(self) -> str:
"""Human-readable description."""
...
@property
def schema(self) -> dict:
"""JSON Schema for parameters."""
...
def execute(self, **kwargs) -> str:
"""Execute the tool."""
...
Memory Protocol
class Memory(Protocol):
"""Memory/context management interface."""
def add(self, message: Message) -> None:
"""Add a message to memory."""
...
def get_context(self, query: str, max_tokens: int) -> list[Message]:
"""Retrieve relevant context."""
...
def clear(self) -> None:
"""Clear memory."""
...
実行ループの設計
アルゴリズムの擬似コード
FUNCTION run_agent(input: str, max_steps: int) -> str:
state = initial_state(input)
FOR step IN range(max_steps):
# 1. Build context
messages = build_messages(state)
# 2. Call LLM
response = llm.generate(messages)
# 3. Parse and decide
result = parse_response(response)
# 4. Handle result
IF result IS AgentFinish:
RETURN result.output
IF result IS AgentContinue:
# Execute tools
FOR tool_call IN result.tool_calls:
tool_result = execute_tool(tool_call)
state = state.with_tool_result(tool_result)
# Feed back to LLM
state = state.with_message(format_observations(state))
# 5. Emit events
emit("step_complete", state)
# Max steps reached
RAISE MaxStepsExceeded(state)
実装テンプレート
class Agent:
def __init__(
self,
llm: LLM,
tools: list[Tool],
system_prompt: str,
max_steps: int = 10
):
self.llm = llm
self.tools = {t.name: t for t in tools}
self.system_prompt = system_prompt
self.max_steps = max_steps
self.callbacks: list[Callback] = []
def run(self, input: str) -> str:
state = AgentState(messages=(
Message(role="system", content=self.system_prompt),
Message(role="user", content=input)
))
for step in range(self.max_steps):
self._emit("step_start", step, state)
# LLM call
response = self.llm.generate(list(state.messages))
self._emit("llm_response", response)
# Parse
result = self._parse_response(response)
# Finish or continue
if isinstance(result, AgentFinish):
self._emit("agent_finish", result)
return result.output
# Execute tools
for call in result.tool_calls:
tool_result = self._execute_tool(call)
state = state.with_tool_result(tool_result)
# Update state
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Architecture Synthesis
Generates a reference architecture specification for a new framework.
Process
- Define primitives — Message, State, Result, Tool types
- Specify interfaces — Protocols for LLM, Tool, Memory
- Design the loop — Core execution algorithm
- Create diagrams — Visual architecture representation
- Produce roadmap — Implementation phases
Prerequisites
Before synthesis, ensure you have:
- [ ] Comparative matrix with decisions per dimension
- [ ] Anti-pattern catalog with "Do Not Repeat" list
- [ ] Design requirements document
Core Primitives Definition
Message Type
from typing import Literal
from pydantic import BaseModel
class Message(BaseModel):
"""Immutable message in the conversation."""
role: Literal["system", "user", "assistant", "tool"]
content: str
name: str | None = None # For tool messages
tool_call_id: str | None = None
class Config:
frozen = True # Immutable
State Type
from dataclasses import dataclass, field
from typing import Any
@dataclass(frozen=True)
class AgentState:
"""Immutable agent state - copy-on-write pattern."""
messages: tuple[Message, ...]
tool_results: tuple[ToolResult, ...] = ()
metadata: dict[str, Any] = field(default_factory=dict)
step_count: int = 0
def with_message(self, msg: Message) -> "AgentState":
"""Return new state with message added."""
return AgentState(
messages=(*self.messages, msg),
tool_results=self.tool_results,
metadata=self.metadata,
step_count=self.step_count
)
Result Types
from typing import Union
@dataclass(frozen=True)
class ToolResult:
"""Result from tool execution."""
tool_name: str
success: bool
output: str | None = None
error: str | None = None
@dataclass(frozen=True)
class AgentFinish:
"""Agent completed its task."""
output: str
@dataclass(frozen=True)
class AgentContinue:
"""Agent needs another step."""
tool_calls: tuple[ToolCall, ...]
StepResult = Union[AgentFinish, AgentContinue]
Interface Protocols
LLM Protocol
from typing import Protocol, Iterator
class LLM(Protocol):
"""Minimal LLM interface."""
def generate(self, messages: list[Message]) -> LLMResponse:
"""Generate a response."""
...
def stream(self, messages: list[Message]) -> Iterator[str]:
"""Stream response tokens."""
...
@dataclass
class LLMResponse:
"""Full LLM response with metadata."""
content: str
tool_calls: list[ToolCall] | None
usage: TokenUsage
model: str
raw: Any # Original API response
Tool Protocol
class Tool(Protocol):
"""Minimal tool interface."""
@property
def name(self) -> str:
"""Tool identifier."""
...
@property
def description(self) -> str:
"""Human-readable description."""
...
@property
def schema(self) -> dict:
"""JSON Schema for parameters."""
...
def execute(self, **kwargs) -> str:
"""Execute the tool."""
...
Memory Protocol
class Memory(Protocol):
"""Memory/context management interface."""
def add(self, message: Message) -> None:
"""Add a message to memory."""
...
def get_context(self, query: str, max_tokens: int) -> list[Message]:
"""Retrieve relevant context."""
...
def clear(self) -> None:
"""Clear memory."""
...
Execution Loop Design
Algorithm Pseudocode
FUNCTION run_agent(input: str, max_steps: int) -> str:
state = initial_state(input)
FOR step IN range(max_steps):
# 1. Build context
messages = build_messages(state)
# 2. Call LLM
response = llm.generate(messages)
# 3. Parse and decide
result = parse_response(response)
# 4. Handle result
IF result IS AgentFinish:
RETURN result.output
IF result IS AgentContinue:
# Execute tools
FOR tool_call IN result.tool_calls:
tool_result = execute_tool(tool_call)
state = state.with_tool_result(tool_result)
# Feed back to LLM
state = state.with_message(format_observations(state))
# 5. Emit events
emit("step_complete", state)
# Max steps reached
RAISE MaxStepsExceeded(state)
Implementation Template
class Agent:
def __init__(
self,
llm: LLM,
tools: list[Tool],
system_prompt: str,
max_steps: int = 10
):
self.llm = llm
self.tools = {t.name: t for t in tools}
self.system_prompt = system_prompt
self.max_steps = max_steps
self.callbacks: list[Callback] = []
def run(self, input: str) -> str:
state = AgentState(messages=(
Message(role="system", content=self.system_prompt),
Message(role="user", content=input)
))
for step in range(self.max_steps):
self._emit("step_start", step, state)
# LLM call
response = self.llm.generate(list(state.messages))
self._emit("llm_response", response)
# Parse
result = self._parse_response(response)
# Finish or continue
if isinstance(result, AgentFinish):
self._emit("agent_finish", result)
return result.output
# Execute tools
for call in result.tool_calls:
tool_result = self._execute_tool(call)
state = state.with_tool_result(tool_result)
# Update state
state = state.with_message(
Message(role="assistant", content=response.content)
)
for tr in state.tool_results[-len(result.tool_calls):]:
state = state.with_message(
Message(role="tool", content=tr.output or tr.error, name=tr.tool_name)
)
self._emit("step_end", step, state)
raise MaxStepsExceeded(f"Exceeded {self.max_steps} steps")
def _execute_tool(self, call: ToolCall) -> ToolResult:
tool = self.tools.get(call.name)
if not tool:
return ToolResult(call.name, success=False, error=f"Unknown tool: {call.name}")
try:
output = tool.execute(**call.arguments)
return ToolResult(call.name, success=True, output=output)
except Exception as e:
return ToolResult(call.name, success=False, error=f"{type(e).__name__}: {e}")
Architecture Diagram
graph TB
subgraph "Core Layer"
MSG[Message]
STATE[AgentState]
RESULT[StepResult]
end
subgraph "Protocol Layer"
LLM_P[LLM Protocol]
TOOL_P[Tool Protocol]
MEM_P[Memory Protocol]
end
subgraph "Execution Layer"
LOOP[Agent Loop]
PARSER[Response Parser]
EXECUTOR[Tool Executor]
end
subgraph "Integration Layer"
OPENAI[OpenAI LLM]
ANTHROPIC[Anthropic LLM]
TOOLS[Built-in Tools]
VECTOR[Vector Memory]
end
MSG --> STATE
STATE --> LOOP
LOOP --> LLM_P
LOOP --> PARSER
PARSER --> RESULT
RESULT --> EXECUTOR
EXECUTOR --> TOOL_P
LLM_P -.-> OPENAI
LLM_P -.-> ANTHROPIC
TOOL_P -.-> TOOLS
MEM_P -.-> VECTOR
Implementation Roadmap
Phase 1: Core (Week 1-2)
- [ ] Define Message, State, Result types
- [ ] Implement LLM Protocol with OpenAI
- [ ] Implement basic Tool Protocol
- [ ] Create minimal Agent loop
- [ ] Add step limit termination
Phase 2: Robustness (Week 3-4)
- [ ] Add error handling and feedback
- [ ] Implement retry mechanisms
- [ ] Add comprehensive logging
- [ ] Create callback/event system
- [ ] Add token counting
Phase 3: Extensibility (Week 5-6)
- [ ] Add Memory Protocol
- [ ] Implement vector store integration
- [ ] Create tool discovery/registry
- [ ] Add configuration system
- [ ] Write documentation
Phase 4: Production (Week 7-8)
- [ ] Add tracing/observability
- [ ] Implement streaming
- [ ] Add rate limiting
- [ ] Create async version
- [ ] Performance optimization
Output Artifacts
reference-architecture/
├── docs/
│ ├── ARCHITECTURE.md # This document
│ ├── PRIMITIVES.md # Type definitions
│ ├── PROTOCOLS.md # Interface specs
│ └── LOOP.md # Algorithm details
├── diagrams/
│ ├── architecture.mermaid
│ ├── flow.mermaid
│ └── types.mermaid
├── examples/
│ ├── simple_agent.py
│ ├── multi_tool_agent.py
│ └── custom_llm.py
└── ROADMAP.md # Implementation plan
Integration
- Inputs from:
comparative-matrix,antipattern-catalog - Produces: Reference architecture for implementation
- Validates against: Original protocol requirements