tool-interface-analysis
Analyze tool registration, schema generation, and error feedback mechanisms in agent frameworks. Use when (1) understanding how tools are defined and registered, (2) evaluating schema generation approaches (introspection vs manual), (3) tracing error feedback loops to the LLM, (4) assessing retry and self-correction mechanisms, or (5) comparing tool interfaces across frameworks.
What this skill does
# Tool Interface Analysis
Analyzes how agent frameworks model, register, and execute tools. This skill examines the **tool abstraction layer**, **schema generation**, **built-in inventory**, and **error feedback mechanisms**.
## Distinction from harness-model-protocol
| tool-interface-analysis | harness-model-protocol |
|------------------------|------------------------|
| How a "tool" is represented (types, base classes) | How tool calls are encoded on the wire |
| Schema generation (Pydantic -> JSON Schema) | Schema transmission to LLM API |
| Built-in tool inventory | Provider-specific tool formats |
| Registration and discovery patterns | Message format translation |
| Error feedback to LLM for retry | Response parsing and streaming |
| Tool execution orchestration | Partial tool call handling |
## Process
1. **Map tool modeling** - Identify how tools are represented (types, protocols, base classes)
2. **Analyze schema generation** - How tool definitions become JSON Schema
3. **Catalog built-in inventory** - What tools ship with the framework
4. **Trace registration flow** - How tools are discovered and made available
5. **Document execution patterns** - Invocation, validation, error handling
6. **Evaluate retry mechanisms** - Self-correction and feedback loops
## Tool Modeling Patterns
### Abstract Base Class Pattern
```python
from abc import ABC, abstractmethod
from typing import Any
class BaseTool(ABC):
"""Framework's tool abstraction."""
name: str
description: str
@abstractmethod
def execute(self, **kwargs) -> Any:
"""Execute the tool with validated arguments."""
...
@property
@abstractmethod
def parameters_schema(self) -> dict:
"""Return JSON Schema for parameters."""
...
```
**Characteristics**: Explicit contract, inheritance-based, type-safe
**Used by**: LangChain, CrewAI, AutoGen
### Protocol/Interface Pattern
```python
from typing import Protocol, runtime_checkable
@runtime_checkable
class Tool(Protocol):
"""Structural typing for tools."""
name: str
description: str
def __call__(self, **kwargs) -> Any: ...
def get_schema(self) -> dict: ...
```
**Characteristics**: Duck typing, flexible, composition-friendly
**Used by**: Pydantic-AI, OpenAI Agents SDK
### Decorated Function Pattern
```python
from functools import wraps
def tool(name: str = None, description: str = None):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper._tool_name = name or func.__name__
wrapper._tool_description = description or func.__doc__
wrapper._is_tool = True
return wrapper
return decorator
@tool(description="Search the web for information")
def search(query: str, max_results: int = 10) -> list[str]:
...
```
**Characteristics**: Lightweight, DRY, preserves function identity
**Used by**: Google ADK, Swarm, Function calling patterns
### Pydantic Model Pattern
```python
from pydantic import BaseModel, Field
class SearchInput(BaseModel):
"""Input schema for search tool."""
query: str = Field(description="The search query")
max_results: int = Field(default=10, ge=1, le=100)
class SearchTool(BaseTool):
name = "search"
description = "Search the web"
args_schema = SearchInput
def execute(self, **kwargs) -> list[str]:
validated = SearchInput(**kwargs)
return perform_search(validated.query, validated.max_results)
```
**Characteristics**: Rich validation, auto-schema, clear separation
**Used by**: LangChain, CrewAI
## Schema Generation Methods
### Introspection-Based (Automatic)
```python
import inspect
from typing import get_type_hints
def generate_schema_from_function(func) -> dict:
hints = get_type_hints(func)
sig = inspect.signature(func)
doc = inspect.getdoc(func) or ""
schema = {
"type": "function",
"function": {
"name": func.__name__,
"description": doc.split("\n")[0],
"parameters": {
"type": "object",
"properties": {},
"required": []
}
}
}
for name, param in sig.parameters.items():
if name in ("self", "cls"):
continue
prop = {"type": python_type_to_json(hints.get(name, str))}
# Extract description from docstring if available
if f":param {name}:" in doc:
prop["description"] = extract_param_doc(doc, name)
if param.default is inspect.Parameter.empty:
schema["function"]["parameters"]["required"].append(name)
else:
prop["default"] = param.default
schema["function"]["parameters"]["properties"][name] = prop
return schema
```
**Pros**: DRY, always in sync with code, minimal boilerplate
**Cons**: Limited expressiveness, relies on annotations, docstring parsing fragile
### Pydantic-Based (Semi-Automatic)
```python
from pydantic import BaseModel, Field
from pydantic.json_schema import GenerateJsonSchema
class SearchInput(BaseModel):
"""Search the web for information."""
query: str = Field(description="The search query")
max_results: int = Field(default=10, ge=1, le=100, description="Max results to return")
def generate_schema_from_pydantic(model: type[BaseModel]) -> dict:
return {
"type": "function",
"function": {
"name": model.__name__.replace("Input", "").lower(),
"description": model.__doc__ or "",
"parameters": model.model_json_schema()
}
}
```
**Pros**: Rich validation, excellent descriptions, composable
**Cons**: Class per tool, more boilerplate, Pydantic dependency
### Decorator-Based (Explicit)
```python
@tool(
name="search",
description="Search the web for information",
parameters={
"query": {"type": "string", "description": "Search query"},
"max_results": {"type": "integer", "default": 10}
}
)
def search(query: str, max_results: int = 10) -> list[str]:
...
```
**Pros**: Explicit, flexible, no dependencies
**Cons**: Can drift from implementation, manual maintenance
### Manual Definition
```python
TOOLS = [
{
"type": "function",
"function": {
"name": "search",
"description": "Search the web for information",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query"
}
},
"required": ["query"]
}
}
}
]
```
**Pros**: Full control, no magic, portable
**Cons**: Maintenance burden, drift risk, duplication
### Schema Generation Comparison
| Method | Sync with Code | Expressiveness | Boilerplate | Validation |
|--------|---------------|----------------|-------------|------------|
| Introspection | Automatic | Low | None | None |
| Pydantic | Automatic | High | Medium | Built-in |
| Decorator | Manual | Medium | Low | Optional |
| Manual | Manual | Full | High | None |
## Registration Patterns
### Declarative List
```python
agent = Agent(
tools=[search_tool, calculator_tool, weather_tool]
)
```
**Characteristics**: Explicit, static, easy to understand, testable
### Registry Pattern
```python
TOOL_REGISTRY = {}
def register_tool(name: str = None):
def decorator(func):
tool_name = name or func.__name__
TOOL_REGISTRY[tool_name] = func
return func
return decorator
@register_tool("search")
def search(query: str) -> list[str]: ...
# Agent uses registry
agent = Agent(tools=list(TOOL_REGISTRY.values()))
```
**Characteristics**: Dynamic, plugin-friendly, implicit coupling
### Discovery-Based (Auto-Import)
```python
import importlib
import pkgutil
def discover_tools(package):
tools = []
for Related 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.