agent-review
Review AI agent implementations for best practices in architecture, folder structure, design patterns, error handling, and observability. Use when auditing agent codebases or designing new agent systems.
What this skill does
# Agent Implementation Review
Review AI agent implementations for architectural best practices.
**Target:** $ARGUMENTS (path to agent project or codebase)
## When to Use This Skill
- Auditing existing agent implementations
- Designing new agent architectures
- Reviewing agent code for production readiness
- Evaluating multi-agent system designs
- Assessing agent reliability and observability
## Review Process
1. **Discover** - Explore folder structure at $ARGUMENTS
2. **Analyze** - Check against architecture patterns
3. **Evaluate** - Score each category
4. **Report** - Generate findings with recommendations
## Folder Structure Best Practices
### Recommended Agent Project Structure
```
agent-project/
├── src/
│ ├── agents/ # Agent definitions
│ │ ├── base.py # Base agent class
│ │ ├── planner.py # Planning agent
│ │ └── executor.py # Execution agent
│ ├── tools/ # Tool implementations
│ │ ├── __init__.py
│ │ ├── base.py # Tool base class/interface
│ │ ├── search.py # Search tool
│ │ └── code.py # Code execution tool
│ ├── memory/ # Memory/state management
│ │ ├── short_term.py # Conversation context
│ │ ├── long_term.py # Persistent storage
│ │ └── vector_store.py # Embeddings/RAG
│ ├── prompts/ # Prompt templates
│ │ ├── system.py # System prompts
│ │ └── templates/ # Jinja/string templates
│ ├── orchestration/ # Multi-agent coordination
│ │ ├── router.py # Request routing
│ │ └── workflow.py # Agent workflows
│ ├── models/ # Data models/schemas
│ │ ├── messages.py # Message types
│ │ └── state.py # State schemas
│ └── utils/ # Shared utilities
│ ├── logging.py # Structured logging
│ └── retry.py # Retry logic
├── config/ # Configuration
│ ├── default.yaml # Default settings
│ └── prompts/ # External prompt files
├── tests/ # Test suite
│ ├── unit/
│ ├── integration/
│ └── fixtures/ # Test data
└── scripts/ # CLI/automation
```
### Structure Checklist
| Component | Required | Check |
|-----------|----------|-------|
| Agent definitions separated | Yes | [ ] |
| Tools in dedicated module | Yes | [ ] |
| Prompts externalized | Recommended | [ ] |
| Configuration separated | Yes | [ ] |
| Tests present | Yes | [ ] |
| Clear separation of concerns | Yes | [ ] |
## Design Pattern Checklist
### 1. Tool Design
**Required Patterns:**
- [ ] Tools have clear input/output schemas
- [ ] Tool errors return structured error responses
- [ ] Tools are stateless (no side effects on agent state)
- [ ] Tool timeouts are configured
- [ ] Tools validate inputs before execution
**BAD:**
```python
def search(query):
return requests.get(f"https://api.com?q={query}").json()
```
**GOOD:**
```python
class SearchTool(BaseTool):
name = "search"
description = "Search the web for information"
class InputSchema(BaseModel):
query: str = Field(..., min_length=1, max_length=500)
def execute(self, query: str) -> ToolResult:
try:
response = self.client.search(query, timeout=10)
return ToolResult(success=True, data=response)
except Timeout:
return ToolResult(success=False, error="Search timed out")
except Exception as e:
return ToolResult(success=False, error=str(e))
```
### 2. Agent Loop
**Required Patterns:**
- [ ] Clear think → act → observe cycle
- [ ] Maximum iteration limit
- [ ] Graceful termination conditions
- [ ] State preserved between iterations
- [ ] Interrupt/cancel capability
**GOOD:**
```python
class Agent:
MAX_ITERATIONS = 10
async def run(self, task: str) -> AgentResult:
state = AgentState(task=task)
for i in range(self.MAX_ITERATIONS):
if self._should_stop(state):
break
# Think
action = await self.plan(state)
# Act
result = await self.execute(action)
# Observe
state = self.update_state(state, result)
return self.finalize(state)
```
### 3. Memory Management
**Required Patterns:**
- [ ] Conversation history with size limits
- [ ] Summarization for long conversations
- [ ] Clear memory lifecycle (create, read, update, delete)
- [ ] Persistent storage for long-term memory
- [ ] Vector store for semantic retrieval (if RAG)
**Memory Types:**
| Type | Purpose | Persistence |
|------|---------|-------------|
| Working | Current task context | Session |
| Short-term | Recent conversation | Session |
| Long-term | User preferences, facts | Persistent |
| Episodic | Past task summaries | Persistent |
| Semantic | Embeddings/RAG | Persistent |
### 4. Error Handling
**Required Patterns:**
- [ ] Structured error types (not generic exceptions)
- [ ] Retry with exponential backoff for transient errors
- [ ] Graceful degradation (fallback behaviors)
- [ ] Error context preserved for debugging
- [ ] User-friendly error messages
**Error Categories:**
| Category | Retry | Action |
|----------|-------|--------|
| Rate limit | Yes | Exponential backoff |
| Timeout | Yes | Retry with longer timeout |
| Auth failure | No | Fail with clear message |
| Invalid input | No | Return validation error |
| Tool failure | Maybe | Try alternative tool |
| Model error | Yes | Retry or fallback model |
**GOOD:**
```python
class AgentError(Exception):
def __init__(self, message: str, code: str, recoverable: bool = False):
self.message = message
self.code = code
self.recoverable = recoverable
@retry(
retry=retry_if_exception_type(RateLimitError),
wait=wait_exponential(multiplier=1, max=60),
stop=stop_after_attempt(3)
)
async def call_model(self, messages: list) -> str:
try:
return await self.client.complete(messages)
except RateLimitError:
raise # Let retry handle it
except AuthError as e:
raise AgentError("Authentication failed", "AUTH_ERROR", recoverable=False)
```
### 5. State Management
**Required Patterns:**
- [ ] Immutable state updates (new state object per update)
- [ ] State schema validation
- [ ] State serialization for persistence
- [ ] Clear state transitions
- [ ] State versioning for migrations
**GOOD:**
```python
@dataclass(frozen=True)
class AgentState:
task: str
messages: tuple[Message, ...]
tool_results: tuple[ToolResult, ...]
iteration: int = 0
status: Literal["running", "completed", "failed"] = "running"
def with_message(self, message: Message) -> "AgentState":
return replace(self, messages=self.messages + (message,))
def with_tool_result(self, result: ToolResult) -> "AgentState":
return replace(self, tool_results=self.tool_results + (result,))
```
### 6. Multi-Agent Coordination
**Patterns (if applicable):**
- [ ] Clear agent roles and responsibilities
- [ ] Message passing protocol defined
- [ ] Conflict resolution strategy
- [ ] Supervisor/orchestrator pattern
- [ ] Shared state management
**Coordination Patterns:**
| Pattern | Use Case |
|---------|----------|
| **Supervisor** | One agent routes to specialists |
| **Pipeline** | Sequential agent processing |
| **Debate** | Multiple agents propose, one decides |
| **Swarm** | Autonomous agents, shared goals |
| **Hierarchical** | Manager → workers structure |
### 7. Prompt Management
**Required Patterns:**
- [ ] System prompts externalized (not hardcoded)
- [ ] Prompt versioning
- [ ] Variables/templating for dynamic content
- [ ] Prompt testing/validation
- [ ] Clear prompt documentation
**GOOD:**
```python
# prompts/system.yaml
agent_system_prompt:
version: "1.2"
template: |
You are a helpful assistant with access to these tools:
{% for tool in tools %}
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.