Skip to content
Back to skills

Handling Commands

ASecurity

Patterns for handling commands, validating input, and filtering messages in XMTP agents. Use when implementing slash commands, validators, or message filters. Triggers on command handling, input validation, or type guards.

  • 54 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
toolsgoreact

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add xmtplabs/xmtp-agent-examples --skill handling-commands --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Handling Commands?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Handling Commands
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/xmtplabs-handling-commands/badge)](https://www.skillsdirectory.com/skills/xmtplabs-handling-commands)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: handling-commands
description: Patterns for handling commands, validating input, and filtering messages in XMTP agents. Use when implementing slash commands, validators, or message filters. Triggers on command handling, input validation, or type guards.
license: MIT
metadata:
  author: xmtp
  version: "1.0.0"
---

# XMTP commands and validation

Best practices for handling commands, validating input, and filtering messages.

## When to apply

Reference these guidelines when:
- Implementing slash commands
- Validating hex strings and addresses
- Filtering message types
- Using type guards instead of type assertions

## Rule categories by priority

| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Validators | CRITICAL | `validators-` |
| 2 | Filters | HIGH | `filters-` |
| 3 | Type Guards | HIGH | `guards-` |

## Quick reference

### Validators (CRITICAL)
- `validators-hex` - Use validHex() for hex string validation
- `validators-address` - Validate Ethereum addresses

### Filters (HIGH)
- `filters-message-types` - Filter by message type (SDK 2.0+: use direct imports `isText`, `isReaction`, `isReply`, etc. from `@xmtp/agent-sdk`; keep `filter.fromSelf`, `filter.hasDefinedContent`)
- `filters-sender` - Filter out self-messages
- `filters-content` - Check for defined content

### Type Guards (HIGH)
- `guards-codec` - Use usesCodec() instead of type assertions
- `guards-content-type` - Use filter helpers for type safety

## How to use

Read individual rule files for detailed explanations:

```
rules/validators-hex.md
rules/filters-message-types.md
rules/guards-codec.md
```

Files in this skill

  • SKILL.md1.6 KB
  • rules/filters-message-types.md1.1 KB
  • rules/guards-codec.md1.1 KB
  • rules/validators-hex.md942 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.