返回 Skill 列表
extension
分类: 开发与工程无需 API Key

handling-commands

用于处理命令、验证输入和过滤XMTP代理中消息的模式。在实现斜杠命令、验证器或消息过滤器时使用。在命令处理、输入验证或类型守卫时触发。

person作者: jakexiaohubgithub

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
  • 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