building-agents
Core XMTP Agent SDK setup and patterns. Use when creating new agents, handling messages, setting up middleware, or configuring environment variables. Triggers on agent setup, XMTP configuration, message handling, or middleware implementation.
Best use case
building-agents is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Core XMTP Agent SDK setup and patterns. Use when creating new agents, handling messages, setting up middleware, or configuring environment variables. Triggers on agent setup, XMTP configuration, message handling, or middleware implementation.
Teams using building-agents should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/building-agents/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How building-agents Compares
| Feature / Agent | building-agents | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Core XMTP Agent SDK setup and patterns. Use when creating new agents, handling messages, setting up middleware, or configuring environment variables. Triggers on agent setup, XMTP configuration, message handling, or middleware implementation.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# XMTP agent basics
Build event-driven, middleware-powered messaging agents on the XMTP network using the `@xmtp/agent-sdk`.
## When to apply
Reference these guidelines when:
- Creating a new XMTP agent
- Setting up environment variables
- Handling text messages and events
- Implementing middleware
- Using filters and context helpers
## Rule categories by priority
| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Setup | CRITICAL | `setup-` |
| 2 | Events | HIGH | `events-` |
| 3 | Middleware | MEDIUM | `middleware-` |
| 4 | Filters | MEDIUM | `filters-` |
## Quick reference
### Setup (CRITICAL)
- `setup-environment` - Configure environment variables for agent
- `setup-from-env` - Create agent using Agent.createFromEnv()
- `setup-manual` - Manual agent creation with signer
### Events (HIGH)
- `events-text` - Handle text messages
- `events-lifecycle` - Handle start/stop events
- `events-conversation` - Handle new DM and group conversations
- `events-message-types` - Handle different message types (reaction, reply, attachment)
### Middleware (MEDIUM)
- `middleware-basics` - Create and register middleware
- `middleware-error-handling` - Handle errors in middleware chain
- `middleware-command-router` - Use CommandRouter for slash commands
### Filters (MEDIUM)
- `filters-message-types` - Filter by message type
- `filters-sender` - Filter out self-messages
## Installation
```bash
npm install @xmtp/agent-sdk
# or
yarn add @xmtp/agent-sdk
```
## Quick start
```typescript
import { Agent } from "@xmtp/agent-sdk";
import { getTestUrl } from "@xmtp/agent-sdk/debug";
// Create agent using environment variables
const agent = await Agent.createFromEnv();
// Handle text messages
agent.on("text", async (ctx) => {
await ctx.conversation.sendText("Hello from my XMTP Agent!");
});
// Log when ready
agent.on("start", () => {
console.log(`Agent online: ${getTestUrl(agent.client)}`);
});
await agent.start();
```
## Environment variables
| Variable | Purpose | Example |
|----------|---------|---------|
| `XMTP_WALLET_KEY` | Private key for wallet | `0x1234...abcd` |
| `XMTP_DB_ENCRYPTION_KEY` | Database encryption key | `0xabcd...1234` |
| `XMTP_ENV` | Network environment | `dev` or `production` |
| `XMTP_DB_DIRECTORY` | Database directory | `./data` |
## How to use
Read individual rule files for detailed explanations:
```
rules/setup-environment.md
rules/events-text.md
rules/middleware-basics.md
```Related Skills
ooze-agents
Visual identity that evolves with reputation - create and nurture your agent's digital creature with XP and evolution stages
agentspend
Use this skill when you need to: search the web, generate images or pictures, create videos, scrape or read.
agentscale
Deploy web apps and APIs to a public URL with a single command.
demo-agents-sdk
Complete Polygon agent toolkit.
xmtp-agents
Building and extending XMTP agents with the Agent SDK. Use when: (1) creating or configuring an XMTP agent, (2) implementing agent features (commands, attachments, reactions, groups, transactions, inline actions, or domain resolution).
perry-coding-agents
Dispatch coding tasks to OpenCode or Claude Code on Perry workspaces. Use for development work, PR reviews, or any coding task requiring an isolated environment.
Vincent - A wallet for agents
Use this skill to safely create a wallet the agent can use for transfers, swaps, and any EVM chain transaction. Also supports raw signing and polymarket betting.
SafeSkills - Secure Secret Management for AI Agents
SafeSkills is a secure secret management service. It stores secrets (like wallet private keys) and executes actions using them so that **you (the agent) never see the raw secret values**. The first supported skill is an EVM wallet -- you can create wallets, transfer tokens, send transactions, check balances, and more.
voice-ai-agents
Create, manage, and deploy Voice.ai conversational AI agents. Use when the user wants to work with voice agents, list their agents, create new ones, or manage agent configurations.
voice.ai-voice-agents
Create, manage, and deploy Voice.ai conversational AI agents. Use when the user wants to work with voice agents, list their agents, create new ones, or manage agent configurations.
books-for-agents
An open source knowledge base of structured book summaries, available to any AI agent via MCP.
tmux-agents
Manage background coding agents in tmux sessions. Spawn Claude Code or other agents, check progress, get results.