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.
What this skill does
# Architecture Synthesis
Generates a reference architecture specification for a new framework.
## Process
1. **Define primitives** — Message, State, Result, Tool types
2. **Specify interfaces** — Protocols for LLM, Tool, Memory
3. **Design the loop** — Core execution algorithm
4. **Create diagrams** — Visual architecture representation
5. **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
```python
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
```python
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
```python
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
```python
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
```python
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
```python
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
```python
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
```mermaid
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 AgeRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.